···294294<!ENTITY sub-srggb10 SYSTEM "v4l/pixfmt-srggb10.xml">295295<!ENTITY sub-srggb8 SYSTEM "v4l/pixfmt-srggb8.xml">296296<!ENTITY sub-y10 SYSTEM "v4l/pixfmt-y10.xml">297297+<!ENTITY sub-y12 SYSTEM "v4l/pixfmt-y12.xml">297298<!ENTITY sub-pixfmt SYSTEM "v4l/pixfmt.xml">298299<!ENTITY sub-cropcap SYSTEM "v4l/vidioc-cropcap.xml">299300<!ENTITY sub-dbg-g-register SYSTEM "v4l/vidioc-dbg-g-register.xml">
···5252 tasks # attach a task(thread) and show list of threads5353 cgroup.procs # show list of processes5454 cgroup.event_control # an interface for event_fd()5555- memory.usage_in_bytes # show current memory(RSS+Cache) usage.5656- memory.memsw.usage_in_bytes # show current memory+Swap usage5555+ memory.usage_in_bytes # show current res_counter usage for memory5656+ (See 5.5 for details)5757+ memory.memsw.usage_in_bytes # show current res_counter usage for memory+Swap5858+ (See 5.5 for details)5759 memory.limit_in_bytes # set/show limit of memory usage5860 memory.memsw.limit_in_bytes # set/show limit of memory+Swap usage5961 memory.failcnt # show the number of memory usage hits limits···454452455453You can reset failcnt by writing 0 to failcnt file.456454# echo 0 > .../memory.failcnt455455+456456+5.5 usage_in_bytes457457+458458+For efficiency, as other kernel components, memory cgroup uses some optimization459459+to avoid unnecessary cacheline false sharing. usage_in_bytes is affected by the460460+method and doesn't show 'exact' value of memory(and swap) usage, it's an fuzz461461+value for efficient access. (Of course, when necessary, it's synchronized.)462462+If you want to know more exact memory usage, you should use RSS+CACHE(+SWAP)463463+value in memory.stat(see 5.2).4574644584656. Hierarchy support459466
+2-2
Documentation/flexible-arrays.txt
···6666entering atomic context, using:67676868 int flex_array_prealloc(struct flex_array *array, unsigned int start,6969- unsigned int end, gfp_t flags);6969+ unsigned int nr_elements, gfp_t flags);70707171This function will ensure that memory for the elements indexed in the range7272-defined by start and end has been allocated. Thereafter, a7272+defined by start and nr_elements has been allocated. Thereafter, a7373flex_array_put() call on an element in that range is guaranteed not to7474block.7575
+19-17
Documentation/hwmon/adm1021
···1414 Prefix: 'gl523sm'1515 Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e1616 Datasheet:1717- * Intel Xeon Processor1818- Prefix: - any other - may require 'force_adm1021' parameter1919- Addresses scanned: none2020- Datasheet: Publicly available at Intel website2117 * Maxim MAX16172218 Prefix: 'max1617'2319 Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e···8791ADM1021-clones do faster measurements, but there is really no good reason8892for that.89939090-Xeon support9191-------------92949393-Some Xeon processors have real max1617, adm1021, or compatible chips9494-within them, with two temperature sensors.9595+Netburst-based Xeon support9696+---------------------------95979696-Other Xeons have chips with only one sensor.9898+Some Xeon processors based on the Netburst (early Pentium 4, from 2001 to9999+2003) microarchitecture had real MAX1617, ADM1021, or compatible chips100100+within them, with two temperature sensors. Other Xeon processors of this101101+era (with 400 MHz FSB) had chips with only one temperature sensor.971029898-If you have a Xeon, and the adm1021 module loads, and both temperatures9999-appear valid, then things are good.103103+If you have such an old Xeon, and you get two valid temperatures when104104+loading the adm1021 module, then things are good.100105101101-If the adm1021 module doesn't load, you should try this:102102- modprobe adm1021 force_adm1021=BUS,ADDRESS103103- ADDRESS can only be 0x18, 0x1a, 0x29, 0x2b, 0x4c, or 0x4e.106106+If nothing happens when loading the adm1021 module, and you are certain107107+that your specific Xeon processor model includes compatible sensors, you108108+will have to explicitly instantiate the sensor chips from user-space. See109109+method 4 in Documentation/i2c/instantiating-devices. Possible slave110110+addresses are 0x18, 0x1a, 0x29, 0x2b, 0x4c, or 0x4e. It is likely that111111+only temp2 will be correct and temp1 will have to be ignored.104112105105-If you have dual Xeons you may have appear to have two separate106106-adm1021-compatible chips, or two single-temperature sensors, at distinct107107-addresses.113113+Previous generations of the Xeon processor (based on Pentium II/III)114114+didn't have these sensors. Next generations of Xeon processors (533 MHz115115+FSB and faster) lost them, until the Core-based generation which116116+introduced integrated digital thermal sensors. These are supported by117117+the coretemp driver.
+20-9
Documentation/hwmon/lm90
···3232 Addresses scanned: I2C 0x4c and 0x4d3333 Datasheet: Publicly available at the ON Semiconductor website3434 http://www.onsemi.com/PowerSolutions/product.do?id=ADT74613535+ * Analog Devices ADT7461A3636+ Prefix: 'adt7461a'3737+ Addresses scanned: I2C 0x4c and 0x4d3838+ Datasheet: Publicly available at the ON Semiconductor website3939+ http://www.onsemi.com/PowerSolutions/product.do?id=ADT7461A4040+ * ON Semiconductor NCT10084141+ Prefix: 'nct1008'4242+ Addresses scanned: I2C 0x4c and 0x4d4343+ Datasheet: Publicly available at the ON Semiconductor website4444+ http://www.onsemi.com/PowerSolutions/product.do?id=NCT10083545 * Maxim MAX66463646 Prefix: 'max6646'3747 Addresses scanned: I2C 0x4d···159149 * ALERT is triggered by open remote sensor.160150 * SMBus PEC support for Write Byte and Receive Byte transactions.161151162162-ADT7461:152152+ADT7461, ADT7461A, NCT1008:163153 * Extended temperature range (breaks compatibility)164154 * Lower resolution for remote temperature165155···205195Only the local hysteresis can be set from user-space, and the same delta206196applies to the remote hysteresis.207197208208-The lm90 driver will not update its values more frequently than every209209-other second; reading them more often will do no harm, but will return210210-'old' values.198198+The lm90 driver will not update its values more frequently than configured with199199+the update_interval attribute; reading them more often will do no harm, but will200200+return 'old' values.211201212202SMBus Alert Support213203-------------------···215205This driver has basic support for SMBus alert. When an alert is received,216206the status register is read and the faulty temperature channel is logged.217207218218-The Analog Devices chips (ADM1032 and ADT7461) do not implement the SMBus219219-alert protocol properly so additional care is needed: the ALERT output is220220-disabled when an alert is received, and is re-enabled only when the alarm221221-is gone. Otherwise the chip would block alerts from other chips in the bus222222-as long as the alarm is active.208208+The Analog Devices chips (ADM1032, ADT7461 and ADT7461A) and ON209209+Semiconductor chips (NCT1008) do not implement the SMBus alert protocol210210+properly so additional care is needed: the ALERT output is disabled when211211+an alert is received, and is re-enabled only when the alarm is gone.212212+Otherwise the chip would block alerts from other chips in the bus as long213213+as the alarm is active.223214224215PEC Support225216-----------
···3737-1'-38383939In the above chart minuses and slashes represent "real" data amounts, points and4040-accents represent "useful" data, basically, CEU scaled amd cropped output,4040+accents represent "useful" data, basically, CEU scaled and cropped output,4141mapped back onto the client's source plane.42424343Such a configuration can be produced by user requests:···656566661. Calculate current sensor scales:67676868- scale_s = ((3') - (3)) / ((2') - (2))6868+ scale_s = ((2') - (2)) / ((3') - (3))696970702. Calculate "effective" input crop (sensor subwindow) - CEU crop scaled back at7171current sensor scales onto input window - this is user S_CROP:···80804. Calculate sensor output window by applying combined scales to real input8181window:82828383- width_s_out = ((2') - (2)) / scale_comb8383+ width_s_out = ((7') - (7)) = ((2') - (2)) / scale_comb848485855. Apply iterative sensor S_FMT for sensor output window.8686
+40
Documentation/workqueue.txt
···12124. Application Programming Interface (API)13135. Example Execution Scenarios14146. Guidelines1515+7. Debugging1516161717181. Introduction···380379* Unless work items are expected to consume a huge amount of CPU381380 cycles, using a bound wq is usually beneficial due to the increased382381 level of locality in wq operations and work item execution.382382+383383+384384+7. Debugging385385+386386+Because the work functions are executed by generic worker threads387387+there are a few tricks needed to shed some light on misbehaving388388+workqueue users.389389+390390+Worker threads show up in the process list as:391391+392392+root 5671 0.0 0.0 0 0 ? S 12:07 0:00 [kworker/0:1]393393+root 5672 0.0 0.0 0 0 ? S 12:07 0:00 [kworker/1:2]394394+root 5673 0.0 0.0 0 0 ? S 12:12 0:00 [kworker/0:0]395395+root 5674 0.0 0.0 0 0 ? S 12:13 0:00 [kworker/1:0]396396+397397+If kworkers are going crazy (using too much cpu), there are two types398398+of possible problems:399399+400400+ 1. Something beeing scheduled in rapid succession401401+ 2. A single work item that consumes lots of cpu cycles402402+403403+The first one can be tracked using tracing:404404+405405+ $ echo workqueue:workqueue_queue_work > /sys/kernel/debug/tracing/set_event406406+ $ cat /sys/kernel/debug/tracing/trace_pipe > out.txt407407+ (wait a few secs)408408+ ^C409409+410410+If something is busy looping on work queueing, it would be dominating411411+the output and the offender can be determined with the work item412412+function.413413+414414+For the second type of problems it should be possible to just check415415+the stack trace of the offending worker thread.416416+417417+ $ cat /proc/THE_OFFENDING_KWORKER/stack418418+419419+The work item's function should be trivially visible in the stack420420+trace.
+16-15
MAINTAINERS
···10321032S: Maintained10331033F: arch/arm/mach-s3c64xx/1034103410351035-ARM/S5P ARM ARCHITECTURES10351035+ARM/S5P EXYNOS ARM ARCHITECTURES10361036M: Kukjin Kim <kgene.kim@samsung.com>10371037L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)10381038L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)10391039S: Maintained10401040F: arch/arm/mach-s5p*/10411041+F: arch/arm/mach-exynos*/1041104210421043ARM/SAMSUNG MOBILE MACHINE SUPPORT10431044M: Kyungmin Park <kyungmin.park@samsung.com>···28092808M: Grant Likely <grant.likely@secretlab.ca>28102809S: Maintained28112810T: git git://git.secretlab.ca/git/linux-2.6.git28122812-F: Documentation/gpio/gpio.txt28112811+F: Documentation/gpio.txt28132812F: drivers/gpio/28142813F: include/linux/gpio*28152814···65566555F: drivers/usb/host/uhci*6557655665586557USB "USBNET" DRIVER FRAMEWORK65596559-M: David Brownell <dbrownell@users.sourceforge.net>65586558+M: Oliver Neukum <oneukum@suse.de>65606559L: netdev@vger.kernel.org65616560W: http://www.linux-usb.org/usbnet65626561S: Maintained···69226921S: Maintained69236922F: drivers/platform/x866924692369246924+XEN HYPERVISOR INTERFACE69256925+M: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>69266926+M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>69276927+L: xen-devel@lists.xensource.com (moderated for non-subscribers)69286928+L: virtualization@lists.linux-foundation.org69296929+S: Supported69306930+F: arch/x86/xen/69316931+F: drivers/*/xen-*front.c69326932+F: drivers/xen/69336933+F: arch/x86/include/asm/xen/69346934+F: include/xen/69356935+69256936XEN NETWORK BACKEND DRIVER69266937M: Ian Campbell <ian.campbell@citrix.com>69276938L: xen-devel@lists.xensource.com (moderated for non-subscribers)···69546941S: Supported69556942F: arch/x86/xen/*swiotlb*69566943F: drivers/xen/*swiotlb*69576957-69586958-XEN HYPERVISOR INTERFACE69596959-M: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>69606960-M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>69616961-L: xen-devel@lists.xensource.com (moderated for non-subscribers)69626962-L: virtualization@lists.linux-foundation.org69636963-S: Supported69646964-F: arch/x86/xen/69656965-F: drivers/*/xen-*front.c69666966-F: drivers/xen/69676967-F: arch/x86/include/asm/xen/69686968-F: include/xen/6969694469706945XFS FILESYSTEM69716946P: Silicon Graphics Inc
···11+CONFIG_EXPERIMENTAL=y22+CONFIG_LOG_BUF_SHIFT=1433+CONFIG_EMBEDDED=y44+# CONFIG_HOTPLUG is not set55+# CONFIG_ELF_CORE is not set66+# CONFIG_FUTEX is not set77+# CONFIG_TIMERFD is not set88+# CONFIG_VM_EVENT_COUNTERS is not set99+# CONFIG_COMPAT_BRK is not set1010+CONFIG_SLAB=y1111+# CONFIG_LBDAF is not set1212+# CONFIG_BLK_DEV_BSG is not set1313+# CONFIG_IOSCHED_DEADLINE is not set1414+# CONFIG_IOSCHED_CFQ is not set1515+# CONFIG_MMU is not set1616+CONFIG_ARCH_AT91=y1717+CONFIG_ARCH_AT91X40=y1818+CONFIG_MACH_AT91EB01=y1919+CONFIG_AT91_EARLY_USART0=y2020+CONFIG_CPU_ARM7TDMI=y2121+CONFIG_SET_MEM_PARAM=y2222+CONFIG_DRAM_BASE=0x010000002323+CONFIG_DRAM_SIZE=0x004000002424+CONFIG_FLASH_MEM_BASE=0x014000002525+CONFIG_PROCESSOR_ID=0x140000402626+CONFIG_ZBOOT_ROM_TEXT=0x02727+CONFIG_ZBOOT_ROM_BSS=0x02828+CONFIG_BINFMT_FLAT=y2929+# CONFIG_SUSPEND is not set3030+# CONFIG_FW_LOADER is not set3131+CONFIG_MTD=y3232+CONFIG_MTD_PARTITIONS=y3333+CONFIG_MTD_CHAR=y3434+CONFIG_MTD_BLOCK=y3535+CONFIG_MTD_RAM=y3636+CONFIG_MTD_ROM=y3737+CONFIG_BLK_DEV_RAM=y3838+# CONFIG_INPUT is not set3939+# CONFIG_SERIO is not set4040+# CONFIG_VT is not set4141+# CONFIG_DEVKMEM is not set4242+# CONFIG_HW_RANDOM is not set4343+# CONFIG_HWMON is not set4444+# CONFIG_USB_SUPPORT is not set4545+CONFIG_EXT2_FS=y4646+# CONFIG_DNOTIFY is not set4747+CONFIG_ROMFS_FS=y4848+# CONFIG_ENABLE_MUST_CHECK is not set
+3
arch/arm/include/asm/kprobes.h
···3939struct kprobe;4040typedef void (kprobe_insn_handler_t)(struct kprobe *, struct pt_regs *);41414242+typedef unsigned long (kprobe_check_cc)(unsigned long);4343+4244/* Architecture specific copy of original instruction. */4345struct arch_specific_insn {4446 kprobe_opcode_t *insn;4547 kprobe_insn_handler_t *insn_handler;4848+ kprobe_check_cc *insn_check_cc;4649};47504851struct prev_kprobe {
···767767768768#ifdef CONFIG_HAVE_HW_BREAKPOINT769769 case PTRACE_GETHBPREGS:770770+ if (ptrace_get_breakpoints(child) < 0)771771+ return -ESRCH;772772+770773 ret = ptrace_gethbpregs(child, addr,771774 (unsigned long __user *)data);775775+ ptrace_put_breakpoints(child);772776 break;773777 case PTRACE_SETHBPREGS:778778+ if (ptrace_get_breakpoints(child) < 0)779779+ return -ESRCH;780780+774781 ret = ptrace_sethbpregs(child, addr,775782 (unsigned long __user *)data);783783+ ptrace_put_breakpoints(child);776784 break;777785#endif778786
···6363 depends on ARCH_DAVINCI_DM644x6464 select MISC_DEVICES6565 select EEPROM_AT246666+ select I2C6667 help6768 Configure this option to specify the whether the board used6869 for development is a DM644x EVM···7372 depends on ARCH_DAVINCI_DM644x7473 select MISC_DEVICES7574 select EEPROM_AT247575+ select I2C7676 help7777 Say Y here to select the Lyrtech Small Form Factor7878 Software Defined Radio (SFFSDR) board.···107105 select MACH_DAVINCI_DM6467TEVM108106 select MISC_DEVICES109107 select EEPROM_AT24108108+ select I2C110109 help111110 Configure this option to specify the whether the board used112111 for development is a DM6467 EVM···121118 depends on ARCH_DAVINCI_DM365122119 select MISC_DEVICES123120 select EEPROM_AT24121121+ select I2C124122 help125123 Configure this option to specify whether the board used126124 for development is a DM365 EVM···133129 select GPIO_PCF857X134130 select MISC_DEVICES135131 select EEPROM_AT24132132+ select I2C136133 help137134 Say Y here to select the TI DA830/OMAP-L137/AM17x Evaluation Module.138135···210205 depends on ARCH_DAVINCI_DA850211206 select MISC_DEVICES212207 select EEPROM_AT24208208+ select I2C213209 help214210 Say Y here to select the Critical Link MityDSP-L138/MityARM-1808215211 System on Module. Information on this SoM may be found at
···31163116 CLK(NULL, "dsp_fck", &dsp_fck, CK_443X),31173117 CLK("omapdss_dss", "sys_clk", &dss_sys_clk, CK_443X),31183118 CLK("omapdss_dss", "tv_clk", &dss_tv_clk, CK_443X),31193119- CLK("omapdss_dss", "dss_clk", &dss_dss_clk, CK_443X),31203119 CLK("omapdss_dss", "video_clk", &dss_48mhz_clk, CK_443X),31213121- CLK("omapdss_dss", "fck", &dss_fck, CK_443X),31223122- /*31233123- * On OMAP4, DSS ick is a dummy clock; this is needed for compatibility31243124- * with OMAP2/3.31253125- */31263126- CLK("omapdss_dss", "ick", &dummy_ck, CK_443X),31203120+ CLK("omapdss_dss", "fck", &dss_dss_clk, CK_443X),31213121+ CLK("omapdss_dss", "ick", &dss_fck, CK_443X),31273122 CLK(NULL, "efuse_ctrl_cust_fck", &efuse_ctrl_cust_fck, CK_443X),31283123 CLK(NULL, "emif1_fck", &emif1_fck, CK_443X),31293124 CLK(NULL, "emif2_fck", &emif2_fck, CK_443X),
+17
arch/arm/mach-omap2/cm2xxx_3xxx.c
···247247 u32 per_cm_clksel;248248 u32 emu_cm_clksel;249249 u32 emu_cm_clkstctrl;250250+ u32 pll_cm_autoidle;250251 u32 pll_cm_autoidle2;251252 u32 pll_cm_clksel4;252253 u32 pll_cm_clksel5;···320319 omap2_cm_read_mod_reg(OMAP3430_EMU_MOD, CM_CLKSEL1);321320 cm_context.emu_cm_clkstctrl =322321 omap2_cm_read_mod_reg(OMAP3430_EMU_MOD, OMAP2_CM_CLKSTCTRL);322322+ /*323323+ * As per erratum i671, ROM code does not respect the PER DPLL324324+ * programming scheme if CM_AUTOIDLE_PLL.AUTO_PERIPH_DPLL == 1.325325+ * In this case, even though this register has been saved in326326+ * scratchpad contents, we need to restore AUTO_PERIPH_DPLL327327+ * by ourselves. So, we need to save it anyway.328328+ */329329+ cm_context.pll_cm_autoidle =330330+ omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);323331 cm_context.pll_cm_autoidle2 =324332 omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE2);325333 cm_context.pll_cm_clksel4 =···451441 CM_CLKSEL1);452442 omap2_cm_write_mod_reg(cm_context.emu_cm_clkstctrl, OMAP3430_EMU_MOD,453443 OMAP2_CM_CLKSTCTRL);444444+ /*445445+ * As per erratum i671, ROM code does not respect the PER DPLL446446+ * programming scheme if CM_AUTOIDLE_PLL.AUTO_PERIPH_DPLL == 1.447447+ * In this case, we need to restore AUTO_PERIPH_DPLL by ourselves.448448+ */449449+ omap2_cm_write_mod_reg(cm_context.pll_cm_autoidle, PLL_MOD,450450+ CM_AUTOIDLE);454451 omap2_cm_write_mod_reg(cm_context.pll_cm_autoidle2, PLL_MOD,455452 CM_AUTOIDLE2);456453 omap2_cm_write_mod_reg(cm_context.pll_cm_clksel4, PLL_MOD,
+7-1
arch/arm/mach-omap2/control.c
···316316 omap2_cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);317317 prcm_block_contents.cm_clken_pll =318318 omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);319319+ /*320320+ * As per erratum i671, ROM code does not respect the PER DPLL321321+ * programming scheme if CM_AUTOIDLE_PLL..AUTO_PERIPH_DPLL == 1.322322+ * Then, in anycase, clear these bits to avoid extra latencies.323323+ */319324 prcm_block_contents.cm_autoidle_pll =320320- omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_AUTOIDLE_PLL);325325+ omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE) &326326+ ~OMAP3430_AUTO_PERIPH_DPLL_MASK;321327 prcm_block_contents.cm_clksel1_pll =322328 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430_CM_CLKSEL1_PLL);323329 prcm_block_contents.cm_clksel2_pll =
···295295 return 0;296296}297297298298+/*299299+ * This lock class tells lockdep that GPIO irqs are in a different300300+ * category than their parents, so it won't report false recursion.301301+ */302302+static struct lock_class_key gpio_lock_class;303303+298304int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt)299305{300306 int i, j;···317311 __raw_writel(~0, port[i].base + GPIO_ISR);318312 for (j = port[i].virtual_irq_start;319313 j < port[i].virtual_irq_start + 32; j++) {314314+ irq_set_lockdep_class(j, &gpio_lock_class);320315 irq_set_chip_and_handler(j, &gpio_irq_chip,321316 handle_level_irq);322317 set_irq_flags(j, IRQF_VALID);
···266266 }267267 memset(pfnnid_map, 0xff, sizeof(pfnnid_map));268268269269- for (i = 0; i < npmem_ranges; i++)269269+ for (i = 0; i < npmem_ranges; i++) {270270+ node_set_state(i, N_NORMAL_MEMORY);270271 node_set_online(i);272272+ }271273#endif272274273275 /*
+2-2
arch/powerpc/include/asm/8xx_immap.h
···393393 uint fec_addr_low; /* lower 32 bits of station address */394394 ushort fec_addr_high; /* upper 16 bits of station address */395395 ushort res1; /* reserved */396396- uint fec_hash_table_high; /* upper 32-bits of hash table */397397- uint fec_hash_table_low; /* lower 32-bits of hash table */396396+ uint fec_grp_hash_table_high; /* upper 32-bits of hash table */397397+ uint fec_grp_hash_table_low; /* lower 32-bits of hash table */398398 uint fec_r_des_start; /* beginning of Rx descriptor ring */399399 uint fec_x_des_start; /* beginning of Tx descriptor ring */400400 uint fec_r_buff_size; /* Rx buffer size */
+1-1
arch/powerpc/include/asm/uninorth.h
···6060 *6161 * Obviously, the GART is not cache coherent and so any change to it6262 * must be flushed to memory (or maybe just make the GART space non6363- * cachable). AGP memory itself does't seem to be cache coherent neither.6363+ * cachable). AGP memory itself doesn't seem to be cache coherent neither.6464 *6565 * In order to invalidate the GART (which is probably necessary to inval6666 * the bridge internal TLBs), the following sequence has to be written,
+11-1
arch/powerpc/kernel/ptrace.c
···933933 if (data && !(data & DABR_TRANSLATION))934934 return -EIO;935935#ifdef CONFIG_HAVE_HW_BREAKPOINT936936+ if (ptrace_get_breakpoints(task) < 0)937937+ return -ESRCH;938938+936939 bp = thread->ptrace_bps[0];937940 if ((!data) || !(data & (DABR_DATA_WRITE | DABR_DATA_READ))) {938941 if (bp) {939942 unregister_hw_breakpoint(bp);940943 thread->ptrace_bps[0] = NULL;941944 }945945+ ptrace_put_breakpoints(task);942946 return 0;943947 }944948 if (bp) {···952948 (DABR_DATA_WRITE | DABR_DATA_READ),953949 &attr.bp_type);954950 ret = modify_user_hw_breakpoint(bp, &attr);955955- if (ret)951951+ if (ret) {952952+ ptrace_put_breakpoints(task);956953 return ret;954954+ }957955 thread->ptrace_bps[0] = bp;956956+ ptrace_put_breakpoints(task);958957 thread->dabr = data;959958 return 0;960959 }···972965 ptrace_triggered, task);973966 if (IS_ERR(bp)) {974967 thread->ptrace_bps[0] = NULL;968968+ ptrace_put_breakpoints(task);975969 return PTR_ERR(bp);976970 }971971+972972+ ptrace_put_breakpoints(task);977973978974#endif /* CONFIG_HAVE_HW_BREAKPOINT */979975
+1-1
arch/s390/crypto/prng.c
···76767777 /* Add the entropy */7878 while (nbytes >= 8) {7979- *((__u64 *)parm_block) ^= *((__u64 *)buf+i*8);7979+ *((__u64 *)parm_block) ^= *((__u64 *)(buf+i));8080 prng_add_entropy();8181 i += 8;8282 nbytes -= 8;
···47474848config HPPFS4949 tristate "HoneyPot ProcFS (EXPERIMENTAL)"5050- depends on EXPERIMENTAL5050+ depends on EXPERIMENTAL && PROC_FS5151 help5252 hppfs (HoneyPot ProcFS) is a filesystem which allows UML /proc5353 entries to be overridden, removed, or fabricated from the host.
···9191 if (oreg.ax > 15*1024) {9292 return -1; /* Bogus! */9393 } else if (oreg.ax == 15*1024) {9494- boot_params.alt_mem_k = (oreg.dx << 6) + oreg.ax;9494+ boot_params.alt_mem_k = (oreg.bx << 6) + oreg.ax;9595 } else {9696 /*9797 * This ignores memory above 16MB if we have a memory
+1-1
arch/x86/include/asm/io_apic.h
···150150extern void ioapic_and_gsi_init(void);151151extern void ioapic_insert_resources(void);152152153153-int io_apic_setup_irq_pin(unsigned int irq, int node, struct io_apic_irq_attr *attr);153153+int io_apic_setup_irq_pin_once(unsigned int irq, int node, struct io_apic_irq_attr *attr);154154155155extern struct IO_APIC_route_entry **alloc_ioapic_entries(void);156156extern void free_ioapic_entries(struct IO_APIC_route_entry **ioapic_entries);
+5-5
arch/x86/kernel/apic/io_apic.c
···128128}129129early_param("noapic", parse_noapic);130130131131-static int io_apic_setup_irq_pin_once(unsigned int irq, int node,132132- struct io_apic_irq_attr *attr);131131+static int io_apic_setup_irq_pin(unsigned int irq, int node,132132+ struct io_apic_irq_attr *attr);133133134134/* Will be called in mpparse/acpi/sfi codes for saving IRQ info */135135void mp_save_irq(struct mpc_intsrc *m)···35703570}35713571#endif /* CONFIG_HT_IRQ */3572357235733573-int35733573+static int35743574io_apic_setup_irq_pin(unsigned int irq, int node, struct io_apic_irq_attr *attr)35753575{35763576 struct irq_cfg *cfg = alloc_irq_and_cfg_at(irq, node);···35853585 return ret;35863586}3587358735883588-static int io_apic_setup_irq_pin_once(unsigned int irq, int node,35893589- struct io_apic_irq_attr *attr)35883588+int io_apic_setup_irq_pin_once(unsigned int irq, int node,35893589+ struct io_apic_irq_attr *attr)35903590{35913591 unsigned int id = attr->ioapic, pin = attr->ioapic_pin;35923592 int ret;
···608608 unsigned len, type;609609 struct perf_event *bp;610610611611+ if (ptrace_get_breakpoints(tsk) < 0)612612+ return -ESRCH;613613+611614 data &= ~DR_CONTROL_RESERVED;612615 old_dr7 = ptrace_get_dr7(thread->ptrace_bps);613616restore:···658655 }659656 goto restore;660657 }658658+659659+ ptrace_put_breakpoints(tsk);660660+661661 return ((orig_ret < 0) ? orig_ret : rc);662662}663663···674668675669 if (n < HBP_NUM) {676670 struct perf_event *bp;671671+672672+ if (ptrace_get_breakpoints(tsk) < 0)673673+ return -ESRCH;674674+677675 bp = thread->ptrace_bps[n];678676 if (!bp)679679- return 0;680680- val = bp->hw.info.address;677677+ val = 0;678678+ else679679+ val = bp->hw.info.address;680680+681681+ ptrace_put_breakpoints(tsk);681682 } else if (n == 6) {682683 val = thread->debugreg6;683684 } else if (n == 7) {···699686 struct perf_event *bp;700687 struct thread_struct *t = &tsk->thread;701688 struct perf_event_attr attr;689689+ int err = 0;690690+691691+ if (ptrace_get_breakpoints(tsk) < 0)692692+ return -ESRCH;702693703694 if (!t->ptrace_bps[nr]) {704695 ptrace_breakpoint_init(&attr);···726709 * writing for the user. And anyway this is the previous727710 * behaviour.728711 */729729- if (IS_ERR(bp))730730- return PTR_ERR(bp);712712+ if (IS_ERR(bp)) {713713+ err = PTR_ERR(bp);714714+ goto put;715715+ }731716732717 t->ptrace_bps[nr] = bp;733718 } else {734734- int err;735735-736719 bp = t->ptrace_bps[nr];737720738721 attr = bp->attr;739722 attr.bp_addr = addr;740723 err = modify_user_hw_breakpoint(bp, &attr);741741- if (err)742742- return err;743724 }744725745745-746746- return 0;726726+put:727727+ ptrace_put_breakpoints(tsk);728728+ return err;747729}748730749731/*
+6-6
arch/x86/kernel/reboot_32.S
···2121 /* Get our own relocated address */2222 call 1f23231: popl %ebx2424- subl $1b, %ebx2424+ subl $(1b - r_base), %ebx25252626 /* Compute the equivalent real-mode segment */2727 movl %ebx, %ecx2828 shrl $4, %ecx29293030 /* Patch post-real-mode segment jump */3131- movw dispatch_table(%ebx,%eax,2),%ax3232- movw %ax, 101f(%ebx)3333- movw %cx, 102f(%ebx)3131+ movw (dispatch_table - r_base)(%ebx,%eax,2),%ax3232+ movw %ax, (101f - r_base)(%ebx)3333+ movw %cx, (102f - r_base)(%ebx)34343535 /* Set up the IDT for real mode. */3636- lidtl machine_real_restart_idt(%ebx)3636+ lidtl (machine_real_restart_idt - r_base)(%ebx)37373838 /*3939 * Set up a GDT from which we can load segment descriptors for real4040 * mode. The GDT is not used in real mode; it is just needed here to4141 * prepare the descriptors.4242 */4343- lgdtl machine_real_restart_gdt(%ebx)4343+ lgdtl (machine_real_restart_gdt - r_base)(%ebx)44444545 /*4646 * Load the data segment registers with 16-bit compatible values
+1-1
arch/x86/mm/numa_64.c
···306306 bi->end = min(bi->end, high);307307308308 /* and there's no empty block */309309- if (bi->start == bi->end) {309309+ if (bi->start >= bi->end) {310310 numa_remove_memblk_from(i--, mi);311311 continue;312312 }
···14631463 return ret;14641464}1465146514661466+#ifdef CONFIG_X86_6414671467+static __initdata u64 __last_pgt_set_rw = 0;14681468+static __initdata u64 __pgt_buf_start = 0;14691469+static __initdata u64 __pgt_buf_end = 0;14701470+static __initdata u64 __pgt_buf_top = 0;14711471+/*14721472+ * As a consequence of the commit:14731473+ * 14741474+ * commit 4b239f458c229de044d6905c2b0f9fe16ed9e01e14751475+ * Author: Yinghai Lu <yinghai@kernel.org>14761476+ * Date: Fri Dec 17 16:58:28 2010 -080014771477+ * 14781478+ * x86-64, mm: Put early page table high14791479+ * 14801480+ * at some point init_memory_mapping is going to reach the pagetable pages14811481+ * area and map those pages too (mapping them as normal memory that falls14821482+ * in the range of addresses passed to init_memory_mapping as argument).14831483+ * Some of those pages are already pagetable pages (they are in the range14841484+ * pgt_buf_start-pgt_buf_end) therefore they are going to be mapped RO and14851485+ * everything is fine.14861486+ * Some of these pages are not pagetable pages yet (they fall in the range14871487+ * pgt_buf_end-pgt_buf_top; for example the page at pgt_buf_end) so they14881488+ * are going to be mapped RW. When these pages become pagetable pages and14891489+ * are hooked into the pagetable, xen will find that the guest has already14901490+ * a RW mapping of them somewhere and fail the operation.14911491+ * The reason Xen requires pagetables to be RO is that the hypervisor needs14921492+ * to verify that the pagetables are valid before using them. The validation14931493+ * operations are called "pinning".14941494+ * 14951495+ * In order to fix the issue we mark all the pages in the entire range14961496+ * pgt_buf_start-pgt_buf_top as RO, however when the pagetable allocation14971497+ * is completed only the range pgt_buf_start-pgt_buf_end is reserved by14981498+ * init_memory_mapping. Hence the kernel is going to crash as soon as one14991499+ * of the pages in the range pgt_buf_end-pgt_buf_top is reused (b/c those15001500+ * ranges are RO).15011501+ * 15021502+ * For this reason, 'mark_rw_past_pgt' is introduced which is called _after_15031503+ * the init_memory_mapping has completed (in a perfect world we would15041504+ * call this function from init_memory_mapping, but lets ignore that).15051505+ * 15061506+ * Because we are called _after_ init_memory_mapping the pgt_buf_[start,15071507+ * end,top] have all changed to new values (b/c init_memory_mapping15081508+ * is called and setting up another new page-table). Hence, the first time15091509+ * we enter this function, we save away the pgt_buf_start value and update15101510+ * the pgt_buf_[end,top].15111511+ * 15121512+ * When we detect that the "old" pgt_buf_start through pgt_buf_end15131513+ * PFNs have been reserved (so memblock_x86_reserve_range has been called),15141514+ * we immediately set out to RW the "old" pgt_buf_end through pgt_buf_top.15151515+ * 15161516+ * And then we update those "old" pgt_buf_[end|top] with the new ones15171517+ * so that we can redo this on the next pagetable.15181518+ */15191519+static __init void mark_rw_past_pgt(void) {15201520+15211521+ if (pgt_buf_end > pgt_buf_start) {15221522+ u64 addr, size;15231523+15241524+ /* Save it away. */15251525+ if (!__pgt_buf_start) {15261526+ __pgt_buf_start = pgt_buf_start;15271527+ __pgt_buf_end = pgt_buf_end;15281528+ __pgt_buf_top = pgt_buf_top;15291529+ return;15301530+ }15311531+ /* If we get the range that starts at __pgt_buf_end that means15321532+ * the range is reserved, and that in 'init_memory_mapping'15331533+ * the 'memblock_x86_reserve_range' has been called with the15341534+ * outdated __pgt_buf_start, __pgt_buf_end (the "new"15351535+ * pgt_buf_[start|end|top] refer now to a new pagetable.15361536+ * Note: we are called _after_ the pgt_buf_[..] have been15371537+ * updated.*/15381538+15391539+ addr = memblock_x86_find_in_range_size(PFN_PHYS(__pgt_buf_start),15401540+ &size, PAGE_SIZE);15411541+15421542+ /* Still not reserved, meaning 'memblock_x86_reserve_range'15431543+ * hasn't been called yet. Update the _end and _top.*/15441544+ if (addr == PFN_PHYS(__pgt_buf_start)) {15451545+ __pgt_buf_end = pgt_buf_end;15461546+ __pgt_buf_top = pgt_buf_top;15471547+ return;15481548+ }15491549+15501550+ /* OK, the area is reserved, meaning it is time for us to15511551+ * set RW for the old end->top PFNs. */15521552+15531553+ /* ..unless we had already done this. */15541554+ if (__pgt_buf_end == __last_pgt_set_rw)15551555+ return;15561556+15571557+ addr = PFN_PHYS(__pgt_buf_end);15581558+15591559+ /* set as RW the rest */15601560+ printk(KERN_DEBUG "xen: setting RW the range %llx - %llx\n",15611561+ PFN_PHYS(__pgt_buf_end), PFN_PHYS(__pgt_buf_top));15621562+15631563+ while (addr < PFN_PHYS(__pgt_buf_top)) {15641564+ make_lowmem_page_readwrite(__va(addr));15651565+ addr += PAGE_SIZE;15661566+ }15671567+ /* And update everything so that we are ready for the next15681568+ * pagetable (the one created for regions past 4GB) */15691569+ __last_pgt_set_rw = __pgt_buf_end;15701570+ __pgt_buf_start = pgt_buf_start;15711571+ __pgt_buf_end = pgt_buf_end;15721572+ __pgt_buf_top = pgt_buf_top;15731573+ }15741574+ return;15751575+}15761576+#else15771577+static __init void mark_rw_past_pgt(void) { }15781578+#endif14661579static void xen_pgd_free(struct mm_struct *mm, pgd_t *pgd)14671580{14681581#ifdef CONFIG_X86_64···16021489 unsigned long pfn = pte_pfn(pte);1603149016041491 /*14921492+ * A bit of optimization. We do not need to call the workaround14931493+ * when xen_set_pte_init is called with a PTE with 0 as PFN.14941494+ * That is b/c the pagetable at that point are just being populated14951495+ * with empty values and we can save some cycles by not calling14961496+ * the 'memblock' code.*/14971497+ if (pfn)14981498+ mark_rw_past_pgt();14991499+ /*16051500 * If the new pfn is within the range of the newly allocated16061501 * kernel pagetable, and it isn't being mapped into an16071502 * early_ioremap fixmap slot as a freshly allocated page, make sure16081503 * it is RO.16091504 */16101505 if (((!is_early_ioremap_ptep(ptep) &&16111611- pfn >= pgt_buf_start && pfn < pgt_buf_end)) ||15061506+ pfn >= pgt_buf_start && pfn < pgt_buf_top)) ||16121507 (is_early_ioremap_ptep(ptep) && pfn != (pgt_buf_end - 1)))16131508 pte = pte_wrprotect(pte);16141509···2118199721191998static __init void xen_post_allocator_init(void)21201999{20002000+ mark_rw_past_pgt();20012001+21212002#ifdef CONFIG_XEN_DEBUG21222003 pv_mmu_ops.make_pte = PV_CALLEE_SAVE(xen_make_pte_debug);21232004#endif
+4
drivers/acpi/scan.c
···943943 if (ACPI_SUCCESS(status))944944 device->flags.lockable = 1;945945946946+ /* Power resources cannot be power manageable. */947947+ if (device->device_type == ACPI_BUS_TYPE_POWER)948948+ return 0;949949+946950 /* Presence of _PS0|_PR0 indicates 'power manageable' */947951 status = acpi_get_handle(device->handle, "_PS0", &temp);948952 if (ACPI_FAILURE(status))
···258258 if (!!dev->power.can_wakeup == !!capable)259259 return;260260261261- if (device_is_registered(dev)) {261261+ if (device_is_registered(dev) && !list_empty(&dev->power.entry)) {262262 if (capable) {263263 if (wakeup_sysfs_add(dev))264264 return;
+2-2
drivers/block/rbd.c
···777777 ops,778778 false,779779 GFP_NOIO, pages, bio);780780- if (IS_ERR(req)) {780780+ if (!req) {781781 up_read(&header->snap_rwsem);782782- ret = PTR_ERR(req);782782+ ret = -ENOMEM;783783 goto done_pages;784784 }785785
+9-10
drivers/clk/clkdev.c
···3232 * Then we take the most specific entry - with the following3333 * order of precedence: dev+con > dev only > con only.3434 */3535-static struct clk *clk_find(const char *dev_id, const char *con_id)3535+static struct clk_lookup *clk_find(const char *dev_id, const char *con_id)3636{3737- struct clk_lookup *p;3838- struct clk *clk = NULL;3737+ struct clk_lookup *p, *cl = NULL;3938 int match, best = 0;40394140 list_for_each_entry(p, &clocks, node) {···5152 }52535354 if (match > best) {5454- clk = p->clk;5555+ cl = p;5556 if (match != 3)5657 best = match;5758 else5859 break;5960 }6061 }6161- return clk;6262+ return cl;6263}63646465struct clk *clk_get_sys(const char *dev_id, const char *con_id)6566{6666- struct clk *clk;6767+ struct clk_lookup *cl;67686869 mutex_lock(&clocks_mutex);6969- clk = clk_find(dev_id, con_id);7070- if (clk && !__clk_get(clk))7171- clk = NULL;7070+ cl = clk_find(dev_id, con_id);7171+ if (cl && !__clk_get(cl->clk))7272+ cl = NULL;7273 mutex_unlock(&clocks_mutex);73747474- return clk ? clk : ERR_PTR(-ENOENT);7575+ return cl ? cl->clk : ERR_PTR(-ENOENT);7576}7677EXPORT_SYMBOL(clk_get_sys);7778
···21992199{22002200 struct fw_ohci *ohci;22012201 unsigned long flags;22022202- int ret = -EBUSY;22032202 __be32 *next_config_rom;22042203 dma_addr_t uninitialized_var(next_config_rom_bus);22052204···2239224022402241 spin_lock_irqsave(&ohci->lock, flags);2241224222432243+ /*22442244+ * If there is not an already pending config_rom update,22452245+ * push our new allocation into the ohci->next_config_rom22462246+ * and then mark the local variable as null so that we22472247+ * won't deallocate the new buffer.22482248+ *22492249+ * OTOH, if there is a pending config_rom update, just22502250+ * use that buffer with the new config_rom data, and22512251+ * let this routine free the unused DMA allocation.22522252+ */22532253+22422254 if (ohci->next_config_rom == NULL) {22432255 ohci->next_config_rom = next_config_rom;22442256 ohci->next_config_rom_bus = next_config_rom_bus;22452245-22462246- copy_config_rom(ohci->next_config_rom, config_rom, length);22472247-22482248- ohci->next_header = config_rom[0];22492249- ohci->next_config_rom[0] = 0;22502250-22512251- reg_write(ohci, OHCI1394_ConfigROMmap,22522252- ohci->next_config_rom_bus);22532253- ret = 0;22572257+ next_config_rom = NULL;22542258 }2255225922602260+ copy_config_rom(ohci->next_config_rom, config_rom, length);22612261+22622262+ ohci->next_header = config_rom[0];22632263+ ohci->next_config_rom[0] = 0;22642264+22652265+ reg_write(ohci, OHCI1394_ConfigROMmap, ohci->next_config_rom_bus);22662266+22562267 spin_unlock_irqrestore(&ohci->lock, flags);22682268+22692269+ /* If we didn't use the DMA allocation, delete it. */22702270+ if (next_config_rom != NULL)22712271+ dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,22722272+ next_config_rom, next_config_rom_bus);2257227322582274 /*22592275 * Now initiate a bus reset to have the changes take···22772263 * controller could need to access it before the bus reset22782264 * takes effect.22792265 */22802280- if (ret == 0)22812281- fw_schedule_bus_reset(&ohci->card, true, true);22822282- else22832283- dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,22842284- next_config_rom, next_config_rom_bus);2285226622862286- return ret;22672267+ fw_schedule_bus_reset(&ohci->card, true, true);22682268+22692269+ return 0;22872270}2288227122892272static void ohci_send_request(struct fw_card *card, struct fw_packet *packet)
+1
drivers/gpu/drm/Kconfig
···2424 depends on DRM2525 select FB2626 select FRAMEBUFFER_CONSOLE if !EXPERT2727+ select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE2728 help2829 FB and CRTC helpers for KMS drivers.2930
+20-7
drivers/gpu/drm/drm_fb_helper.c
···342342}343343EXPORT_SYMBOL(drm_fb_helper_debug_leave);344344345345+bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper)346346+{347347+ bool error = false;348348+ int i, ret;349349+ for (i = 0; i < fb_helper->crtc_count; i++) {350350+ struct drm_mode_set *mode_set = &fb_helper->crtc_info[i].mode_set;351351+ ret = drm_crtc_helper_set_config(mode_set);352352+ if (ret)353353+ error = true;354354+ }355355+ return error;356356+}357357+EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode);358358+345359bool drm_fb_helper_force_kernel_mode(void)346360{347347- int i = 0;348361 bool ret, error = false;349362 struct drm_fb_helper *helper;350363···365352 return false;366353367354 list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) {368368- for (i = 0; i < helper->crtc_count; i++) {369369- struct drm_mode_set *mode_set = &helper->crtc_info[i].mode_set;370370- ret = drm_crtc_helper_set_config(mode_set);371371- if (ret)372372- error = true;373373- }355355+ if (helper->dev->switch_power_state == DRM_SWITCH_POWER_OFF)356356+ continue;357357+358358+ ret = drm_fb_helper_restore_fbdev_mode(helper);359359+ if (ret)360360+ error = true;374361 }375362 return error;376363}
···5154515451555155 I915_WRITE(DSPCNTR(plane), dspcntr);51565156 POSTING_READ(DSPCNTR(plane));51575157- if (!HAS_PCH_SPLIT(dev))51585158- intel_enable_plane(dev_priv, plane, pipe);5159515751605158 ret = intel_pipe_set_base(crtc, x, y, old_fb);51615159···56035605 intel_clock_t clock;5604560656055607 if ((dpll & DISPLAY_RATE_SELECT_FPA1) == 0)56065606- fp = FP0(pipe);56085608+ fp = I915_READ(FP0(pipe));56075609 else56085608- fp = FP1(pipe);56105610+ fp = I915_READ(FP1(pipe));5609561156105612 clock.m1 = (fp & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT;56115613 if (IS_PINEVIEW(dev)) {···65776579 return ERR_PTR(-ENOENT);6578658065796581 intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL);65806580- if (!intel_fb)65826582+ if (!intel_fb) {65836583+ drm_gem_object_unreference_unlocked(&obj->base);65816584 return ERR_PTR(-ENOMEM);65856585+ }6582658665836587 ret = intel_framebuffer_init(dev, intel_fb, mode_cmd, obj);65846588 if (ret) {
+15-2
drivers/gpu/drm/i915/intel_dp.c
···1470147014711471 if (!HAS_PCH_CPT(dev) &&14721472 I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) {14731473- struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.base.crtc);14731473+ struct drm_crtc *crtc = intel_dp->base.base.crtc;14741474+14741475 /* Hardware workaround: leaving our transcoder select14751476 * set to transcoder B while it's off will prevent the14761477 * corresponding HDMI output on transcoder A.···14861485 /* Changes to enable or select take place the vblank14871486 * after being written.14881487 */14891489- intel_wait_for_vblank(dev, intel_crtc->pipe);14881488+ if (crtc == NULL) {14891489+ /* We can arrive here never having been attached14901490+ * to a CRTC, for instance, due to inheriting14911491+ * random state from the BIOS.14921492+ *14931493+ * If the pipe is not running, play safe and14941494+ * wait for the clocks to stabilise before14951495+ * continuing.14961496+ */14971497+ POSTING_READ(intel_dp->output_reg);14981498+ msleep(50);14991499+ } else15001500+ intel_wait_for_vblank(dev, to_intel_crtc(crtc)->pipe);14901501 }1491150214921503 I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN);
···264264 drm_i915_private_t *dev_priv = dev->dev_private;265265 drm_fb_helper_hotplug_event(&dev_priv->fbdev->helper);266266}267267+268268+void intel_fb_restore_mode(struct drm_device *dev)269269+{270270+ int ret;271271+ drm_i915_private_t *dev_priv = dev->dev_private;272272+273273+ ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper);274274+ if (ret)275275+ DRM_DEBUG("failed to restore crtc mode\n");276276+}
+3
drivers/gpu/drm/i915/intel_lvds.c
···539539 struct drm_device *dev = dev_priv->dev;540540 struct drm_connector *connector = dev_priv->int_lvds_connector;541541542542+ if (dev->switch_power_state != DRM_SWITCH_POWER_ON)543543+ return NOTIFY_OK;544544+542545 /*543546 * check and update the status of LVDS connector after receiving544547 * the LID nofication event.
···431431 }432432 }433433434434- /* Acer laptop (Acer TravelMate 5730G) has an HDMI port434434+ /* Acer laptop (Acer TravelMate 5730/5730G) has an HDMI port435435 * on the laptop and a DVI port on the docking station and436436 * both share the same encoder, hpd pin, and ddc line.437437 * So while the bios table is technically correct,···440440 * with different crtcs which isn't possible on the hardware441441 * side and leaves no crtcs for LVDS or VGA.442442 */443443- if ((dev->pdev->device == 0x95c4) &&443443+ if (((dev->pdev->device == 0x95c4) || (dev->pdev->device == 0x9591)) &&444444 (dev->pdev->subsystem_vendor == 0x1025) &&445445 (dev->pdev->subsystem_device == 0x013c)) {446446 if ((*connector_type == DRM_MODE_CONNECTOR_DVII) &&···15991599 memcpy((u8 *)edid, (u8 *)&fake_edid_record->ucFakeEDIDString[0],16001600 fake_edid_record->ucFakeEDIDLength);1601160116021602- if (drm_edid_is_valid(edid))16021602+ if (drm_edid_is_valid(edid)) {16031603 rdev->mode_info.bios_hardcoded_edid = edid;16041604- else16041604+ rdev->mode_info.bios_hardcoded_edid_size = edid_size;16051605+ } else16051606 kfree(edid);16061607 }16071608 }
+27-2
drivers/gpu/drm/radeon/radeon_atpx_handler.c
···1515#define ATPX_VERSION 01616#define ATPX_GPU_PWR 21717#define ATPX_MUX_SELECT 31818+#define ATPX_I2C_MUX_SELECT 41919+#define ATPX_SWITCH_START 52020+#define ATPX_SWITCH_END 618211922#define ATPX_INTEGRATED 02023#define ATPX_DISCRETE 1···152149 return radeon_atpx_execute(handle, ATPX_MUX_SELECT, mux_id);153150}154151152152+static int radeon_atpx_switch_i2c_mux(acpi_handle handle, int mux_id)153153+{154154+ return radeon_atpx_execute(handle, ATPX_I2C_MUX_SELECT, mux_id);155155+}156156+157157+static int radeon_atpx_switch_start(acpi_handle handle, int gpu_id)158158+{159159+ return radeon_atpx_execute(handle, ATPX_SWITCH_START, gpu_id);160160+}161161+162162+static int radeon_atpx_switch_end(acpi_handle handle, int gpu_id)163163+{164164+ return radeon_atpx_execute(handle, ATPX_SWITCH_END, gpu_id);165165+}155166156167static int radeon_atpx_switchto(enum vga_switcheroo_client_id id)157168{169169+ int gpu_id;170170+158171 if (id == VGA_SWITCHEROO_IGD)159159- radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, 0);172172+ gpu_id = ATPX_INTEGRATED;160173 else161161- radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, 1);174174+ gpu_id = ATPX_DISCRETE;175175+176176+ radeon_atpx_switch_start(radeon_atpx_priv.atpx_handle, gpu_id);177177+ radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, gpu_id);178178+ radeon_atpx_switch_i2c_mux(radeon_atpx_priv.atpx_handle, gpu_id);179179+ radeon_atpx_switch_end(radeon_atpx_priv.atpx_handle, gpu_id);180180+162181 return 0;163182}164183
+3-3
drivers/gpu/drm/radeon/radeon_cursor.c
···167167 return -EINVAL;168168 }169169170170- radeon_crtc->cursor_width = width;171171- radeon_crtc->cursor_height = height;172172-173170 obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);174171 if (!obj) {175172 DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, radeon_crtc->crtc_id);···176179 ret = radeon_gem_object_pin(obj, RADEON_GEM_DOMAIN_VRAM, &gpu_addr);177180 if (ret)178181 goto fail;182182+183183+ radeon_crtc->cursor_width = width;184184+ radeon_crtc->cursor_height = height;179185180186 radeon_lock_cursor(crtc, true);181187 /* XXX only 27 bit offset for legacy cursor */
+16
drivers/gpu/drm/radeon/radeon_kms.c
···221221 return -EINVAL;222222 }223223 break;224224+ case RADEON_INFO_NUM_TILE_PIPES:225225+ if (rdev->family >= CHIP_CAYMAN)226226+ value = rdev->config.cayman.max_tile_pipes;227227+ else if (rdev->family >= CHIP_CEDAR)228228+ value = rdev->config.evergreen.max_tile_pipes;229229+ else if (rdev->family >= CHIP_RV770)230230+ value = rdev->config.rv770.max_tile_pipes;231231+ else if (rdev->family >= CHIP_R600)232232+ value = rdev->config.r600.max_tile_pipes;233233+ else {234234+ return -EINVAL;235235+ }236236+ break;237237+ case RADEON_INFO_FUSION_GART_WORKING:238238+ value = 1;239239+ break;224240 default:225241 DRM_DEBUG_KMS("Invalid request %d\n", info->request);226242 return -EINVAL;
···110110 help111111 If you say yes here you get support for Analog Devices ADM1021112112 and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A,113113- Genesys Logic GL523SM, National Semiconductor LM84, TI THMC10,114114- and the XEON processor built-in sensor.113113+ Genesys Logic GL523SM, National Semiconductor LM84 and TI THMC10.115114116115 This driver can also be built as a module. If so, the module117116 will be called adm1021.···617618 depends on I2C618619 help619620 If you say yes here you get support for National Semiconductor LM90,620620- LM86, LM89 and LM99, Analog Devices ADM1032 and ADT7461, Maxim621621- MAX6646, MAX6647, MAX6648, MAX6649, MAX6657, MAX6658, MAX6659,622622- MAX6680, MAX6681, MAX6692, MAX6695, MAX6696, and Winbond/Nuvoton623623- W83L771W/G/AWG/ASG sensor chips.621621+ LM86, LM89 and LM99, Analog Devices ADM1032, ADT7461, and ADT7461A,622622+ Maxim MAX6646, MAX6647, MAX6648, MAX6649, MAX6657, MAX6658, MAX6659,623623+ MAX6680, MAX6681, MAX6692, MAX6695, MAX6696, ON Semiconductor NCT1008,624624+ and Winbond/Nuvoton W83L771W/G/AWG/ASG sensor chips.624625625626 This driver can also be built as a module. If so, the module626627 will be called lm90.
+4-2
drivers/hwmon/lm85.c
···10941094 &sensor_dev_attr_pwm1_auto_pwm_minctl.dev_attr.attr,10951095 &sensor_dev_attr_pwm2_auto_pwm_minctl.dev_attr.attr,10961096 &sensor_dev_attr_pwm3_auto_pwm_minctl.dev_attr.attr,10971097+ NULL10971098};1098109910991100static const struct attribute_group lm85_group_minctl = {···11051104 &sensor_dev_attr_temp1_auto_temp_off.dev_attr.attr,11061105 &sensor_dev_attr_temp2_auto_temp_off.dev_attr.attr,11071106 &sensor_dev_attr_temp3_auto_temp_off.dev_attr.attr,11071107+ NULL11081108};1109110911101110static const struct attribute_group lm85_group_temp_off = {···13311329 if (data->type != emc6d103s) {13321330 err = sysfs_create_group(&client->dev.kobj, &lm85_group_minctl);13331331 if (err)13341334- goto err_kfree;13321332+ goto err_remove_files;13351333 err = sysfs_create_group(&client->dev.kobj,13361334 &lm85_group_temp_off);13371335 if (err)13381338- goto err_kfree;13361336+ goto err_remove_files;13391337 }1340133813411339 /* The ADT7463/68 have an optional VRM 10 mode where pin 21 is used
+15-7
drivers/hwmon/lm90.c
···4949 * chips, but support three temperature sensors instead of two. MAX66955050 * and MAX6696 only differ in the pinout so they can be treated identically.5151 *5252- * This driver also supports the ADT7461 chip from Analog Devices.5353- * It's supported in both compatibility and extended mode. It is mostly5454- * compatible with LM90 except for a data format difference for the5555- * temperature value registers.5252+ * This driver also supports ADT7461 and ADT7461A from Analog Devices as well as5353+ * NCT1008 from ON Semiconductor. The chips are supported in both compatibility5454+ * and extended mode. They are mostly compatible with LM90 except for a data5555+ * format difference for the temperature value registers.5656 *5757 * Since the LM90 was the first chipset supported by this driver, most5858 * comments will refer to this chipset, but are actually general and···8888 * Addresses to scan8989 * Address is fully defined internally and cannot be changed except for9090 * MAX6659, MAX6680 and MAX6681.9191- * LM86, LM89, LM90, LM99, ADM1032, ADM1032-1, ADT7461, MAX6649, MAX6657,9292- * MAX6658 and W83L771 have address 0x4c.9393- * ADM1032-2, ADT7461-2, LM89-1, LM99-1 and MAX6646 have address 0x4d.9191+ * LM86, LM89, LM90, LM99, ADM1032, ADM1032-1, ADT7461, ADT7461A, MAX6649,9292+ * MAX6657, MAX6658, NCT1008 and W83L771 have address 0x4c.9393+ * ADM1032-2, ADT7461-2, ADT7461A-2, LM89-1, LM99-1, MAX6646, and NCT1008D9494+ * have address 0x4d.9495 * MAX6647 has address 0x4e.9596 * MAX6659 can have address 0x4c, 0x4d or 0x4e.9697 * MAX6680 and MAX6681 can have address 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b,···175174static const struct i2c_device_id lm90_id[] = {176175 { "adm1032", adm1032 },177176 { "adt7461", adt7461 },177177+ { "adt7461a", adt7461 },178178 { "lm90", lm90 },179179 { "lm86", lm86 },180180 { "lm89", lm86 },···190188 { "max6681", max6680 },191189 { "max6695", max6696 },192190 { "max6696", max6696 },191191+ { "nct1008", adt7461 },193192 { "w83l771", w83l771 },194193 { }195194};···11561153 && (reg_config1 & 0x1B) == 0x0011571154 && reg_convrate <= 0x0A) {11581155 name = "adt7461";11561156+ } else11571157+ if (chip_id == 0x57 /* ADT7461A, NCT1008 */11581158+ && (reg_config1 & 0x1B) == 0x0011591159+ && reg_convrate <= 0x0A) {11601160+ name = "adt7461a";11591161 }11601162 } else11611163 if (man_id == 0x4D) { /* Maxim */
+1-2
drivers/hwmon/twl4030-madc-hwmon.c
···9898static int __devinit twl4030_madc_hwmon_probe(struct platform_device *pdev)9999{100100 int ret;101101- int status;102101 struct device *hwmon;103102104103 ret = sysfs_create_group(&pdev->dev.kobj, &twl4030_madc_group);···106107 hwmon = hwmon_device_register(&pdev->dev);107108 if (IS_ERR(hwmon)) {108109 dev_err(&pdev->dev, "hwmon_device_register failed.\n");109109- status = PTR_ERR(hwmon);110110+ ret = PTR_ERR(hwmon);110111 goto err_reg;111112 }112113
+5
drivers/i2c/busses/i2c-i801.c
···134134 SMBHSTSTS_BUS_ERR | SMBHSTSTS_DEV_ERR | \135135 SMBHSTSTS_INTR)136136137137+/* Older devices have their ID defined in <linux/pci_ids.h> */138138+#define PCI_DEVICE_ID_INTEL_COUGARPOINT_SMBUS 0x1c22139139+#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22137140/* Patsburg also has three 'Integrated Device Function' SMBus controllers */138141#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF0 0x1d70139142#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF1 0x1d71140143#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF2 0x1d72144144+#define PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS 0x2330145145+#define PCI_DEVICE_ID_INTEL_5_3400_SERIES_SMBUS 0x3b30141146142147struct i801_priv {143148 struct i2c_adapter adapter;
+14-13
drivers/i2c/busses/i2c-parport.c
···11/* ------------------------------------------------------------------------ *22 * i2c-parport.c I2C bus over parallel port *33 * ------------------------------------------------------------------------ *44- Copyright (C) 2003-2010 Jean Delvare <khali@linux-fr.org>44+ Copyright (C) 2003-2011 Jean Delvare <khali@linux-fr.org>5566 Based on older i2c-philips-par.c driver77 Copyright (C) 1995-2000 Simon G. Vogl···3333#include <linux/i2c-algo-bit.h>3434#include <linux/i2c-smbus.h>3535#include <linux/slab.h>3636+#include <linux/list.h>3737+#include <linux/mutex.h>3638#include "i2c-parport.h"37393840/* ----- Device list ------------------------------------------------------ */···4543 struct i2c_algo_bit_data algo_data;4644 struct i2c_smbus_alert_setup alert_data;4745 struct i2c_client *ara;4848- struct i2c_par *next;4646+ struct list_head node;4947};50485151-static struct i2c_par *adapter_list;4949+static LIST_HEAD(adapter_list);5050+static DEFINE_MUTEX(adapter_list_lock);52515352/* ----- Low-level parallel port access ----------------------------------- */5453···231228 }232229233230 /* Add the new adapter to the list */234234- adapter->next = adapter_list;235235- adapter_list = adapter;231231+ mutex_lock(&adapter_list_lock);232232+ list_add_tail(&adapter->node, &adapter_list);233233+ mutex_unlock(&adapter_list_lock);236234 return;237235238236ERROR1:···245241246242static void i2c_parport_detach (struct parport *port)247243{248248- struct i2c_par *adapter, *prev;244244+ struct i2c_par *adapter, *_n;249245250246 /* Walk the list */251251- for (prev = NULL, adapter = adapter_list; adapter;252252- prev = adapter, adapter = adapter->next) {247247+ mutex_lock(&adapter_list_lock);248248+ list_for_each_entry_safe(adapter, _n, &adapter_list, node) {253249 if (adapter->pdev->port == port) {254250 if (adapter->ara) {255251 parport_disable_irq(port);···263259264260 parport_release(adapter->pdev);265261 parport_unregister_device(adapter->pdev);266266- if (prev)267267- prev->next = adapter->next;268268- else269269- adapter_list = adapter->next;262262+ list_del(&adapter->node);270263 kfree(adapter);271271- return;272264 }273265 }266266+ mutex_unlock(&adapter_list_lock);274267}275268276269static struct parport_driver i2c_parport_driver = {
+1-1
drivers/infiniband/hw/qib/qib_iba6120.c
···17991799 /*18001800 * Keep chip from being accessed until we are ready. Use18011801 * writeq() directly, to allow the write even though QIB_PRESENT18021802- * isn't' set.18021802+ * isn't set.18031803 */18041804 dd->flags &= ~(QIB_INITTED | QIB_PRESENT);18051805 dd->int_counter = 0; /* so we check interrupts work again */
+1-1
drivers/infiniband/hw/qib/qib_iba7220.c
···21112111 /*21122112 * Keep chip from being accessed until we are ready. Use21132113 * writeq() directly, to allow the write even though QIB_PRESENT21142114- * isn't' set.21142114+ * isn't set.21152115 */21162116 dd->flags &= ~(QIB_INITTED | QIB_PRESENT);21172117 dd->int_counter = 0; /* so we check interrupts work again */
+1-1
drivers/infiniband/hw/qib/qib_iba7322.c
···32993299 /*33003300 * Keep chip from being accessed until we are ready. Use33013301 * writeq() directly, to allow the write even though QIB_PRESENT33023302- * isn't' set.33023302+ * isn't set.33033303 */33043304 dd->flags &= ~(QIB_INITTED | QIB_PRESENT | QIB_BADINTR);33053305 dd->flags |= QIB_DOING_RESET;
+64-11
drivers/input/touchscreen/wm831x-ts.c
···6868 unsigned int pd_irq;6969 bool pressure;7070 bool pen_down;7171+ struct work_struct pd_data_work;7172};7373+7474+static void wm831x_pd_data_work(struct work_struct *work)7575+{7676+ struct wm831x_ts *wm831x_ts =7777+ container_of(work, struct wm831x_ts, pd_data_work);7878+7979+ if (wm831x_ts->pen_down) {8080+ enable_irq(wm831x_ts->data_irq);8181+ dev_dbg(wm831x_ts->wm831x->dev, "IRQ PD->DATA done\n");8282+ } else {8383+ enable_irq(wm831x_ts->pd_irq);8484+ dev_dbg(wm831x_ts->wm831x->dev, "IRQ DATA->PD done\n");8585+ }8686+}72877388static irqreturn_t wm831x_ts_data_irq(int irq, void *irq_data)7489{···125110 }126111127112 if (!wm831x_ts->pen_down) {113113+ /* Switch from data to pen down */114114+ dev_dbg(wm831x->dev, "IRQ DATA->PD\n");115115+128116 disable_irq_nosync(wm831x_ts->data_irq);129117130118 /* Don't need data any more */···146128 ABS_PRESSURE, 0);147129148130 input_report_key(wm831x_ts->input_dev, BTN_TOUCH, 0);131131+132132+ schedule_work(&wm831x_ts->pd_data_work);133133+ } else {134134+ input_report_key(wm831x_ts->input_dev, BTN_TOUCH, 1);149135 }150136151137 input_sync(wm831x_ts->input_dev);···163141 struct wm831x *wm831x = wm831x_ts->wm831x;164142 int ena = 0;165143144144+ if (wm831x_ts->pen_down)145145+ return IRQ_HANDLED;146146+147147+ disable_irq_nosync(wm831x_ts->pd_irq);148148+166149 /* Start collecting data */167150 if (wm831x_ts->pressure)168151 ena |= WM831X_TCH_Z_ENA;···176149 WM831X_TCH_X_ENA | WM831X_TCH_Y_ENA | WM831X_TCH_Z_ENA,177150 WM831X_TCH_X_ENA | WM831X_TCH_Y_ENA | ena);178151179179- input_report_key(wm831x_ts->input_dev, BTN_TOUCH, 1);180180- input_sync(wm831x_ts->input_dev);181181-182152 wm831x_set_bits(wm831x, WM831X_INTERRUPT_STATUS_1,183153 WM831X_TCHPD_EINT, WM831X_TCHPD_EINT);184154185155 wm831x_ts->pen_down = true;186186- enable_irq(wm831x_ts->data_irq);156156+157157+ /* Switch from pen down to data */158158+ dev_dbg(wm831x->dev, "IRQ PD->DATA\n");159159+ schedule_work(&wm831x_ts->pd_data_work);187160188161 return IRQ_HANDLED;189162}···209182 struct wm831x_ts *wm831x_ts = input_get_drvdata(idev);210183 struct wm831x *wm831x = wm831x_ts->wm831x;211184185185+ /* Shut the controller down, disabling all other functionality too */212186 wm831x_set_bits(wm831x, WM831X_TOUCH_CONTROL_1,213213- WM831X_TCH_ENA | WM831X_TCH_CVT_ENA |214214- WM831X_TCH_X_ENA | WM831X_TCH_Y_ENA |215215- WM831X_TCH_Z_ENA, 0);187187+ WM831X_TCH_ENA | WM831X_TCH_X_ENA |188188+ WM831X_TCH_Y_ENA | WM831X_TCH_Z_ENA, 0);216189217217- if (wm831x_ts->pen_down)190190+ /* Make sure any pending IRQs are done, the above will prevent191191+ * new ones firing.192192+ */193193+ synchronize_irq(wm831x_ts->data_irq);194194+ synchronize_irq(wm831x_ts->pd_irq);195195+196196+ /* Make sure the IRQ completion work is quiesced */197197+ flush_work_sync(&wm831x_ts->pd_data_work);198198+199199+ /* If we ended up with the pen down then make sure we revert back200200+ * to pen detection state for the next time we start up.201201+ */202202+ if (wm831x_ts->pen_down) {218203 disable_irq(wm831x_ts->data_irq);204204+ enable_irq(wm831x_ts->pd_irq);205205+ wm831x_ts->pen_down = false;206206+ }219207}220208221209static __devinit int wm831x_ts_probe(struct platform_device *pdev)···240198 struct wm831x_pdata *core_pdata = dev_get_platdata(pdev->dev.parent);241199 struct wm831x_touch_pdata *pdata = NULL;242200 struct input_dev *input_dev;243243- int error;201201+ int error, irqf;244202245203 if (core_pdata)246204 pdata = core_pdata->touch;···254212255213 wm831x_ts->wm831x = wm831x;256214 wm831x_ts->input_dev = input_dev;215215+ INIT_WORK(&wm831x_ts->pd_data_work, wm831x_pd_data_work);257216258217 /*259218 * If we have a direct IRQ use it, otherwise use the interrupt···313270 wm831x_set_bits(wm831x, WM831X_TOUCH_CONTROL_1,314271 WM831X_TCH_RATE_MASK, 6);315272273273+ if (pdata && pdata->data_irqf)274274+ irqf = pdata->data_irqf;275275+ else276276+ irqf = IRQF_TRIGGER_HIGH;277277+316278 error = request_threaded_irq(wm831x_ts->data_irq,317279 NULL, wm831x_ts_data_irq,318318- IRQF_ONESHOT,280280+ irqf | IRQF_ONESHOT,319281 "Touchscreen data", wm831x_ts);320282 if (error) {321283 dev_err(&pdev->dev, "Failed to request data IRQ %d: %d\n",···329281 }330282 disable_irq(wm831x_ts->data_irq);331283284284+ if (pdata && pdata->pd_irqf)285285+ irqf = pdata->pd_irqf;286286+ else287287+ irqf = IRQF_TRIGGER_HIGH;288288+332289 error = request_threaded_irq(wm831x_ts->pd_irq,333290 NULL, wm831x_ts_pen_down_irq,334334- IRQF_ONESHOT,291291+ irqf | IRQF_ONESHOT,335292 "Touchscreen pen down", wm831x_ts);336293 if (error) {337294 dev_err(&pdev->dev, "Failed to request pen down IRQ %d: %d\n",
···3838 DEBSTATUS);39394040#define DRIVER_VERSION "0.1"4141-#define DRIVER_NAME "Technisat/B2C2 FlexCop II/IIb/III Digital TV PCI Driver"4141+#define DRIVER_NAME "flexcop-pci"4242#define DRIVER_AUTHOR "Patrick Boettcher <patrick.boettcher@desy.de>"43434444struct flexcop_pci {
+4-2
drivers/media/dvb/dvb-usb/Kconfig
···356356 select DVB_TDA826X if !DVB_FE_CUSTOMISE357357 select DVB_STV0288 if !DVB_FE_CUSTOMISE358358 select DVB_IX2505V if !DVB_FE_CUSTOMISE359359+ select DVB_STV0299 if !DVB_FE_CUSTOMISE360360+ select DVB_PLL if !DVB_FE_CUSTOMISE359361 help360362 Say Y here to support the LME DM04/QQBOX DVB-S USB2.0 .361363362364config DVB_USB_TECHNISAT_USB2363365 tristate "Technisat DVB-S/S2 USB2.0 support"364366 depends on DVB_USB365365- select DVB_STB0899 if !DVB_FE_CUSTOMISE366366- select DVB_STB6100 if !DVB_FE_CUSTOMISE367367+ select DVB_STV090x if !DVB_FE_CUSTOMISE368368+ select DVB_STV6110x if !DVB_FE_CUSTOMISE367369 help368370 Say Y here to support the Technisat USB2 DVB-S/S2 device
···378378379379static int __media_entity_setup_link_notify(struct media_link *link, u32 flags)380380{381381- const u32 mask = MEDIA_LNK_FL_ENABLED;382381 int ret;383382384383 /* Notify both entities. */···394395 return ret;395396 }396397397397- link->flags = (link->flags & ~mask) | (flags & mask);398398+ link->flags = flags;398399 link->reverse->flags = link->flags;399400400401 return 0;···416417 */417418int __media_entity_setup_link(struct media_link *link, u32 flags)418419{420420+ const u32 mask = MEDIA_LNK_FL_ENABLED;419421 struct media_device *mdev;420422 struct media_entity *source, *sink;421423 int ret = -EBUSY;422424423425 if (link == NULL)426426+ return -EINVAL;427427+428428+ /* The non-modifiable link flags must not be modified. */429429+ if ((link->flags & ~mask) != (flags & ~mask))424430 return -EINVAL;425431426432 if (link->flags & MEDIA_LNK_FL_IMMUTABLE)
+1-1
drivers/media/radio/radio-sf16fmr2.c
···170170 return 0;171171}172172173173-/* !!! not tested, in my card this does't work !!! */173173+/* !!! not tested, in my card this doesn't work !!! */174174static int fmr2_setvolume(struct fmr2 *dev)175175{176176 int vol[16] = { 0x021, 0x084, 0x090, 0x104,
+1-1
drivers/media/radio/saa7706h.c
···376376 v4l_info(client, "chip found @ 0x%02x (%s)\n",377377 client->addr << 1, client->adapter->name);378378379379- state = kmalloc(sizeof(struct saa7706h_state), GFP_KERNEL);379379+ state = kzalloc(sizeof(struct saa7706h_state), GFP_KERNEL);380380 if (state == NULL)381381 return -ENOMEM;382382 sd = &state->sd;
+1-1
drivers/media/radio/tef6862.c
···176176 v4l_info(client, "chip found @ 0x%02x (%s)\n",177177 client->addr << 1, client->adapter->name);178178179179- state = kmalloc(sizeof(struct tef6862_state), GFP_KERNEL);179179+ state = kzalloc(sizeof(struct tef6862_state), GFP_KERNEL);180180 if (state == NULL)181181 return -ENOMEM;182182 state->freq = TEF6862_LO_FREQ;
+27-4
drivers/media/rc/imon.c
···4646#define MOD_AUTHOR "Jarod Wilson <jarod@wilsonet.com>"4747#define MOD_DESC "Driver for SoundGraph iMON MultiMedia IR/Display"4848#define MOD_NAME "imon"4949-#define MOD_VERSION "0.9.2"4949+#define MOD_VERSION "0.9.3"50505151#define DISPLAY_MINOR_BASE 1445252#define DEVICE_NAME "lcd%d"···460460}461461462462/**463463- * Sends a packet to the device -- this function must be called464464- * with ictx->lock held.463463+ * Sends a packet to the device -- this function must be called with464464+ * ictx->lock held, or its unlock/lock sequence while waiting for tx465465+ * to complete can/will lead to a deadlock.465466 */466467static int send_packet(struct imon_context *ictx)467468{···992991 * the iMON remotes, and those used by the Windows MCE remotes (which is993992 * really just RC-6), but only one or the other at a time, as the signals994993 * are decoded onboard the receiver.994994+ *995995+ * This function gets called two different ways, one way is from996996+ * rc_register_device, for initial protocol selection/setup, and the other is997997+ * via a userspace-initiated protocol change request, either by direct sysfs998998+ * prodding or by something like ir-keytable. In the rc_register_device case,999999+ * the imon context lock is already held, but when initiated from userspace,10001000+ * it is not, so we must acquire it prior to calling send_packet, which10011001+ * requires that the lock is held.9951002 */9961003static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type)9971004{9981005 int retval;9991006 struct imon_context *ictx = rc->priv;10001007 struct device *dev = ictx->dev;10081008+ bool unlock = false;10011009 unsigned char ir_proto_packet[] = {10021010 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 };10031011···1039102910401030 memcpy(ictx->usb_tx_buf, &ir_proto_packet, sizeof(ir_proto_packet));1041103110321032+ if (!mutex_is_locked(&ictx->lock)) {10331033+ unlock = true;10341034+ mutex_lock(&ictx->lock);10351035+ }10361036+10421037 retval = send_packet(ictx);10431038 if (retval)10441039 goto out;···10521037 ictx->pad_mouse = false;1053103810541039out:10401040+ if (unlock)10411041+ mutex_unlock(&ictx->lock);10421042+10551043 return retval;10561044}10571045···21522134 goto rdev_setup_failed;21532135 }2154213621372137+ mutex_unlock(&ictx->lock);21552138 return ictx;2156213921572140rdev_setup_failed:···22242205 goto urb_submit_failed;22252206 }2226220722082208+ mutex_unlock(&ictx->lock);22272209 return ictx;2228221022292211urb_submit_failed:···23192299 usb_set_intfdata(interface, ictx);2320230023212301 if (ifnum == 0) {23022302+ mutex_lock(&ictx->lock);23032303+23222304 if (product == 0xffdc && ictx->rf_device) {23232305 sysfs_err = sysfs_create_group(&interface->dev.kobj,23242306 &imon_rf_attr_group);···2331230923322310 if (ictx->display_supported)23332311 imon_init_display(ictx, interface);23122312+23132313+ mutex_unlock(&ictx->lock);23342314 }2335231523362316 dev_info(dev, "iMON device (%04x:%04x, intf%d) on "23372317 "usb<%d:%d> initialized\n", vendor, product, ifnum,23382318 usbdev->bus->busnum, usbdev->devnum);2339231923402340- mutex_unlock(&ictx->lock);23412320 mutex_unlock(&driver_lock);2342232123432322 return 0;
···875875config VIDEO_MX3876876 tristate "i.MX3x Camera Sensor Interface driver"877877 depends on VIDEO_DEV && MX3_IPU && SOC_CAMERA878878- select VIDEOBUF_DMA_CONTIG878878+ select VIDEOBUF2_DMA_CONTIG879879 select MX3_VIDEO880880 ---help---881881 This is a v4l2 driver for the i.MX3x Camera Sensor Interface
+9-1
drivers/media/video/cx18/cx18-streams.c
···350350351351 /* No struct video_device, but can have buffers allocated */352352 if (type == CX18_ENC_STREAM_TYPE_IDX) {353353+ /* If the module params didn't inhibit IDX ... */353354 if (cx->stream_buffers[type] != 0) {354355 cx->stream_buffers[type] = 0;355355- cx18_stream_free(&cx->streams[type]);356356+ /*357357+ * Before calling cx18_stream_free(),358358+ * check if the IDX stream was actually set up.359359+ * Needed, since the cx18_probe() error path360360+ * exits through here as well as normal clean up361361+ */362362+ if (cx->streams[type].buffers != 0)363363+ cx18_stream_free(&cx->streams[type]);356364 }357365 continue;358366 }
+1
drivers/media/video/cx23885/Kconfig
···2222 select DVB_CX24116 if !DVB_FE_CUSTOMISE2323 select DVB_STV0900 if !DVB_FE_CUSTOMISE2424 select DVB_DS3000 if !DVB_FE_CUSTOMISE2525+ select DVB_STV0367 if !DVB_FE_CUSTOMISE2526 select MEDIA_TUNER_MT2131 if !MEDIA_TUNER_CUSTOMISE2627 select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMISE2728 select MEDIA_TUNER_TDA8290 if !MEDIA_TUNER_CUSTOMISE
+1-1
drivers/media/video/imx074.c
···298298static int imx074_set_bus_param(struct soc_camera_device *icd,299299 unsigned long flags)300300{301301- return -1;301301+ return -EINVAL;302302}303303304304static struct soc_camera_ops imx074_ops = {
+1-1
drivers/media/video/m52790.c
···174174 v4l_info(client, "chip found @ 0x%x (%s)\n",175175 client->addr << 1, client->adapter->name);176176177177- state = kmalloc(sizeof(struct m52790_state), GFP_KERNEL);177177+ state = kzalloc(sizeof(struct m52790_state), GFP_KERNEL);178178 if (state == NULL)179179 return -ENOMEM;180180
+25-9
drivers/media/video/omap3isp/isp.c
···215215 }216216217217 switch (xclksel) {218218- case 0:218218+ case ISP_XCLK_A:219219 isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL,220220 ISPTCTRL_CTRL_DIVA_MASK,221221 divisor << ISPTCTRL_CTRL_DIVA_SHIFT);222222 dev_dbg(isp->dev, "isp_set_xclk(): cam_xclka set to %d Hz\n",223223 currentxclk);224224 break;225225- case 1:225225+ case ISP_XCLK_B:226226 isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL,227227 ISPTCTRL_CTRL_DIVB_MASK,228228 divisor << ISPTCTRL_CTRL_DIVB_SHIFT);229229 dev_dbg(isp->dev, "isp_set_xclk(): cam_xclkb set to %d Hz\n",230230 currentxclk);231231 break;232232+ case ISP_XCLK_NONE:232233 default:233234 omap3isp_put(isp);234235 dev_dbg(isp->dev, "ISP_ERR: isp_set_xclk(): Invalid requested "···238237 }239238240239 /* Do we go from stable whatever to clock? */241241- if (divisor >= 2 && isp->xclk_divisor[xclksel] < 2)240240+ if (divisor >= 2 && isp->xclk_divisor[xclksel - 1] < 2)242241 omap3isp_get(isp);243242 /* Stopping the clock. */244244- else if (divisor < 2 && isp->xclk_divisor[xclksel] >= 2)243243+ else if (divisor < 2 && isp->xclk_divisor[xclksel - 1] >= 2)245244 omap3isp_put(isp);246245247247- isp->xclk_divisor[xclksel] = divisor;246246+ isp->xclk_divisor[xclksel - 1] = divisor;248247249248 omap3isp_put(isp);250249···286285 */287286void omap3isp_configure_bridge(struct isp_device *isp,288287 enum ccdc_input_entity input,289289- const struct isp_parallel_platform_data *pdata)288288+ const struct isp_parallel_platform_data *pdata,289289+ unsigned int shift)290290{291291 u32 ispctrl_val;292292···300298 switch (input) {301299 case CCDC_INPUT_PARALLEL:302300 ispctrl_val |= ISPCTRL_PAR_SER_CLK_SEL_PARALLEL;303303- ispctrl_val |= pdata->data_lane_shift << ISPCTRL_SHIFT_SHIFT;304301 ispctrl_val |= pdata->clk_pol << ISPCTRL_PAR_CLK_POL_SHIFT;305302 ispctrl_val |= pdata->bridge << ISPCTRL_PAR_BRIDGE_SHIFT;303303+ shift += pdata->data_lane_shift * 2;306304 break;307305308306 case CCDC_INPUT_CSI2A:···320318 default:321319 return;322320 }321321+322322+ ispctrl_val |= ((shift/2) << ISPCTRL_SHIFT_SHIFT) & ISPCTRL_SHIFT_MASK;323323324324 ispctrl_val &= ~ISPCTRL_SYNC_DETECT_MASK;325325 ispctrl_val |= ISPCTRL_SYNC_DETECT_VSRISE;···662658663659 /* Apply power change to connected non-nodes. */664660 ret = isp_pipeline_pm_power(entity, change);661661+ if (ret < 0)662662+ entity->use_count -= change;665663666664 mutex_unlock(&entity->parent->graph_mutex);667665···878872 }879873 }880874875875+ if (failure < 0)876876+ isp->needs_reset = true;877877+881878 return failure;882879}883880···893884 * single-shot or continuous mode.894885 *895886 * Return 0 if successful, or the return value of the failed video::s_stream896896- * operation otherwise.887887+ * operation otherwise. The pipeline state is not updated when the operation888888+ * fails, except when stopping the pipeline.897889 */898890int omap3isp_pipeline_set_stream(struct isp_pipeline *pipe,899891 enum isp_pipeline_stream_state state)···905895 ret = isp_pipeline_disable(pipe);906896 else907897 ret = isp_pipeline_enable(pipe, state);908908- pipe->stream_state = state;898898+899899+ if (ret == 0 || state == ISP_PIPELINE_STREAM_STOPPED)900900+ pipe->stream_state = state;909901910902 return ret;911903}···14931481 if (--isp->ref_count == 0) {14941482 isp_disable_interrupts(isp);14951483 isp_save_ctx(isp);14841484+ if (isp->needs_reset) {14851485+ isp_reset(isp);14861486+ isp->needs_reset = false;14871487+ }14961488 isp_disable_clocks(isp);14971489 }14981490 mutex_unlock(&isp->isp_mutex);
+6-6
drivers/media/video/omap3isp/isp.h
···132132133133/**134134 * struct isp_parallel_platform_data - Parallel interface platform data135135- * @width: Parallel bus width in bits (8, 10, 11 or 12)136135 * @data_lane_shift: Data lane shifter137136 * 0 - CAMEXT[13:0] -> CAM[13:0]138137 * 1 - CAMEXT[13:2] -> CAM[11:0]···145146 * ISPCTRL_PAR_BRIDGE_BENDIAN - Big endian146147 */147148struct isp_parallel_platform_data {148148- unsigned int width;149149 unsigned int data_lane_shift:2;150150 unsigned int clk_pol:1;151151 unsigned int bridge:4;···260262 /* ISP Obj */261263 spinlock_t stat_lock; /* common lock for statistic drivers */262264 struct mutex isp_mutex; /* For handling ref_count field */265265+ bool needs_reset;263266 int has_context;264267 int ref_count;265268 unsigned int autoidle;···310311 enum isp_pipeline_stream_state state);311312void omap3isp_configure_bridge(struct isp_device *isp,312313 enum ccdc_input_entity input,313313- const struct isp_parallel_platform_data *pdata);314314+ const struct isp_parallel_platform_data *pdata,315315+ unsigned int shift);314316315315-#define ISP_XCLK_NONE -1316316-#define ISP_XCLK_A 0317317-#define ISP_XCLK_B 1317317+#define ISP_XCLK_NONE 0318318+#define ISP_XCLK_A 1319319+#define ISP_XCLK_B 2318320319321struct isp_device *omap3isp_get(struct isp_device *isp);320322void omap3isp_put(struct isp_device *isp);
+30-7
drivers/media/video/omap3isp/ispccdc.c
···43434444static const unsigned int ccdc_fmts[] = {4545 V4L2_MBUS_FMT_Y8_1X8,4646+ V4L2_MBUS_FMT_Y10_1X10,4747+ V4L2_MBUS_FMT_Y12_1X12,4848+ V4L2_MBUS_FMT_SGRBG8_1X8,4949+ V4L2_MBUS_FMT_SRGGB8_1X8,5050+ V4L2_MBUS_FMT_SBGGR8_1X8,5151+ V4L2_MBUS_FMT_SGBRG8_1X8,4652 V4L2_MBUS_FMT_SGRBG10_1X10,4753 V4L2_MBUS_FMT_SRGGB10_1X10,4854 V4L2_MBUS_FMT_SBGGR10_1X10,···11161110 struct isp_parallel_platform_data *pdata = NULL;11171111 struct v4l2_subdev *sensor;11181112 struct v4l2_mbus_framefmt *format;11131113+ const struct isp_format_info *fmt_info;11141114+ struct v4l2_subdev_format fmt_src;11151115+ unsigned int depth_out;11161116+ unsigned int depth_in = 0;11191117 struct media_pad *pad;11201118 unsigned long flags;11191119+ unsigned int shift;11211120 u32 syn_mode;11221121 u32 ccdc_pattern;1123112211241124- if (ccdc->input == CCDC_INPUT_PARALLEL) {11251125- pad = media_entity_remote_source(&ccdc->pads[CCDC_PAD_SINK]);11261126- sensor = media_entity_to_v4l2_subdev(pad->entity);11231123+ pad = media_entity_remote_source(&ccdc->pads[CCDC_PAD_SINK]);11241124+ sensor = media_entity_to_v4l2_subdev(pad->entity);11251125+ if (ccdc->input == CCDC_INPUT_PARALLEL)11271126 pdata = &((struct isp_v4l2_subdevs_group *)sensor->host_priv)11281127 ->bus.parallel;11281128+11291129+ /* Compute shift value for lane shifter to configure the bridge. */11301130+ fmt_src.pad = pad->index;11311131+ fmt_src.which = V4L2_SUBDEV_FORMAT_ACTIVE;11321132+ if (!v4l2_subdev_call(sensor, pad, get_fmt, NULL, &fmt_src)) {11331133+ fmt_info = omap3isp_video_format_info(fmt_src.format.code);11341134+ depth_in = fmt_info->bpp;11291135 }1130113611311131- omap3isp_configure_bridge(isp, ccdc->input, pdata);11371137+ fmt_info = omap3isp_video_format_info11381138+ (isp->isp_ccdc.formats[CCDC_PAD_SINK].code);11391139+ depth_out = fmt_info->bpp;1132114011331133- ccdc->syncif.datsz = pdata ? pdata->width : 10;11411141+ shift = depth_in - depth_out;11421142+ omap3isp_configure_bridge(isp, ccdc->input, pdata, shift);11431143+11441144+ ccdc->syncif.datsz = depth_out;11341145 ccdc_config_sync_if(ccdc, &ccdc->syncif);1135114611361147 /* CCDC_PAD_SINK */···13611338 * @ccdc: Pointer to ISP CCDC device.13621339 * @event: Pointing which event trigger handler13631340 *13641364- * Return 1 when the event and stopping request combination is satisfyied,13411341+ * Return 1 when the event and stopping request combination is satisfied,13651342 * zero otherwise.13661343 */13671344static int __ccdc_handle_stopping(struct isp_ccdc_device *ccdc, u32 event)···1641161816421619 ccdc_set_outaddr(ccdc, buffer->isp_addr);1643162016441644- /* We now have a buffer queued on the output, restart the pipeline in16211621+ /* We now have a buffer queued on the output, restart the pipeline16451622 * on the next CCDC interrupt if running in continuous mode (or when16461623 * starting the stream).16471624 */
+1-1
drivers/media/video/omap3isp/isppreview.c
···755755 * @configs - pointer to update config structure.756756 * @config - return pointer to appropriate structure field.757757 * @bit - for which feature to return pointers.758758- * Return size of coresponding prev_params member758758+ * Return size of corresponding prev_params member759759 */760760static u32761761__preview_get_ptrs(struct prev_params *params, void **param,
+3-3
drivers/media/video/omap3isp/ispqueue.c
···339339 up_read(¤t->mm->mmap_sem);340340341341 if (ret != buf->npages) {342342- buf->npages = ret;342342+ buf->npages = ret < 0 ? 0 : ret;343343 isp_video_buffer_cleanup(buf);344344 return -EFAULT;345345 }···408408 * isp_video_buffer_prepare_vm_flags - Get VMA flags for a userspace address409409 *410410 * This function locates the VMAs for the buffer's userspace address and checks411411- * that their flags match. The onlflag that we need to care for at the moment is412412- * VM_PFNMAP.411411+ * that their flags match. The only flag that we need to care for at the moment412412+ * is VM_PFNMAP.413413 *414414 * The buffer vm_flags field is set to the first VMA flags.415415 *
+60-15
drivers/media/video/omap3isp/ispresizer.c
···714714 * iw and ih are the input width and height after cropping. Those equations need715715 * to be satisfied exactly for the resizer to work correctly.716716 *717717- * Reverting the equations, we can compute the resizing ratios with717717+ * The equations can't be easily reverted, as the >> 8 operation is not linear.718718+ * In addition, not all input sizes can be achieved for a given output size. To719719+ * get the highest input size lower than or equal to the requested input size,720720+ * we need to compute the highest resizing ratio that satisfies the following721721+ * inequality (taking the 4-tap mode width equation as an example)722722+ *723723+ * iw >= (32 * sph + (ow - 1) * hrsz + 16) >> 8 - 7724724+ *725725+ * (where iw is the requested input width) which can be rewritten as726726+ *727727+ * iw - 7 >= (32 * sph + (ow - 1) * hrsz + 16) >> 8728728+ * (iw - 7) << 8 >= 32 * sph + (ow - 1) * hrsz + 16 - b729729+ * ((iw - 7) << 8) + b >= 32 * sph + (ow - 1) * hrsz + 16730730+ *731731+ * where b is the value of the 8 least significant bits of the right hand side732732+ * expression of the last inequality. The highest resizing ratio value will be733733+ * achieved when b is equal to its maximum value of 255. That resizing ratio734734+ * value will still satisfy the original inequality, as b will disappear when735735+ * the expression will be shifted right by 8.736736+ *737737+ * The reverted the equations thus become718738 *719739 * - 8-phase, 4-tap mode720720- * hrsz = ((iw - 7) * 256 - 16 - 32 * sph) / (ow - 1)721721- * vrsz = ((ih - 4) * 256 - 16 - 32 * spv) / (oh - 1)740740+ * hrsz = ((iw - 7) * 256 + 255 - 16 - 32 * sph) / (ow - 1)741741+ * vrsz = ((ih - 4) * 256 + 255 - 16 - 32 * spv) / (oh - 1)722742 * - 4-phase, 7-tap mode723723- * hrsz = ((iw - 7) * 256 - 32 - 64 * sph) / (ow - 1)724724- * vrsz = ((ih - 7) * 256 - 32 - 64 * spv) / (oh - 1)743743+ * hrsz = ((iw - 7) * 256 + 255 - 32 - 64 * sph) / (ow - 1)744744+ * vrsz = ((ih - 7) * 256 + 255 - 32 - 64 * spv) / (oh - 1)725745 *726726- * The ratios are integer values, and must be rounded down to ensure that the727727- * cropped input size is not bigger than the uncropped input size. As the ratio728728- * in 7-tap mode is always smaller than the ratio in 4-tap mode, we can use the729729- * 7-tap mode equations to compute a ratio approximation.746746+ * The ratios are integer values, and are rounded down to ensure that the747747+ * cropped input size is not bigger than the uncropped input size.748748+ *749749+ * As the number of phases/taps, used to select the correct equations to compute750750+ * the ratio, depends on the ratio, we start with the 4-tap mode equations to751751+ * compute an approximation of the ratio, and switch to the 7-tap mode equations752752+ * if the approximation is higher than the ratio threshold.753753+ *754754+ * As the 7-tap mode equations will return a ratio smaller than or equal to the755755+ * 4-tap mode equations, the resulting ratio could become lower than or equal to756756+ * the ratio threshold. This 'equations loop' isn't an issue as long as the757757+ * correct equations are used to compute the final input size. Starting with the758758+ * 4-tap mode equations ensure that, in case of values resulting in a 'ratio759759+ * loop', the smallest of the ratio values will be used, never exceeding the760760+ * requested input size.730761 *731762 * We first clamp the output size according to the hardware capabilitie to avoid732763 * auto-cropping the input more than required to satisfy the TRM equations. The···806775 unsigned int max_width;807776 unsigned int max_height;808777 unsigned int width_alignment;778778+ unsigned int width;779779+ unsigned int height;809780810781 /*811782 * Clamp the output height based on the hardware capabilities and···819786 max_height = min_t(unsigned int, max_height, MAX_OUT_HEIGHT);820787 output->height = clamp(output->height, min_height, max_height);821788822822- ratio->vert = ((input->height - 7) * 256 - 32 - 64 * spv)789789+ ratio->vert = ((input->height - 4) * 256 + 255 - 16 - 32 * spv)823790 / (output->height - 1);791791+ if (ratio->vert > MID_RESIZE_VALUE)792792+ ratio->vert = ((input->height - 7) * 256 + 255 - 32 - 64 * spv)793793+ / (output->height - 1);824794 ratio->vert = clamp_t(unsigned int, ratio->vert,825795 MIN_RESIZE_VALUE, MAX_RESIZE_VALUE);826796827797 if (ratio->vert <= MID_RESIZE_VALUE) {828798 upscaled_height = (output->height - 1) * ratio->vert829799 + 32 * spv + 16;830830- input->height = (upscaled_height >> 8) + 4;800800+ height = (upscaled_height >> 8) + 4;831801 } else {832802 upscaled_height = (output->height - 1) * ratio->vert833803 + 64 * spv + 32;834834- input->height = (upscaled_height >> 8) + 7;804804+ height = (upscaled_height >> 8) + 7;835805 }836806837807 /*···890854 max_width & ~(width_alignment - 1));891855 output->width = ALIGN(output->width, width_alignment);892856893893- ratio->horz = ((input->width - 7) * 256 - 32 - 64 * sph)857857+ ratio->horz = ((input->width - 7) * 256 + 255 - 16 - 32 * sph)894858 / (output->width - 1);859859+ if (ratio->horz > MID_RESIZE_VALUE)860860+ ratio->horz = ((input->width - 7) * 256 + 255 - 32 - 64 * sph)861861+ / (output->width - 1);895862 ratio->horz = clamp_t(unsigned int, ratio->horz,896863 MIN_RESIZE_VALUE, MAX_RESIZE_VALUE);897864898865 if (ratio->horz <= MID_RESIZE_VALUE) {899866 upscaled_width = (output->width - 1) * ratio->horz900867 + 32 * sph + 16;901901- input->width = (upscaled_width >> 8) + 7;868868+ width = (upscaled_width >> 8) + 7;902869 } else {903870 upscaled_width = (output->width - 1) * ratio->horz904871 + 64 * sph + 32;905905- input->width = (upscaled_width >> 8) + 7;872872+ width = (upscaled_width >> 8) + 7;906873 }874874+875875+ /* Center the new crop rectangle. */876876+ input->left += (input->width - width) / 2;877877+ input->top += (input->height - height) / 2;878878+ input->width = width;879879+ input->height = height;907880}908881909882/*
+3-3
drivers/media/video/omap3isp/ispstat.h
···131131struct ispstat_generic_config {132132 /*133133 * Fields must be in the same order as in:134134- * - isph3a_aewb_config135135- * - isph3a_af_config136136- * - isphist_config134134+ * - omap3isp_h3a_aewb_config135135+ * - omap3isp_h3a_af_config136136+ * - omap3isp_hist_config137137 */138138 u32 buf_size;139139 u16 config_counter;
+94-14
drivers/media/video/omap3isp/ispvideo.c
···47474848static struct isp_format_info formats[] = {4949 { V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8,5050- V4L2_MBUS_FMT_Y8_1X8, V4L2_PIX_FMT_GREY, 8, },5050+ V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8,5151+ V4L2_PIX_FMT_GREY, 8, },5252+ { V4L2_MBUS_FMT_Y10_1X10, V4L2_MBUS_FMT_Y10_1X10,5353+ V4L2_MBUS_FMT_Y10_1X10, V4L2_MBUS_FMT_Y8_1X8,5454+ V4L2_PIX_FMT_Y10, 10, },5555+ { V4L2_MBUS_FMT_Y12_1X12, V4L2_MBUS_FMT_Y10_1X10,5656+ V4L2_MBUS_FMT_Y12_1X12, V4L2_MBUS_FMT_Y8_1X8,5757+ V4L2_PIX_FMT_Y12, 12, },5858+ { V4L2_MBUS_FMT_SBGGR8_1X8, V4L2_MBUS_FMT_SBGGR8_1X8,5959+ V4L2_MBUS_FMT_SBGGR8_1X8, V4L2_MBUS_FMT_SBGGR8_1X8,6060+ V4L2_PIX_FMT_SBGGR8, 8, },6161+ { V4L2_MBUS_FMT_SGBRG8_1X8, V4L2_MBUS_FMT_SGBRG8_1X8,6262+ V4L2_MBUS_FMT_SGBRG8_1X8, V4L2_MBUS_FMT_SGBRG8_1X8,6363+ V4L2_PIX_FMT_SGBRG8, 8, },6464+ { V4L2_MBUS_FMT_SGRBG8_1X8, V4L2_MBUS_FMT_SGRBG8_1X8,6565+ V4L2_MBUS_FMT_SGRBG8_1X8, V4L2_MBUS_FMT_SGRBG8_1X8,6666+ V4L2_PIX_FMT_SGRBG8, 8, },6767+ { V4L2_MBUS_FMT_SRGGB8_1X8, V4L2_MBUS_FMT_SRGGB8_1X8,6868+ V4L2_MBUS_FMT_SRGGB8_1X8, V4L2_MBUS_FMT_SRGGB8_1X8,6969+ V4L2_PIX_FMT_SRGGB8, 8, },5170 { V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8,5252- V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_PIX_FMT_SGRBG10DPCM8, 8, },7171+ V4L2_MBUS_FMT_SGRBG10_1X10, 0,7272+ V4L2_PIX_FMT_SGRBG10DPCM8, 8, },5373 { V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR10_1X10,5454- V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_PIX_FMT_SBGGR10, 10, },7474+ V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR8_1X8,7575+ V4L2_PIX_FMT_SBGGR10, 10, },5576 { V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_MBUS_FMT_SGBRG10_1X10,5656- V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_PIX_FMT_SGBRG10, 10, },7777+ V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_MBUS_FMT_SGBRG8_1X8,7878+ V4L2_PIX_FMT_SGBRG10, 10, },5779 { V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_MBUS_FMT_SGRBG10_1X10,5858- V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_PIX_FMT_SGRBG10, 10, },8080+ V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_MBUS_FMT_SGRBG8_1X8,8181+ V4L2_PIX_FMT_SGRBG10, 10, },5982 { V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_MBUS_FMT_SRGGB10_1X10,6060- V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_PIX_FMT_SRGGB10, 10, },8383+ V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_MBUS_FMT_SRGGB8_1X8,8484+ V4L2_PIX_FMT_SRGGB10, 10, },6185 { V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_MBUS_FMT_SBGGR10_1X10,6262- V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_PIX_FMT_SBGGR12, 12, },8686+ V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_MBUS_FMT_SBGGR8_1X8,8787+ V4L2_PIX_FMT_SBGGR12, 12, },6388 { V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_MBUS_FMT_SGBRG10_1X10,6464- V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_PIX_FMT_SGBRG12, 12, },8989+ V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_MBUS_FMT_SGBRG8_1X8,9090+ V4L2_PIX_FMT_SGBRG12, 12, },6591 { V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_MBUS_FMT_SGRBG10_1X10,6666- V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_PIX_FMT_SGRBG12, 12, },9292+ V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_MBUS_FMT_SGRBG8_1X8,9393+ V4L2_PIX_FMT_SGRBG12, 12, },6794 { V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_MBUS_FMT_SRGGB10_1X10,6868- V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_PIX_FMT_SRGGB12, 12, },9595+ V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_MBUS_FMT_SRGGB8_1X8,9696+ V4L2_PIX_FMT_SRGGB12, 12, },6997 { V4L2_MBUS_FMT_UYVY8_1X16, V4L2_MBUS_FMT_UYVY8_1X16,7070- V4L2_MBUS_FMT_UYVY8_1X16, V4L2_PIX_FMT_UYVY, 16, },9898+ V4L2_MBUS_FMT_UYVY8_1X16, 0,9999+ V4L2_PIX_FMT_UYVY, 16, },71100 { V4L2_MBUS_FMT_YUYV8_1X16, V4L2_MBUS_FMT_YUYV8_1X16,7272- V4L2_MBUS_FMT_YUYV8_1X16, V4L2_PIX_FMT_YUYV, 16, },101101+ V4L2_MBUS_FMT_YUYV8_1X16, 0,102102+ V4L2_PIX_FMT_YUYV, 16, },73103};7410475105const struct isp_format_info *···11383 }1148411585 return NULL;8686+}8787+8888+/*8989+ * Decide whether desired output pixel code can be obtained with9090+ * the lane shifter by shifting the input pixel code.9191+ * @in: input pixelcode to shifter9292+ * @out: output pixelcode from shifter9393+ * @additional_shift: # of bits the sensor's LSB is offset from CAMEXT[0]9494+ *9595+ * return true if the combination is possible9696+ * return false otherwise9797+ */9898+static bool isp_video_is_shiftable(enum v4l2_mbus_pixelcode in,9999+ enum v4l2_mbus_pixelcode out,100100+ unsigned int additional_shift)101101+{102102+ const struct isp_format_info *in_info, *out_info;103103+104104+ if (in == out)105105+ return true;106106+107107+ in_info = omap3isp_video_format_info(in);108108+ out_info = omap3isp_video_format_info(out);109109+110110+ if ((in_info->flavor == 0) || (out_info->flavor == 0))111111+ return false;112112+113113+ if (in_info->flavor != out_info->flavor)114114+ return false;115115+116116+ return in_info->bpp - out_info->bpp + additional_shift <= 6;116117}117118118119/*···296235 return -EPIPE;297236298237 while (1) {238238+ unsigned int shifter_link;299239 /* Retrieve the sink format */300240 pad = &subdev->entity.pads[0];301241 if (!(pad->flags & MEDIA_PAD_FL_SINK))···325263 return -ENOSPC;326264 }327265266266+ /* If sink pad is on CCDC, the link has the lane shifter267267+ * in the middle of it. */268268+ shifter_link = subdev == &isp->isp_ccdc.subdev;269269+328270 /* Retrieve the source format */329271 pad = media_entity_remote_source(pad);330272 if (pad == NULL ||···344278 return -EPIPE;345279346280 /* Check if the two ends match */347347- if (fmt_source.format.code != fmt_sink.format.code ||348348- fmt_source.format.width != fmt_sink.format.width ||281281+ if (fmt_source.format.width != fmt_sink.format.width ||349282 fmt_source.format.height != fmt_sink.format.height)283283+ return -EPIPE;284284+285285+ if (shifter_link) {286286+ unsigned int parallel_shift = 0;287287+ if (isp->isp_ccdc.input == CCDC_INPUT_PARALLEL) {288288+ struct isp_parallel_platform_data *pdata =289289+ &((struct isp_v4l2_subdevs_group *)290290+ subdev->host_priv)->bus.parallel;291291+ parallel_shift = pdata->data_lane_shift * 2;292292+ }293293+ if (!isp_video_is_shiftable(fmt_source.format.code,294294+ fmt_sink.format.code,295295+ parallel_shift))296296+ return -EPIPE;297297+ } else if (fmt_source.format.code != fmt_sink.format.code)350298 return -EPIPE;351299 }352300
+3
drivers/media/video/omap3isp/ispvideo.h
···4949 * bits. Identical to @code if the format is 10 bits wide or less.5050 * @uncompressed: V4L2 media bus format code for the corresponding uncompressed5151 * format. Identical to @code if the format is not DPCM compressed.5252+ * @flavor: V4L2 media bus format code for the same pixel layout but5353+ * shifted to be 8 bits per pixel. =0 if format is not shiftable.5254 * @pixelformat: V4L2 pixel format FCC identifier5355 * @bpp: Bits per pixel5456 */···5856 enum v4l2_mbus_pixelcode code;5957 enum v4l2_mbus_pixelcode truncated;6058 enum v4l2_mbus_pixelcode uncompressed;5959+ enum v4l2_mbus_pixelcode flavor;6160 u32 pixelformat;6261 unsigned int bpp;6362};
+5-3
drivers/media/video/s5p-fimc/fimc-capture.c
···527527 if (ret)528528 return ret;529529530530- if (vb2_is_streaming(&fimc->vid_cap.vbq) || fimc_capture_active(fimc))530530+ if (vb2_is_busy(&fimc->vid_cap.vbq) || fimc_capture_active(fimc))531531 return -EBUSY;532532533533 frame = &ctx->d_frame;···539539 return -EINVAL;540540 }541541542542- for (i = 0; i < frame->fmt->colplanes; i++)543543- frame->payload[i] = pix->plane_fmt[i].bytesperline * pix->height;542542+ for (i = 0; i < frame->fmt->colplanes; i++) {543543+ frame->payload[i] =544544+ (pix->width * pix->height * frame->fmt->depth[i]) >> 3;545545+ }544546545547 /* Output DMA frame pixel size and offsets. */546548 frame->f_width = pix->plane_fmt[0].bytesperline * 8
···832832 return IRQ_HANDLED;833833 }834834835835- if (end_command)835835+ if (end_command && host->cmd)836836 mmc_omap_cmd_done(host, host->cmd);837837 if (host->data != NULL) {838838 if (transfer_error)
+1
drivers/mmc/host/sdhci-pci.c
···957957 host->ioaddr = pci_ioremap_bar(pdev, bar);958958 if (!host->ioaddr) {959959 dev_err(&pdev->dev, "failed to remap registers\n");960960+ ret = -ENOMEM;960961 goto release;961962 }962963
+8-1
drivers/mmc/host/sdhci.c
···1334133413351335 host = (struct sdhci_host*)param;1336133613371337+ /*13381338+ * If this tasklet gets rescheduled while running, it will13391339+ * be run again afterwards but without any active request.13401340+ */13411341+ if (!host->mrq)13421342+ return;13431343+13371344 spin_lock_irqsave(&host->lock, flags);1338134513391346 del_timer(&host->timer);···13521345 * upon error conditions.13531346 */13541347 if (!(host->flags & SDHCI_DEVICE_DEAD) &&13551355- (mrq->cmd->error ||13481348+ ((mrq->cmd && mrq->cmd->error) ||13561349 (mrq->data && (mrq->data->error ||13571350 (mrq->data->stop && mrq->data->stop->error))) ||13581351 (host->quirks & SDHCI_QUIRK_RESET_AFTER_REQUEST))) {
+5-5
drivers/mmc/host/tmio_mmc_pio.c
···728728 tmio_mmc_set_clock(host, ios->clock);729729730730 /* Power sequence - OFF -> UP -> ON */731731- if (ios->power_mode == MMC_POWER_OFF || !ios->clock) {731731+ if (ios->power_mode == MMC_POWER_UP) {732732+ /* power up SD bus */733733+ if (host->set_pwr)734734+ host->set_pwr(host->pdev, 1);735735+ } else if (ios->power_mode == MMC_POWER_OFF || !ios->clock) {732736 /* power down SD bus */733737 if (ios->power_mode == MMC_POWER_OFF && host->set_pwr)734738 host->set_pwr(host->pdev, 0);735739 tmio_mmc_clk_stop(host);736736- } else if (ios->power_mode == MMC_POWER_UP) {737737- /* power up SD bus */738738- if (host->set_pwr)739739- host->set_pwr(host->pdev, 1);740740 } else {741741 /* start bus clock */742742 tmio_mmc_clk_start(host);
+1-1
drivers/mtd/nand/diskonchip.c
···400400 doc200x_hwcontrol(mtd, 0, NAND_CTRL_ALE | NAND_CTRL_CHANGE);401401 doc200x_hwcontrol(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE);402402403403- /* We can't' use dev_ready here, but at least we wait for the403403+ /* We can't use dev_ready here, but at least we wait for the404404 * command to complete405405 */406406 udelay(50);
+1-1
drivers/net/amd8111e.c
···106106MODULE_LICENSE("GPL");107107MODULE_DEVICE_TABLE(pci, amd8111e_pci_tbl);108108module_param_array(speed_duplex, int, NULL, 0);109109-MODULE_PARM_DESC(speed_duplex, "Set device speed and duplex modes, 0: Auto Negotitate, 1: 10Mbps Half Duplex, 2: 10Mbps Full Duplex, 3: 100Mbps Half Duplex, 4: 100Mbps Full Duplex");109109+MODULE_PARM_DESC(speed_duplex, "Set device speed and duplex modes, 0: Auto Negotiate, 1: 10Mbps Half Duplex, 2: 10Mbps Full Duplex, 3: 100Mbps Half Duplex, 4: 100Mbps Full Duplex");110110module_param_array(coalesce, bool, NULL, 0);111111MODULE_PARM_DESC(coalesce, "Enable or Disable interrupt coalescing, 1: Enable, 0: Disable");112112module_param_array(dynamic_ipg, bool, NULL, 0);
···139139 * that hardware reset completed (what the f*ck).140140 * We still need to wait for a while.141141 */142142- usleep_range(500, 1000);142142+ udelay(500);143143 return 0;144144 }145145146146- usleep_range(1000, 10000);146146+ udelay(1000);147147 }148148149149 netdev_err(netdev, "software reset failed\n");···772772 if ((phycr & FTMAC100_PHYCR_MIIRD) == 0)773773 return phycr & FTMAC100_PHYCR_MIIRDATA;774774775775- usleep_range(100, 1000);775775+ udelay(100);776776 }777777778778 netdev_err(netdev, "mdio read timed out\n");···801801 if ((phycr & FTMAC100_PHYCR_MIIWR) == 0)802802 return;803803804804- usleep_range(100, 1000);804804+ udelay(100);805805 }806806807807 netdev_err(netdev, "mdio write timed out\n");
+4
drivers/net/mii.c
···4949 result |= ADVERTISED_100baseT_Half;5050 if (advert & ADVERTISE_100FULL)5151 result |= ADVERTISED_100baseT_Full;5252+ if (advert & ADVERTISE_PAUSE_CAP)5353+ result |= ADVERTISED_Pause;5454+ if (advert & ADVERTISE_PAUSE_ASYM)5555+ result |= ADVERTISED_Asym_Pause;52565357 return result;5458}
+8
drivers/net/netconsole.c
···671671 goto done;672672673673 spin_lock_irqsave(&target_list_lock, flags);674674+restart:674675 list_for_each_entry(nt, &target_list, list) {675676 netconsole_target_get(nt);676677 if (nt->np.dev == dev) {···684683 * rtnl_lock already held685684 */686685 if (nt->np.dev) {686686+ spin_unlock_irqrestore(687687+ &target_list_lock,688688+ flags);687689 __netpoll_cleanup(&nt->np);690690+ spin_lock_irqsave(&target_list_lock,691691+ flags);688692 dev_put(nt->np.dev);689693 nt->np.dev = NULL;694694+ netconsole_target_put(nt);695695+ goto restart;690696 }691697 /* Fall through */692698 case NETDEV_GOING_DOWN:
···316316317317 hdr_len = ieee80211_hdrlen(fc);318318319319- /* Find index into station table for destination station */320320- sta_id = iwl_legacy_sta_id_or_broadcast(priv, ctx, info->control.sta);321321- if (sta_id == IWL_INVALID_STATION) {322322- IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",323323- hdr->addr1);324324- goto drop_unlock;319319+ /* For management frames use broadcast id to do not break aggregation */320320+ if (!ieee80211_is_data(fc))321321+ sta_id = ctx->bcast_sta_id;322322+ else {323323+ /* Find index into station table for destination station */324324+ sta_id = iwl_legacy_sta_id_or_broadcast(priv, ctx, info->control.sta);325325+326326+ if (sta_id == IWL_INVALID_STATION) {327327+ IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",328328+ hdr->addr1);329329+ goto drop_unlock;330330+ }325331 }326332327333 IWL_DEBUG_TX(priv, "station Id %d\n", sta_id);···11331127 q->read_ptr = iwl_legacy_queue_inc_wrap(q->read_ptr, q->n_bd)) {1134112811351129 tx_info = &txq->txb[txq->q.read_ptr];11361136- iwl4965_tx_status(priv, tx_info,11371137- txq_id >= IWL4965_FIRST_AMPDU_QUEUE);11301130+11311131+ if (WARN_ON_ONCE(tx_info->skb == NULL))11321132+ continue;1138113311391134 hdr = (struct ieee80211_hdr *)tx_info->skb->data;11401140- if (hdr && ieee80211_is_data_qos(hdr->frame_control))11351135+ if (ieee80211_is_data_qos(hdr->frame_control))11411136 nfreed++;11371137+11381138+ iwl4965_tx_status(priv, tx_info,11391139+ txq_id >= IWL4965_FIRST_AMPDU_QUEUE);11421140 tx_info->skb = NULL;1143114111441142 priv->cfg->ops->lib->txq_free_tfd(priv, txq);
+19-1
drivers/net/wireless/iwlegacy/iwl-led.c
···4848MODULE_PARM_DESC(led_mode, "0=system default, "4949 "1=On(RF On)/Off(RF Off), 2=blinking");50505151+/* Throughput OFF time(ms) ON time (ms)5252+ * >300 25 255353+ * >200 to 300 40 405454+ * >100 to 200 55 555555+ * >70 to 100 65 655656+ * >50 to 70 75 755757+ * >20 to 50 85 855858+ * >10 to 20 95 955959+ * >5 to 10 110 1106060+ * >1 to 5 130 1306161+ * >0 to 1 167 1676262+ * <=0 SOLID ON6363+ */5164static const struct ieee80211_tpt_blink iwl_blink[] = {5252- { .throughput = 0 * 1024 - 1, .blink_time = 334 },6565+ { .throughput = 0, .blink_time = 334 },5366 { .throughput = 1 * 1024 - 1, .blink_time = 260 },5467 { .throughput = 5 * 1024 - 1, .blink_time = 220 },5568 { .throughput = 10 * 1024 - 1, .blink_time = 190 },···113100114101 if (priv->blink_on == on && priv->blink_off == off)115102 return 0;103103+104104+ if (off == 0) {105105+ /* led is SOLID_ON */106106+ on = IWL_LED_SOLID;107107+ }116108117109 IWL_DEBUG_LED(priv, "Led blink time compensation=%u\n",118110 priv->cfg->base_params->led_compensation);
+4-4
drivers/net/wireless/iwlegacy/iwl4965-base.c
···29842984 struct iwl_priv *priv = container_of(work, struct iwl_priv,29852985 txpower_work);2986298629872987+ mutex_lock(&priv->mutex);29882988+29872989 /* If a scan happened to start before we got here29882990 * then just return; the statistics notification will29892991 * kick off another scheduled work to compensate for29902992 * any temperature delta we missed here. */29912993 if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||29922994 test_bit(STATUS_SCANNING, &priv->status))29932993- return;29942994-29952995- mutex_lock(&priv->mutex);29952995+ goto out;2996299629972997 /* Regardless of if we are associated, we must reconfigure the29982998 * TX power since frames can be sent on non-radar channels while···30023002 /* Update last_temperature to keep is_calib_needed from running30033003 * when it isn't needed... */30043004 priv->last_temperature = priv->temperature;30053005-30053005+out:30063006 mutex_unlock(&priv->mutex);30073007}30083008
+1-6
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
···335335 struct ieee80211_channel *channel = conf->channel;336336 const struct iwl_channel_info *ch_info;337337 int ret = 0;338338- bool ht_changed[NUM_IWL_RXON_CTX] = {};339338340339 IWL_DEBUG_MAC80211(priv, "changed %#x", changed);341340···382383383384 for_each_context(priv, ctx) {384385 /* Configure HT40 channels */385385- if (ctx->ht.enabled != conf_is_ht(conf)) {386386+ if (ctx->ht.enabled != conf_is_ht(conf))386387 ctx->ht.enabled = conf_is_ht(conf);387387- ht_changed[ctx->ctxid] = true;388388- }389388390389 if (ctx->ht.enabled) {391390 if (conf_is_ht40_minus(conf)) {···452455 if (!memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging)))453456 continue;454457 iwlagn_commit_rxon(priv, ctx);455455- if (ht_changed[ctx->ctxid])456456- iwlagn_update_qos(priv, ctx);457458 }458459 out:459460 mutex_unlock(&priv->mutex);
+18-9
drivers/net/wireless/iwlwifi/iwl-agn-tx.c
···568568569569 hdr_len = ieee80211_hdrlen(fc);570570571571- /* Find index into station table for destination station */572572- sta_id = iwl_sta_id_or_broadcast(priv, ctx, info->control.sta);573573- if (sta_id == IWL_INVALID_STATION) {574574- IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",575575- hdr->addr1);576576- goto drop_unlock;571571+ /* For management frames use broadcast id to do not break aggregation */572572+ if (!ieee80211_is_data(fc))573573+ sta_id = ctx->bcast_sta_id;574574+ else {575575+ /* Find index into station table for destination station */576576+ sta_id = iwl_sta_id_or_broadcast(priv, ctx, info->control.sta);577577+ if (sta_id == IWL_INVALID_STATION) {578578+ IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",579579+ hdr->addr1);580580+ goto drop_unlock;581581+ }577582 }578583579584 IWL_DEBUG_TX(priv, "station Id %d\n", sta_id);···12291224 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {1230122512311226 tx_info = &txq->txb[txq->q.read_ptr];12321232- iwlagn_tx_status(priv, tx_info,12331233- txq_id >= IWLAGN_FIRST_AMPDU_QUEUE);12271227+12281228+ if (WARN_ON_ONCE(tx_info->skb == NULL))12291229+ continue;1234123012351231 hdr = (struct ieee80211_hdr *)tx_info->skb->data;12361236- if (hdr && ieee80211_is_data_qos(hdr->frame_control))12321232+ if (ieee80211_is_data_qos(hdr->frame_control))12371233 nfreed++;12341234+12351235+ iwlagn_tx_status(priv, tx_info,12361236+ txq_id >= IWLAGN_FIRST_AMPDU_QUEUE);12381237 tx_info->skb = NULL;1239123812401239 if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl)
···239239 addr_t ip;240240 int rc;241241242242- kstat_cpu(smp_processor_id()).irqs[EXTINT_DSD]++;243242 switch (ext_int_code >> 24) {244243 case DASD_DIAG_CODE_31BIT:245244 ip = (addr_t) param32;···249250 default:250251 return;251252 }253253+ kstat_cpu(smp_processor_id()).irqs[EXTINT_DSD]++;252254 if (!ip) { /* no intparm: unsolicited interrupt */253255 DBF_EVENT(DBF_NOTICE, "%s", "caught unsolicited "254256 "interrupt");
+3-2
drivers/s390/block/dasd_eckd.c
···20372037 return;2038203820392039 /* summary unit check */20402040- if ((sense[7] == 0x0D) &&20402040+ if ((sense[27] & DASD_SENSE_BIT_0) && (sense[7] == 0x0D) &&20412041 (scsw_dstat(&irb->scsw) & DEV_STAT_UNIT_CHECK)) {20422042 dasd_alias_handle_summary_unit_check(device, irb);20432043 return;···20532053 /* loss of device reservation is handled via base devices only20542054 * as alias devices may be used with several bases20552055 */20562056- if (device->block && (sense[7] == 0x3F) &&20562056+ if (device->block && (sense[27] & DASD_SENSE_BIT_0) &&20572057+ (sense[7] == 0x3F) &&20572058 (scsw_dstat(&irb->scsw) & DEV_STAT_UNIT_CHECK) &&20582059 test_bit(DASD_FLAG_IS_RESERVED, &device->flags)) {20592060 if (device->features & DASD_FEATURE_FAILONSLCK)
···4242static int4343dasd_ioctl_enable(struct block_device *bdev)4444{4545- struct dasd_block *block = bdev->bd_disk->private_data;4545+ struct dasd_device *base;46464747 if (!capable(CAP_SYS_ADMIN))4848 return -EACCES;49495050- dasd_enable_device(block->base);5050+ base = dasd_device_from_gendisk(bdev->bd_disk);5151+ if (!base)5252+ return -ENODEV;5353+5454+ dasd_enable_device(base);5155 /* Formatting the dasd device can change the capacity. */5256 mutex_lock(&bdev->bd_mutex);5353- i_size_write(bdev->bd_inode, (loff_t)get_capacity(block->gdp) << 9);5757+ i_size_write(bdev->bd_inode,5858+ (loff_t)get_capacity(base->block->gdp) << 9);5459 mutex_unlock(&bdev->bd_mutex);6060+ dasd_put_device(base);5561 return 0;5662}5763···6862static int6963dasd_ioctl_disable(struct block_device *bdev)7064{7171- struct dasd_block *block = bdev->bd_disk->private_data;6565+ struct dasd_device *base;72667367 if (!capable(CAP_SYS_ADMIN))7468 return -EACCES;75697070+ base = dasd_device_from_gendisk(bdev->bd_disk);7171+ if (!base)7272+ return -ENODEV;7673 /*7774 * Man this is sick. We don't do a real disable but only downgrade7875 * the device to DASD_STATE_BASIC. The reason is that dasdfmt uses···8475 * using the BIODASDFMT ioctl. Therefore the correct state for the8576 * device is DASD_STATE_BASIC that allows to do basic i/o.8677 */8787- dasd_set_target_state(block->base, DASD_STATE_BASIC);7878+ dasd_set_target_state(base, DASD_STATE_BASIC);8879 /*8980 * Set i_size to zero, since read, write, etc. check against this9081 * value.···9283 mutex_lock(&bdev->bd_mutex);9384 i_size_write(bdev->bd_inode, 0);9485 mutex_unlock(&bdev->bd_mutex);8686+ dasd_put_device(base);9587 return 0;9688}9789···201191static int202192dasd_ioctl_format(struct block_device *bdev, void __user *argp)203193{204204- struct dasd_block *block = bdev->bd_disk->private_data;194194+ struct dasd_device *base;205195 struct format_data_t fdata;196196+ int rc;206197207198 if (!capable(CAP_SYS_ADMIN))208199 return -EACCES;209200 if (!argp)210201 return -EINVAL;211211-212212- if (block->base->features & DASD_FEATURE_READONLY ||213213- test_bit(DASD_FLAG_DEVICE_RO, &block->base->flags))202202+ base = dasd_device_from_gendisk(bdev->bd_disk);203203+ if (!base)204204+ return -ENODEV;205205+ if (base->features & DASD_FEATURE_READONLY ||206206+ test_bit(DASD_FLAG_DEVICE_RO, &base->flags)) {207207+ dasd_put_device(base);214208 return -EROFS;215215- if (copy_from_user(&fdata, argp, sizeof(struct format_data_t)))209209+ }210210+ if (copy_from_user(&fdata, argp, sizeof(struct format_data_t))) {211211+ dasd_put_device(base);216212 return -EFAULT;213213+ }217214 if (bdev != bdev->bd_contains) {218215 pr_warning("%s: The specified DASD is a partition and cannot "219216 "be formatted\n",220220- dev_name(&block->base->cdev->dev));217217+ dev_name(&base->cdev->dev));218218+ dasd_put_device(base);221219 return -EINVAL;222220 }223223- return dasd_format(block, &fdata);221221+ rc = dasd_format(base->block, &fdata);222222+ dasd_put_device(base);223223+ return rc;224224}225225226226#ifdef CONFIG_DASD_PROFILE···360340static int361341dasd_ioctl_set_ro(struct block_device *bdev, void __user *argp)362342{363363- struct dasd_block *block = bdev->bd_disk->private_data;364364- int intval;343343+ struct dasd_device *base;344344+ int intval, rc;365345366346 if (!capable(CAP_SYS_ADMIN))367347 return -EACCES;···370350 return -EINVAL;371351 if (get_user(intval, (int __user *)argp))372352 return -EFAULT;373373- if (!intval && test_bit(DASD_FLAG_DEVICE_RO, &block->base->flags))353353+ base = dasd_device_from_gendisk(bdev->bd_disk);354354+ if (!base)355355+ return -ENODEV;356356+ if (!intval && test_bit(DASD_FLAG_DEVICE_RO, &base->flags)) {357357+ dasd_put_device(base);374358 return -EROFS;359359+ }375360 set_disk_ro(bdev->bd_disk, intval);376376- return dasd_set_feature(block->base->cdev, DASD_FEATURE_READONLY, intval);361361+ rc = dasd_set_feature(base->cdev, DASD_FEATURE_READONLY, intval);362362+ dasd_put_device(base);363363+ return rc;377364}378365379366static int dasd_ioctl_readall_cmb(struct dasd_block *block, unsigned int cmd,···399372int dasd_ioctl(struct block_device *bdev, fmode_t mode,400373 unsigned int cmd, unsigned long arg)401374{402402- struct dasd_block *block = bdev->bd_disk->private_data;375375+ struct dasd_block *block;376376+ struct dasd_device *base;403377 void __user *argp;378378+ int rc;404379405380 if (is_compat_task())406381 argp = compat_ptr(arg);407382 else408383 argp = (void __user *)arg;409384410410- if (!block)411411- return -ENODEV;412412-413385 if ((_IOC_DIR(cmd) != _IOC_NONE) && !arg) {414386 PRINT_DEBUG("empty data ptr");415387 return -EINVAL;416388 }417389390390+ base = dasd_device_from_gendisk(bdev->bd_disk);391391+ if (!base)392392+ return -ENODEV;393393+ block = base->block;394394+ rc = 0;418395 switch (cmd) {419396 case BIODASDDISABLE:420420- return dasd_ioctl_disable(bdev);397397+ rc = dasd_ioctl_disable(bdev);398398+ break;421399 case BIODASDENABLE:422422- return dasd_ioctl_enable(bdev);400400+ rc = dasd_ioctl_enable(bdev);401401+ break;423402 case BIODASDQUIESCE:424424- return dasd_ioctl_quiesce(block);403403+ rc = dasd_ioctl_quiesce(block);404404+ break;425405 case BIODASDRESUME:426426- return dasd_ioctl_resume(block);406406+ rc = dasd_ioctl_resume(block);407407+ break;427408 case BIODASDFMT:428428- return dasd_ioctl_format(bdev, argp);409409+ rc = dasd_ioctl_format(bdev, argp);410410+ break;429411 case BIODASDINFO:430430- return dasd_ioctl_information(block, cmd, argp);412412+ rc = dasd_ioctl_information(block, cmd, argp);413413+ break;431414 case BIODASDINFO2:432432- return dasd_ioctl_information(block, cmd, argp);415415+ rc = dasd_ioctl_information(block, cmd, argp);416416+ break;433417 case BIODASDPRRD:434434- return dasd_ioctl_read_profile(block, argp);418418+ rc = dasd_ioctl_read_profile(block, argp);419419+ break;435420 case BIODASDPRRST:436436- return dasd_ioctl_reset_profile(block);421421+ rc = dasd_ioctl_reset_profile(block);422422+ break;437423 case BLKROSET:438438- return dasd_ioctl_set_ro(bdev, argp);424424+ rc = dasd_ioctl_set_ro(bdev, argp);425425+ break;439426 case DASDAPIVER:440440- return dasd_ioctl_api_version(argp);427427+ rc = dasd_ioctl_api_version(argp);428428+ break;441429 case BIODASDCMFENABLE:442442- return enable_cmf(block->base->cdev);430430+ rc = enable_cmf(base->cdev);431431+ break;443432 case BIODASDCMFDISABLE:444444- return disable_cmf(block->base->cdev);433433+ rc = disable_cmf(base->cdev);434434+ break;445435 case BIODASDREADALLCMB:446446- return dasd_ioctl_readall_cmb(block, cmd, argp);436436+ rc = dasd_ioctl_readall_cmb(block, cmd, argp);437437+ break;447438 default:448439 /* if the discipline has an ioctl method try it. */449449- if (block->base->discipline->ioctl) {450450- int rval = block->base->discipline->ioctl(block, cmd, argp);451451- if (rval != -ENOIOCTLCMD)452452- return rval;453453- }454454-455455- return -EINVAL;440440+ if (base->discipline->ioctl) {441441+ rc = base->discipline->ioctl(block, cmd, argp);442442+ if (rc == -ENOIOCTLCMD)443443+ rc = -EINVAL;444444+ } else445445+ rc = -EINVAL;456446 }447447+ dasd_put_device(base);448448+ return rc;457449}
+12-5
drivers/s390/cio/qdio_main.c
···407407 q->q_stats.nr_sbals[pos]++;408408}409409410410-static void announce_buffer_error(struct qdio_q *q, int count)410410+static void process_buffer_error(struct qdio_q *q, int count)411411{412412+ unsigned char state = (q->is_input_q) ? SLSB_P_INPUT_NOT_INIT :413413+ SLSB_P_OUTPUT_NOT_INIT;414414+412415 q->qdio_error |= QDIO_ERROR_SLSB_STATE;413416414417 /* special handling for no target buffer empty */···429426 DBF_ERROR("F14:%2x F15:%2x",430427 q->sbal[q->first_to_check]->element[14].flags & 0xff,431428 q->sbal[q->first_to_check]->element[15].flags & 0xff);429429+430430+ /*431431+ * Interrupts may be avoided as long as the error is present432432+ * so change the buffer state immediately to avoid starvation.433433+ */434434+ set_buf_states(q, q->first_to_check, state, count);432435}433436434437static inline void inbound_primed(struct qdio_q *q, int count)···515506 account_sbals(q, count);516507 break;517508 case SLSB_P_INPUT_ERROR:518518- announce_buffer_error(q, count);519519- /* process the buffer, the upper layer will take care of it */509509+ process_buffer_error(q, count);520510 q->first_to_check = add_buf(q->first_to_check, count);521511 atomic_sub(count, &q->nr_buf_used);522512 if (q->irq_ptr->perf_stat_enabled)···685677 account_sbals(q, count);686678 break;687679 case SLSB_P_OUTPUT_ERROR:688688- announce_buffer_error(q, count);689689- /* process the buffer, the upper layer will take care of it */680680+ process_buffer_error(q, count);690681 q->first_to_check = add_buf(q->first_to_check, count);691682 atomic_sub(count, &q->nr_buf_used);692683 if (q->irq_ptr->perf_stat_enabled)
+1-1
drivers/s390/kvm/kvm_virtio.c
···381381 u16 subcode;382382 u32 param;383383384384- kstat_cpu(smp_processor_id()).irqs[EXTINT_VRT]++;385384 subcode = ext_int_code >> 16;386385 if ((subcode & 0xff00) != VIRTIO_SUBCODE_64)387386 return;387387+ kstat_cpu(smp_processor_id()).irqs[EXTINT_VRT]++;388388389389 /* The LSB might be overloaded, we have to mask it */390390 vq = (struct virtqueue *)(param64 & ~1UL);
+6-3
drivers/scsi/device_handler/scsi_dh.c
···394394 unsigned long flags;395395 struct scsi_device *sdev;396396 struct scsi_device_handler *scsi_dh = NULL;397397+ struct device *dev = NULL;397398398399 spin_lock_irqsave(q->queue_lock, flags);399400 sdev = q->queuedata;400401 if (sdev && sdev->scsi_dh_data)401402 scsi_dh = sdev->scsi_dh_data->scsi_dh;402402- if (!scsi_dh || !get_device(&sdev->sdev_gendev) ||403403+ dev = get_device(&sdev->sdev_gendev);404404+ if (!scsi_dh || !dev ||403405 sdev->sdev_state == SDEV_CANCEL ||404406 sdev->sdev_state == SDEV_DEL)405407 err = SCSI_DH_NOSYS;···412410 if (err) {413411 if (fn)414412 fn(data, err);415415- return err;413413+ goto out;416414 }417415418416 if (scsi_dh->activate)419417 err = scsi_dh->activate(sdev, fn, data);420420- put_device(&sdev->sdev_gendev);418418+out:419419+ put_device(dev);421420 return err;422421}423422EXPORT_SYMBOL_GPL(scsi_dh_activate);
+21-2
drivers/scsi/mpt2sas/mpt2sas_ctl.c
···688688 goto out;689689 }690690691691+ /* Check for overflow and wraparound */692692+ if (karg.data_sge_offset * 4 > ioc->request_sz ||693693+ karg.data_sge_offset > (UINT_MAX / 4)) {694694+ ret = -EINVAL;695695+ goto out;696696+ }697697+691698 /* copy in request message frame from user */692699 if (copy_from_user(mpi_request, mf, karg.data_sge_offset*4)) {693700 printk(KERN_ERR "failure at %s:%d/%s()!\n", __FILE__, __LINE__,···19701963 Mpi2DiagBufferPostReply_t *mpi_reply;19711964 int rc, i;19721965 u8 buffer_type;19731973- unsigned long timeleft;19661966+ unsigned long timeleft, request_size, copy_size;19741967 u16 smid;19751968 u16 ioc_status;19761969 u8 issue_reset = 0;···20061999 return -ENOMEM;20072000 }2008200120022002+ request_size = ioc->diag_buffer_sz[buffer_type];20032003+20092004 if ((karg.starting_offset % 4) || (karg.bytes_to_read % 4)) {20102005 printk(MPT2SAS_ERR_FMT "%s: either the starting_offset "20112006 "or bytes_to_read are not 4 byte aligned\n", ioc->name,···20152006 return -EINVAL;20162007 }2017200820092009+ if (karg.starting_offset > request_size)20102010+ return -EINVAL;20112011+20182012 diag_data = (void *)(request_data + karg.starting_offset);20192013 dctlprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: diag_buffer(%p), "20202014 "offset(%d), sz(%d)\n", ioc->name, __func__,20212015 diag_data, karg.starting_offset, karg.bytes_to_read));2022201620172017+ /* Truncate data on requests that are too large */20182018+ if ((diag_data + karg.bytes_to_read < diag_data) ||20192019+ (diag_data + karg.bytes_to_read > request_data + request_size))20202020+ copy_size = request_size - karg.starting_offset;20212021+ else20222022+ copy_size = karg.bytes_to_read;20232023+20232024 if (copy_to_user((void __user *)uarg->diagnostic_data,20242024- diag_data, karg.bytes_to_read)) {20252025+ diag_data, copy_size)) {20252026 printk(MPT2SAS_ERR_FMT "%s: Unable to write "20262027 "mpt_diag_read_buffer_t data @ %p\n", ioc->name,20272028 __func__, diag_data);
+3
drivers/scsi/pmcraid.c
···38143814 rc = -EFAULT;38153815 goto out_free_buffer;38163816 }38173817+ } else if (request_size < 0) {38183818+ rc = -EINVAL;38193819+ goto out_free_buffer;38173820 }3818382138193822 /* check if we have any additional command parameters */
+6-1
drivers/scsi/scsi_lib.c
···400400static void scsi_run_queue(struct request_queue *q)401401{402402 struct scsi_device *sdev = q->queuedata;403403- struct Scsi_Host *shost = sdev->host;403403+ struct Scsi_Host *shost;404404 LIST_HEAD(starved_list);405405 unsigned long flags;406406407407+ /* if the device is dead, sdev will be NULL, so no queue to run */408408+ if (!sdev)409409+ return;410410+411411+ shost = sdev->host;407412 if (scsi_target(sdev)->single_lun)408413 scsi_single_lun_run(sdev);409414
+8-8
drivers/scsi/scsi_sysfs.c
···322322 kfree(evt);323323 }324324325325- if (sdev->request_queue) {326326- sdev->request_queue->queuedata = NULL;327327- /* user context needed to free queue */328328- scsi_free_queue(sdev->request_queue);329329- /* temporary expedient, try to catch use of queue lock330330- * after free of sdev */331331- sdev->request_queue = NULL;332332- }325325+ /* NULL queue means the device can't be used */326326+ sdev->request_queue = NULL;333327334328 scsi_target_reap(scsi_target(sdev));335329···931937 if (sdev->host->hostt->slave_destroy)932938 sdev->host->hostt->slave_destroy(sdev);933939 transport_destroy_device(dev);940940+941941+ /* cause the request function to reject all I/O requests */942942+ sdev->request_queue->queuedata = NULL;943943+944944+ /* Freeing the queue signals to block that we're done */945945+ scsi_free_queue(sdev->request_queue);934946 put_device(dev);935947}936948
···444444 return (NDIS_STATUS_FAILURE);445445 }446446 }447447- /* Drop not U2M frames, can't's drop here because we will drop beacon in this case */447447+ /* Drop not U2M frames, can't drop here because we will drop beacon in this case */448448 /* I am kind of doubting the U2M bit operation */449449 /* if (pRxD->U2M == 0) */450450 /* return(NDIS_STATUS_FAILURE); */
+1-1
drivers/staging/rt2860/common/cmm_data_usb.c
···860860 DBGPRINT_RAW(RT_DEBUG_ERROR, ("received packet too long\n"));861861 return NDIS_STATUS_FAILURE;862862 }863863- /* Drop not U2M frames, can't's drop here because we will drop beacon in this case */863863+ /* Drop not U2M frames, can't drop here because we will drop beacon in this case */864864 /* I am kind of doubting the U2M bit operation */865865 /* if (pRxD->U2M == 0) */866866 /* return(NDIS_STATUS_FAILURE); */
···22 tristate "Softlogic 6x10 MPEG codec cards"33 depends on PCI && VIDEO_DEV && SND && I2C44 select VIDEOBUF_DMA_SG55+ select SND_PCM56 ---help---67 This driver supports the Softlogic based MPEG-4 and h.264 codec78 codec cards.
+1-1
drivers/staging/spectra/ffsport.c
···653653 }654654 dev->queue->queuedata = dev;655655656656- /* As Linux block layer does't support >4KB hardware sector, */656656+ /* As Linux block layer doesn't support >4KB hardware sector, */657657 /* Here we force report 512 byte hardware sector size to Kernel */658658 blk_queue_logical_block_size(dev->queue, 512);659659
+1-1
drivers/staging/tidspbridge/dynload/cload.c
···718718 * as a temporary for .dllview record construction.719719 * Allocate storage for the whole table. Add 1 to the section count720720 * in case a trampoline section is auto-generated as well as the721721- * size of the trampoline section name so DLLView does't get lost.721721+ * size of the trampoline section name so DLLView doesn't get lost.722722 */723723724724 siz = sym_count * sizeof(struct local_symbol);
+1-1
drivers/staging/tty/specialix.c
···978978 spin_lock_irqsave(&bp->lock, flags);979979 sx_out(bp, CD186x_CAR, port_No(port));980980981981- /* The Specialix board does't implement the RTS lines.981981+ /* The Specialix board doesn't implement the RTS lines.982982 They are used to set the IRQ level. Don't touch them. */983983 if (sx_crtscts(tty))984984 port->MSVR = MSVR_DTR | (sx_in(bp, CD186x_MSVR) & MSVR_RTS);
+5-6
drivers/staging/usbip/vhci_hcd.c
···876876 }877877878878 /* kill threads related to this sdev, if v.c. exists */879879- kthread_stop(vdev->ud.tcp_rx);880880- kthread_stop(vdev->ud.tcp_tx);879879+ if (vdev->ud.tcp_rx)880880+ kthread_stop(vdev->ud.tcp_rx);881881+ if (vdev->ud.tcp_tx)882882+ kthread_stop(vdev->ud.tcp_tx);881883882884 usbip_uinfo("stop threads\n");883885···950948static void vhci_device_init(struct vhci_device *vdev)951949{952950 memset(vdev, 0, sizeof(*vdev));953953-954954- vdev->ud.tcp_rx = kthread_create(vhci_rx_loop, &vdev->ud, "vhci_rx");955955- vdev->ud.tcp_tx = kthread_create(vhci_tx_loop, &vdev->ud, "vhci_tx");956951957952 vdev->ud.side = USBIP_VHCI;958953 vdev->ud.status = VDEV_ST_NULL;···11381139 usbip_uerr("create hcd failed\n");11391140 return -ENOMEM;11401141 }11411141-11421142+ hcd->has_tt = 1;1142114311431144 /* this is private data for vhci_hcd */11441145 the_controller = hcd_to_vhci(hcd);
···777777 if (t1 != t2)778778 xhci_writel(xhci, t2, port_array[port_index]);779779780780- if (DEV_HIGHSPEED(t1)) {780780+ if (hcd->speed != HCD_USB3) {781781 /* enable remote wake up for USB 2.0 */782782 u32 __iomem *addr;783783 u32 tmp;···866866 temp |= PORT_LINK_STROBE | XDEV_U0;867867 xhci_writel(xhci, temp, port_array[port_index]);868868 }869869+ /* wait for the port to enter U0 and report port link870870+ * state change.871871+ */872872+ spin_unlock_irqrestore(&xhci->lock, flags);873873+ msleep(20);874874+ spin_lock_irqsave(&xhci->lock, flags);875875+876876+ /* Clear PLC */877877+ temp = xhci_readl(xhci, port_array[port_index]);878878+ if (temp & PORT_PLC) {879879+ temp = xhci_port_state_to_neutral(temp);880880+ temp |= PORT_PLC;881881+ xhci_writel(xhci, temp, port_array[port_index]);882882+ }883883+869884 slot_id = xhci_find_slot_id_by_port(hcd,870885 xhci, port_index + 1);871886 if (slot_id)···888873 } else889874 xhci_writel(xhci, temp, port_array[port_index]);890875891891- if (DEV_HIGHSPEED(temp)) {876876+ if (hcd->speed != HCD_USB3) {892877 /* disable remote wake up for USB 2.0 */893878 u32 __iomem *addr;894879 u32 tmp;
+2-4
drivers/usb/musb/musb_gadget.c
···18871887 otg_set_vbus(musb->xceiv, 1);1888188818891889 hcd->self.uses_pio_for_control = 1;18901890-18911891- if (musb->xceiv->last_event == USB_EVENT_NONE)18921892- pm_runtime_put(musb->controller);18931893-18941890 }18911891+ if (musb->xceiv->last_event == USB_EVENT_NONE)18921892+ pm_runtime_put(musb->controller);1895189318961894 return 0;18971895
+1-1
drivers/usb/musb/omap2430.c
···270270 DBG(4, "VBUS Disconnect\n");271271272272#ifdef CONFIG_USB_GADGET_MUSB_HDRC273273- if (is_otg_enabled(musb))273273+ if (is_otg_enabled(musb) || is_peripheral_enabled(musb))274274 if (musb->gadget_driver)275275#endif276276 {
···718718 u64 total_bytes; /* total bytes in the space,719719 this doesn't take mirrors into account */720720 u64 bytes_used; /* total bytes used,721721- this does't take mirrors into account */721721+ this doesn't take mirrors into account */722722 u64 bytes_pinned; /* total bytes pinned, will be freed when the723723 transaction finishes */724724 u64 bytes_reserved; /* total bytes the allocator has reserved for
+1
fs/btrfs/disk-io.c
···2824282428252825 spin_lock(&delayed_refs->lock);28262826 if (delayed_refs->num_entries == 0) {28272827+ spin_unlock(&delayed_refs->lock);28272828 printk(KERN_INFO "delayed_refs has NO entry\n");28282829 return ret;28292830 }
+4
fs/btrfs/extent-tree.c
···80598059 u64 group_start = group->key.objectid;80608060 new_extents = kmalloc(sizeof(*new_extents),80618061 GFP_NOFS);80628062+ if (!new_extents) {80638063+ ret = -ENOMEM;80648064+ goto out;80658065+ }80628066 nr_extents = 1;80638067 ret = get_new_locations(reloc_inode,80648068 extent_key,
···2209220922102210 log = root->log_root;22112211 path = btrfs_alloc_path();22122212- if (!path)22132213- return -ENOMEM;22122212+ if (!path) {22132213+ err = -ENOMEM;22142214+ goto out_unlock;22152215+ }2214221622152217 di = btrfs_lookup_dir_item(trans, log, path, dir->i_ino,22162218 name, name_len, -1);···22732271 }22742272fail:22752273 btrfs_free_path(path);22742274+out_unlock:22762275 mutex_unlock(&BTRFS_I(dir)->log_mutex);22772276 if (ret == -ENOSPC) {22782277 root->fs_info->last_trans_log_full_commit = trans->transid;
+10
fs/btrfs/volumes.c
···155155 unsigned long limit;156156 unsigned long last_waited = 0;157157 int force_reg = 0;158158+ struct blk_plug plug;159159+160160+ /*161161+ * this function runs all the bios we've collected for162162+ * a particular device. We don't want to wander off to163163+ * another device without first sending all of these down.164164+ * So, setup a plug here and finish it off before we return165165+ */166166+ blk_start_plug(&plug);158167159168 bdi = blk_get_backing_dev_info(device->bdev);160169 fs_info = device->dev_root->fs_info;···303294 spin_unlock(&device->io_lock);304295305296done:297297+ blk_finish_plug(&plug);306298 return 0;307299}308300
···13311331}1332133213331333/*13341334- * Mark caps dirty. If inode is newly dirty, add to the global dirty13351335- * list.13341334+ * Mark caps dirty. If inode is newly dirty, return the dirty flags.13351335+ * Caller is then responsible for calling __mark_inode_dirty with the13361336+ * returned flags value.13361337 */13371337-void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask)13381338+int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask)13381339{13391340 struct ceph_mds_client *mdsc =13401341 ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;···13581357 list_add(&ci->i_dirty_item, &mdsc->cap_dirty);13591358 spin_unlock(&mdsc->cap_dirty_lock);13601359 if (ci->i_flushing_caps == 0) {13611361- igrab(inode);13601360+ ihold(inode);13621361 dirty |= I_DIRTY_SYNC;13631362 }13641363 }···13661365 if (((was | ci->i_flushing_caps) & CEPH_CAP_FILE_BUFFER) &&13671366 (mask & CEPH_CAP_FILE_BUFFER))13681367 dirty |= I_DIRTY_DATASYNC;13691369- if (dirty)13701370- __mark_inode_dirty(inode, dirty);13711368 __cap_delay_requeue(mdsc, ci);13691369+ return dirty;13721370}1373137113741372/*···19911991 ci->i_wr_ref++;19921992 if (got & CEPH_CAP_FILE_BUFFER) {19931993 if (ci->i_wrbuffer_ref == 0)19941994- igrab(&ci->vfs_inode);19941994+ ihold(&ci->vfs_inode);19951995 ci->i_wrbuffer_ref++;19961996 dout("__take_cap_refs %p wrbuffer %d -> %d (?)\n",19971997 &ci->vfs_inode, ci->i_wrbuffer_ref-1, ci->i_wrbuffer_ref);
+4-1
fs/ceph/file.c
···734734 }735735 }736736 if (ret >= 0) {737737+ int dirty;737738 spin_lock(&inode->i_lock);738738- __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR);739739+ dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_FILE_WR);739740 spin_unlock(&inode->i_lock);741741+ if (dirty)742742+ __mark_inode_dirty(inode, dirty);740743 }741744742745out:
+5-1
fs/ceph/inode.c
···15671567 int release = 0, dirtied = 0;15681568 int mask = 0;15691569 int err = 0;15701570+ int inode_dirty_flags = 0;1570157115711572 if (ceph_snap(inode) != CEPH_NOSNAP)15721573 return -EROFS;···17261725 dout("setattr %p ATTR_FILE ... hrm!\n", inode);1727172617281727 if (dirtied) {17291729- __ceph_mark_dirty_caps(ci, dirtied);17281728+ inode_dirty_flags = __ceph_mark_dirty_caps(ci, dirtied);17301729 inode->i_ctime = CURRENT_TIME;17311730 }1732173117331732 release &= issued;17341733 spin_unlock(&inode->i_lock);17341734+17351735+ if (inode_dirty_flags)17361736+ __mark_inode_dirty(inode, inode_dirty_flags);1735173717361738 if (mask) {17371739 req->r_inode = igrab(inode);
+1-1
fs/ceph/super.h
···506506{507507 return ci->i_dirty_caps | ci->i_flushing_caps;508508}509509-extern void __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask);509509+extern int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask);510510511511extern int ceph_caps_revoking(struct ceph_inode_info *ci, int mask);512512extern int __ceph_caps_used(struct ceph_inode_info *ci);
+8-4
fs/ceph/xattr.c
···703703 struct ceph_inode_xattr *xattr = NULL;704704 int issued;705705 int required_blob_size;706706+ int dirty;706707707708 if (ceph_snap(inode) != CEPH_NOSNAP)708709 return -EROFS;···764763 dout("setxattr %p issued %s\n", inode, ceph_cap_string(issued));765764 err = __set_xattr(ci, newname, name_len, newval,766765 val_len, 1, 1, 1, &xattr);767767- __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL);766766+ dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL);768767 ci->i_xattrs.dirty = true;769768 inode->i_ctime = CURRENT_TIME;770769 spin_unlock(&inode->i_lock);771771-770770+ if (dirty)771771+ __mark_inode_dirty(inode, dirty);772772 return err;773773774774do_sync:···812810 struct ceph_vxattr_cb *vxattrs = ceph_inode_vxattrs(inode);813811 int issued;814812 int err;813813+ int dirty;815814816815 if (ceph_snap(inode) != CEPH_NOSNAP)817816 return -EROFS;···836833 goto do_sync;837834838835 err = __remove_xattr_by_name(ceph_inode(inode), name);839839- __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL);836836+ dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL);840837 ci->i_xattrs.dirty = true;841838 inode->i_ctime = CURRENT_TIME;842839843840 spin_unlock(&inode->i_lock);844844-841841+ if (dirty)842842+ __mark_inode_dirty(inode, dirty);845843 return err;846844do_sync:847845 spin_unlock(&inode->i_lock);
+71-56
fs/cifs/connect.c
···274274 char *data_area_of_target;275275 char *data_area_of_buf2;276276 int remaining;277277- __u16 byte_count, total_data_size, total_in_buf, total_in_buf2;277277+ unsigned int byte_count, total_in_buf;278278+ __u16 total_data_size, total_in_buf2;278279279280 total_data_size = get_unaligned_le16(&pSMBt->t2_rsp.TotalDataCount);280281···288287 remaining = total_data_size - total_in_buf;289288290289 if (remaining < 0)291291- return -EINVAL;290290+ return -EPROTO;292291293292 if (remaining == 0) /* nothing to do, ignore */294293 return 0;···309308 data_area_of_target += total_in_buf;310309311310 /* copy second buffer into end of first buffer */312312- memcpy(data_area_of_target, data_area_of_buf2, total_in_buf2);313311 total_in_buf += total_in_buf2;312312+ /* is the result too big for the field? */313313+ if (total_in_buf > USHRT_MAX)314314+ return -EPROTO;314315 put_unaligned_le16(total_in_buf, &pSMBt->t2_rsp.DataCount);316316+317317+ /* fix up the BCC */315318 byte_count = get_bcc_le(pTargetSMB);316319 byte_count += total_in_buf2;320320+ /* is the result too big for the field? */321321+ if (byte_count > USHRT_MAX)322322+ return -EPROTO;317323 put_bcc_le(byte_count, pTargetSMB);318324319325 byte_count = pTargetSMB->smb_buf_length;320326 byte_count += total_in_buf2;321321-322322- /* BB also add check that we are not beyond maximum buffer size */323323-327327+ /* don't allow buffer to overflow */328328+ if (byte_count > CIFSMaxBufSize)329329+ return -ENOBUFS;324330 pTargetSMB->smb_buf_length = byte_count;331331+332332+ memcpy(data_area_of_target, data_area_of_buf2, total_in_buf2);325333326334 if (remaining == total_in_buf2) {327335 cFYI(1, "found the last secondary response");···617607 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {618608 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);619609620620- if ((mid_entry->mid == smb_buffer->Mid) &&621621- (mid_entry->midState == MID_REQUEST_SUBMITTED) &&622622- (mid_entry->command == smb_buffer->Command)) {623623- if (length == 0 &&624624- check2ndT2(smb_buffer, server->maxBuf) > 0) {625625- /* We have a multipart transact2 resp */626626- isMultiRsp = true;627627- if (mid_entry->resp_buf) {628628- /* merge response - fix up 1st*/629629- if (coalesce_t2(smb_buffer,630630- mid_entry->resp_buf)) {631631- mid_entry->multiRsp =632632- true;633633- break;634634- } else {635635- /* all parts received */636636- mid_entry->multiEnd =637637- true;638638- goto multi_t2_fnd;639639- }610610+ if (mid_entry->mid != smb_buffer->Mid ||611611+ mid_entry->midState != MID_REQUEST_SUBMITTED ||612612+ mid_entry->command != smb_buffer->Command) {613613+ mid_entry = NULL;614614+ continue;615615+ }616616+617617+ if (length == 0 &&618618+ check2ndT2(smb_buffer, server->maxBuf) > 0) {619619+ /* We have a multipart transact2 resp */620620+ isMultiRsp = true;621621+ if (mid_entry->resp_buf) {622622+ /* merge response - fix up 1st*/623623+ length = coalesce_t2(smb_buffer,624624+ mid_entry->resp_buf);625625+ if (length > 0) {626626+ length = 0;627627+ mid_entry->multiRsp = true;628628+ break;640629 } else {641641- if (!isLargeBuf) {642642- cERROR(1, "1st trans2 resp needs bigbuf");643643- /* BB maybe we can fix this up, switch644644- to already allocated large buffer? */645645- } else {646646- /* Have first buffer */647647- mid_entry->resp_buf =648648- smb_buffer;649649- mid_entry->largeBuf =650650- true;651651- bigbuf = NULL;652652- }630630+ /* all parts received or631631+ * packet is malformed632632+ */633633+ mid_entry->multiEnd = true;634634+ goto multi_t2_fnd;653635 }654654- break;636636+ } else {637637+ if (!isLargeBuf) {638638+ /*639639+ * FIXME: switch to already640640+ * allocated largebuf?641641+ */642642+ cERROR(1, "1st trans2 resp "643643+ "needs bigbuf");644644+ } else {645645+ /* Have first buffer */646646+ mid_entry->resp_buf =647647+ smb_buffer;648648+ mid_entry->largeBuf = true;649649+ bigbuf = NULL;650650+ }655651 }656656- mid_entry->resp_buf = smb_buffer;657657- mid_entry->largeBuf = isLargeBuf;658658-multi_t2_fnd:659659- if (length == 0)660660- mid_entry->midState =661661- MID_RESPONSE_RECEIVED;662662- else663663- mid_entry->midState =664664- MID_RESPONSE_MALFORMED;665665-#ifdef CONFIG_CIFS_STATS2666666- mid_entry->when_received = jiffies;667667-#endif668668- list_del_init(&mid_entry->qhead);669669- mid_entry->callback(mid_entry);670652 break;671653 }672672- mid_entry = NULL;654654+ mid_entry->resp_buf = smb_buffer;655655+ mid_entry->largeBuf = isLargeBuf;656656+multi_t2_fnd:657657+ if (length == 0)658658+ mid_entry->midState = MID_RESPONSE_RECEIVED;659659+ else660660+ mid_entry->midState = MID_RESPONSE_MALFORMED;661661+#ifdef CONFIG_CIFS_STATS2662662+ mid_entry->when_received = jiffies;663663+#endif664664+ list_del_init(&mid_entry->qhead);665665+ mid_entry->callback(mid_entry);666666+ break;673667 }674668 spin_unlock(&GlobalMid_Lock);675669···821807cifs_parse_mount_options(char *options, const char *devname,822808 struct smb_vol *vol)823809{824824- char *value;825825- char *data;810810+ char *value, *data, *end;826811 unsigned int temp_len, i, j;827812 char separator[2];828813 short int override_uid = -1;···864851 if (!options)865852 return 1;866853854854+ end = options + strlen(options);867855 if (strncmp(options, "sep=", 4) == 0) {868856 if (options[4] != 0) {869857 separator[0] = options[4];···930916 the only illegal character in a password is null */931917932918 if ((value[temp_len] == 0) &&919919+ (value + temp_len < end) &&933920 (value[temp_len+1] == separator[0])) {934921 /* reinsert comma */935922 value[temp_len] = separator[0];
+4-15
fs/cifs/sess.c
···276276}277277278278static void279279-decode_unicode_ssetup(char **pbcc_area, __u16 bleft, struct cifsSesInfo *ses,279279+decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifsSesInfo *ses,280280 const struct nls_table *nls_cp)281281{282282 int len;283283 char *data = *pbcc_area;284284285285 cFYI(1, "bleft %d", bleft);286286-287287- /*288288- * Windows servers do not always double null terminate their final289289- * Unicode string. Check to see if there are an uneven number of bytes290290- * left. If so, then add an extra NULL pad byte to the end of the291291- * response.292292- *293293- * See section 2.7.2 in "Implementing CIFS" for details294294- */295295- if (bleft % 2) {296296- data[bleft] = 0;297297- ++bleft;298298- }299286300287 kfree(ses->serverOS);301288 ses->serverOS = cifs_strndup_from_ucs(data, bleft, true, nls_cp);···916929 }917930918931 /* BB check if Unicode and decode strings */919919- if (smb_buf->Flags2 & SMBFLG2_UNICODE) {932932+ if (bytes_remaining == 0) {933933+ /* no string area to decode, do nothing */934934+ } else if (smb_buf->Flags2 & SMBFLG2_UNICODE) {920935 /* unicode string area must be word-aligned */921936 if (((unsigned long) bcc_ptr - (unsigned long) smb_buf) % 2) {922937 ++bcc_ptr;
+11-7
fs/file.c
···99#include <linux/module.h>1010#include <linux/fs.h>1111#include <linux/mm.h>1212+#include <linux/mmzone.h>1213#include <linux/time.h>1314#include <linux/sched.h>1415#include <linux/slab.h>···4039 */4140static DEFINE_PER_CPU(struct fdtable_defer, fdtable_defer_list);42414343-static inline void *alloc_fdmem(unsigned int size)4242+static void *alloc_fdmem(unsigned int size)4443{4545- void *data;4646-4747- data = kmalloc(size, GFP_KERNEL|__GFP_NOWARN);4848- if (data != NULL)4949- return data;5050-4444+ /*4545+ * Very large allocations can stress page reclaim, so fall back to4646+ * vmalloc() if the allocation size will be considered "large" by the VM.4747+ */4848+ if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) {4949+ void *data = kmalloc(size, GFP_KERNEL|__GFP_NOWARN);5050+ if (data != NULL)5151+ return data;5252+ }5153 return vmalloc(size);5254}5355
-1
fs/hpfs/Kconfig
···11config HPFS_FS22 tristate "OS/2 HPFS file system support"33 depends on BLOCK44- depends on BROKEN || !PREEMPT54 help65 OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS76 is the file system used for organizing files on OS/2 hard disk
+43-75
fs/hpfs/alloc.c
···8899#include "hpfs_fn.h"10101111-static int hpfs_alloc_if_possible_nolock(struct super_block *s, secno sec);1212-1311/*1412 * Check if a sector is allocated in bitmap1513 * This is really slow. Turned on only if chk==2···1618static int chk_if_allocated(struct super_block *s, secno sec, char *msg)1719{1820 struct quad_buffer_head qbh;1919- unsigned *bmp;2121+ u32 *bmp;2022 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "chk"))) goto fail;2121- if ((bmp[(sec & 0x3fff) >> 5] >> (sec & 0x1f)) & 1) {2323+ if ((cpu_to_le32(bmp[(sec & 0x3fff) >> 5]) >> (sec & 0x1f)) & 1) {2224 hpfs_error(s, "sector '%s' - %08x not allocated in bitmap", msg, sec);2325 goto fail1;2426 }···2628 if (sec >= hpfs_sb(s)->sb_dirband_start && sec < hpfs_sb(s)->sb_dirband_start + hpfs_sb(s)->sb_dirband_size) {2729 unsigned ssec = (sec - hpfs_sb(s)->sb_dirband_start) / 4;2830 if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) goto fail;2929- if ((bmp[ssec >> 5] >> (ssec & 0x1f)) & 1) {3131+ if ((le32_to_cpu(bmp[ssec >> 5]) >> (ssec & 0x1f)) & 1) {3032 hpfs_error(s, "sector '%s' - %08x not allocated in directory bitmap", msg, sec);3133 goto fail1;3234 }···7375 hpfs_error(s, "Bad allocation size: %d", n);7476 return 0;7577 }7676- lock_super(s);7778 if (bs != ~0x3fff) {7879 if (!(bmp = hpfs_map_bitmap(s, near >> 14, &qbh, "aib"))) goto uls;7980 } else {···8285 ret = bs + nr;8386 goto rt;8487 }8585- /*if (!tstbits(bmp, nr + n, n + forward)) {8686- ret = bs + nr + n;8787- goto rt;8888- }*/8988 q = nr + n; b = 0;9089 while ((a = tstbits(bmp, q, n + forward)) != 0) {9190 q += a;···98105 goto rt;99106 }100107 nr >>= 5;101101- /*for (i = nr + 1; i != nr; i++, i &= 0x1ff) {*/108108+ /*for (i = nr + 1; i != nr; i++, i &= 0x1ff) */102109 i = nr;103110 do {104104- if (!bmp[i]) goto cont;105105- if (n + forward >= 0x3f && bmp[i] != -1) goto cont;111111+ if (!le32_to_cpu(bmp[i])) goto cont;112112+ if (n + forward >= 0x3f && le32_to_cpu(bmp[i]) != 0xffffffff) goto cont;106113 q = i<<5;107114 if (i > 0) {108108- unsigned k = bmp[i-1];115115+ unsigned k = le32_to_cpu(bmp[i-1]);109116 while (k & 0x80000000) {110117 q--; k <<= 1;111118 }···125132 } while (i != nr);126133 rt:127134 if (ret) {128128- if (hpfs_sb(s)->sb_chk && ((ret >> 14) != (bs >> 14) || (bmp[(ret & 0x3fff) >> 5] | ~(((1 << n) - 1) << (ret & 0x1f))) != 0xffffffff)) {135135+ if (hpfs_sb(s)->sb_chk && ((ret >> 14) != (bs >> 14) || (le32_to_cpu(bmp[(ret & 0x3fff) >> 5]) | ~(((1 << n) - 1) << (ret & 0x1f))) != 0xffffffff)) {129136 hpfs_error(s, "Allocation doesn't work! Wanted %d, allocated at %08x", n, ret);130137 ret = 0;131138 goto b;132139 }133133- bmp[(ret & 0x3fff) >> 5] &= ~(((1 << n) - 1) << (ret & 0x1f));140140+ bmp[(ret & 0x3fff) >> 5] &= cpu_to_le32(~(((1 << n) - 1) << (ret & 0x1f)));134141 hpfs_mark_4buffers_dirty(&qbh);135142 }136143 b:137144 hpfs_brelse4(&qbh);138145 uls:139139- unlock_super(s);140146 return ret;141147}142148···147155 * sectors148156 */149157150150-secno hpfs_alloc_sector(struct super_block *s, secno near, unsigned n, int forward, int lock)158158+secno hpfs_alloc_sector(struct super_block *s, secno near, unsigned n, int forward)151159{152160 secno sec;153161 int i;···159167 forward = -forward;160168 f_p = 1;161169 }162162- if (lock) hpfs_lock_creation(s);163170 n_bmps = (sbi->sb_fs_size + 0x4000 - 1) >> 14;164171 if (near && near < sbi->sb_fs_size) {165172 if ((sec = alloc_in_bmp(s, near, n, f_p ? forward : forward/4))) goto ret;···205214 ret:206215 if (sec && f_p) {207216 for (i = 0; i < forward; i++) {208208- if (!hpfs_alloc_if_possible_nolock(s, sec + i + 1)) {217217+ if (!hpfs_alloc_if_possible(s, sec + i + 1)) {209218 hpfs_error(s, "Prealloc doesn't work! Wanted %d, allocated at %08x, can't allocate %d", forward, sec, i);210219 sec = 0;211220 break;212221 }213222 }214223 }215215- if (lock) hpfs_unlock_creation(s);216224 return sec;217225}218226219219-static secno alloc_in_dirband(struct super_block *s, secno near, int lock)227227+static secno alloc_in_dirband(struct super_block *s, secno near)220228{221229 unsigned nr = near;222230 secno sec;···226236 nr = sbi->sb_dirband_start + sbi->sb_dirband_size - 4;227237 nr -= sbi->sb_dirband_start;228238 nr >>= 2;229229- if (lock) hpfs_lock_creation(s);230239 sec = alloc_in_bmp(s, (~0x3fff) | nr, 1, 0);231231- if (lock) hpfs_unlock_creation(s);232240 if (!sec) return 0;233241 return ((sec & 0x3fff) << 2) + sbi->sb_dirband_start;234242}235243236244/* Alloc sector if it's free */237245238238-static int hpfs_alloc_if_possible_nolock(struct super_block *s, secno sec)246246+int hpfs_alloc_if_possible(struct super_block *s, secno sec)239247{240248 struct quad_buffer_head qbh;241241- unsigned *bmp;242242- lock_super(s);249249+ u32 *bmp;243250 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "aip"))) goto end;244244- if (bmp[(sec & 0x3fff) >> 5] & (1 << (sec & 0x1f))) {245245- bmp[(sec & 0x3fff) >> 5] &= ~(1 << (sec & 0x1f));251251+ if (le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) & (1 << (sec & 0x1f))) {252252+ bmp[(sec & 0x3fff) >> 5] &= cpu_to_le32(~(1 << (sec & 0x1f)));246253 hpfs_mark_4buffers_dirty(&qbh);247254 hpfs_brelse4(&qbh);248248- unlock_super(s);249255 return 1;250256 }251257 hpfs_brelse4(&qbh);252258 end:253253- unlock_super(s);254259 return 0;255255-}256256-257257-int hpfs_alloc_if_possible(struct super_block *s, secno sec)258258-{259259- int r;260260- hpfs_lock_creation(s);261261- r = hpfs_alloc_if_possible_nolock(s, sec);262262- hpfs_unlock_creation(s);263263- return r;264260}265261266262/* Free sectors in bitmaps */···254278void hpfs_free_sectors(struct super_block *s, secno sec, unsigned n)255279{256280 struct quad_buffer_head qbh;257257- unsigned *bmp;281281+ u32 *bmp;258282 struct hpfs_sb_info *sbi = hpfs_sb(s);259283 /*printk("2 - ");*/260284 if (!n) return;···262286 hpfs_error(s, "Trying to free reserved sector %08x", sec);263287 return;264288 }265265- lock_super(s);266289 sbi->sb_max_fwd_alloc += n > 0xffff ? 0xffff : n;267290 if (sbi->sb_max_fwd_alloc > 0xffffff) sbi->sb_max_fwd_alloc = 0xffffff;268291 new_map:269292 if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "free"))) {270270- unlock_super(s);271293 return;272294 } 273295 new_tst:274274- if ((bmp[(sec & 0x3fff) >> 5] >> (sec & 0x1f) & 1)) {296296+ if ((le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) >> (sec & 0x1f) & 1)) {275297 hpfs_error(s, "sector %08x not allocated", sec);276298 hpfs_brelse4(&qbh);277277- unlock_super(s);278299 return;279300 }280280- bmp[(sec & 0x3fff) >> 5] |= 1 << (sec & 0x1f);301301+ bmp[(sec & 0x3fff) >> 5] |= cpu_to_le32(1 << (sec & 0x1f));281302 if (!--n) {282303 hpfs_mark_4buffers_dirty(&qbh);283304 hpfs_brelse4(&qbh);284284- unlock_super(s);285305 return;286306 } 287307 if (!(++sec & 0x3fff)) {···299327 int n_bmps = (hpfs_sb(s)->sb_fs_size + 0x4000 - 1) >> 14;300328 int b = hpfs_sb(s)->sb_c_bitmap & 0x0fffffff;301329 int i, j;302302- unsigned *bmp;330330+ u32 *bmp;303331 struct quad_buffer_head qbh;304332 if ((bmp = hpfs_map_dnode_bitmap(s, &qbh))) {305333 for (j = 0; j < 512; j++) {306334 unsigned k;307307- if (!bmp[j]) continue;308308- for (k = bmp[j]; k; k >>= 1) if (k & 1) if (!--n) {335335+ if (!le32_to_cpu(bmp[j])) continue;336336+ for (k = le32_to_cpu(bmp[j]); k; k >>= 1) if (k & 1) if (!--n) {309337 hpfs_brelse4(&qbh);310338 return 0;311339 }···324352 chk_bmp:325353 if (bmp) {326354 for (j = 0; j < 512; j++) {327327- unsigned k;328328- if (!bmp[j]) continue;355355+ u32 k;356356+ if (!le32_to_cpu(bmp[j])) continue;329357 for (k = 0xf; k; k <<= 4)330330- if ((bmp[j] & k) == k) {358358+ if ((le32_to_cpu(bmp[j]) & k) == k) {331359 if (!--n) {332360 hpfs_brelse4(&qbh);333361 return 0;···351379 hpfs_free_sectors(s, dno, 4);352380 } else {353381 struct quad_buffer_head qbh;354354- unsigned *bmp;382382+ u32 *bmp;355383 unsigned ssec = (dno - hpfs_sb(s)->sb_dirband_start) / 4;356356- lock_super(s);357384 if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) {358358- unlock_super(s);359385 return;360386 }361361- bmp[ssec >> 5] |= 1 << (ssec & 0x1f);387387+ bmp[ssec >> 5] |= cpu_to_le32(1 << (ssec & 0x1f));362388 hpfs_mark_4buffers_dirty(&qbh);363389 hpfs_brelse4(&qbh);364364- unlock_super(s);365390 }366391}367392368393struct dnode *hpfs_alloc_dnode(struct super_block *s, secno near,369369- dnode_secno *dno, struct quad_buffer_head *qbh,370370- int lock)394394+ dnode_secno *dno, struct quad_buffer_head *qbh)371395{372396 struct dnode *d;373397 if (hpfs_count_one_bitmap(s, hpfs_sb(s)->sb_dmap) > FREE_DNODES_ADD) {374374- if (!(*dno = alloc_in_dirband(s, near, lock)))375375- if (!(*dno = hpfs_alloc_sector(s, near, 4, 0, lock))) return NULL;398398+ if (!(*dno = alloc_in_dirband(s, near)))399399+ if (!(*dno = hpfs_alloc_sector(s, near, 4, 0))) return NULL;376400 } else {377377- if (!(*dno = hpfs_alloc_sector(s, near, 4, 0, lock)))378378- if (!(*dno = alloc_in_dirband(s, near, lock))) return NULL;401401+ if (!(*dno = hpfs_alloc_sector(s, near, 4, 0)))402402+ if (!(*dno = alloc_in_dirband(s, near))) return NULL;379403 }380404 if (!(d = hpfs_get_4sectors(s, *dno, qbh))) {381405 hpfs_free_dnode(s, *dno);382406 return NULL;383407 }384408 memset(d, 0, 2048);385385- d->magic = DNODE_MAGIC;386386- d->first_free = 52;409409+ d->magic = cpu_to_le32(DNODE_MAGIC);410410+ d->first_free = cpu_to_le32(52);387411 d->dirent[0] = 32;388412 d->dirent[2] = 8;389413 d->dirent[30] = 1;390414 d->dirent[31] = 255;391391- d->self = *dno;415415+ d->self = cpu_to_le32(*dno);392416 return d;393417}394418···392424 struct buffer_head **bh)393425{394426 struct fnode *f;395395- if (!(*fno = hpfs_alloc_sector(s, near, 1, FNODE_ALLOC_FWD, 1))) return NULL;427427+ if (!(*fno = hpfs_alloc_sector(s, near, 1, FNODE_ALLOC_FWD))) return NULL;396428 if (!(f = hpfs_get_sector(s, *fno, bh))) {397429 hpfs_free_sectors(s, *fno, 1);398430 return NULL;399431 } 400432 memset(f, 0, 512);401401- f->magic = FNODE_MAGIC;402402- f->ea_offs = 0xc4;433433+ f->magic = cpu_to_le32(FNODE_MAGIC);434434+ f->ea_offs = cpu_to_le16(0xc4);403435 f->btree.n_free_nodes = 8;404404- f->btree.first_free = 8;436436+ f->btree.first_free = cpu_to_le16(8);405437 return f;406438}407439···409441 struct buffer_head **bh)410442{411443 struct anode *a;412412- if (!(*ano = hpfs_alloc_sector(s, near, 1, ANODE_ALLOC_FWD, 1))) return NULL;444444+ if (!(*ano = hpfs_alloc_sector(s, near, 1, ANODE_ALLOC_FWD))) return NULL;413445 if (!(a = hpfs_get_sector(s, *ano, bh))) {414446 hpfs_free_sectors(s, *ano, 1);415447 return NULL;416448 }417449 memset(a, 0, 512);418418- a->magic = ANODE_MAGIC;419419- a->self = *ano;450450+ a->magic = cpu_to_le32(ANODE_MAGIC);451451+ a->self = cpu_to_le32(*ano);420452 a->btree.n_free_nodes = 40;421453 a->btree.n_used_nodes = 0;422422- a->btree.first_free = 8;454454+ a->btree.first_free = cpu_to_le16(8);423455 return a;424456}
+69-69
fs/hpfs/anode.c
···2222 if (hpfs_sb(s)->sb_chk) if (hpfs_stop_cycles(s, a, &c1, &c2, "hpfs_bplus_lookup")) return -1;2323 if (btree->internal) {2424 for (i = 0; i < btree->n_used_nodes; i++)2525- if (btree->u.internal[i].file_secno > sec) {2626- a = btree->u.internal[i].down;2525+ if (le32_to_cpu(btree->u.internal[i].file_secno) > sec) {2626+ a = le32_to_cpu(btree->u.internal[i].down);2727 brelse(bh);2828 if (!(anode = hpfs_map_anode(s, a, &bh))) return -1;2929 btree = &anode->btree;···3434 return -1;3535 }3636 for (i = 0; i < btree->n_used_nodes; i++)3737- if (btree->u.external[i].file_secno <= sec &&3838- btree->u.external[i].file_secno + btree->u.external[i].length > sec) {3939- a = btree->u.external[i].disk_secno + sec - btree->u.external[i].file_secno;3737+ if (le32_to_cpu(btree->u.external[i].file_secno) <= sec &&3838+ le32_to_cpu(btree->u.external[i].file_secno) + le32_to_cpu(btree->u.external[i].length) > sec) {3939+ a = le32_to_cpu(btree->u.external[i].disk_secno) + sec - le32_to_cpu(btree->u.external[i].file_secno);4040 if (hpfs_sb(s)->sb_chk) if (hpfs_chk_sectors(s, a, 1, "data")) {4141 brelse(bh);4242 return -1;4343 }4444 if (inode) {4545 struct hpfs_inode_info *hpfs_inode = hpfs_i(inode);4646- hpfs_inode->i_file_sec = btree->u.external[i].file_secno;4747- hpfs_inode->i_disk_sec = btree->u.external[i].disk_secno;4848- hpfs_inode->i_n_secs = btree->u.external[i].length;4646+ hpfs_inode->i_file_sec = le32_to_cpu(btree->u.external[i].file_secno);4747+ hpfs_inode->i_disk_sec = le32_to_cpu(btree->u.external[i].disk_secno);4848+ hpfs_inode->i_n_secs = le32_to_cpu(btree->u.external[i].length);4949 }5050 brelse(bh);5151 return a;···8383 return -1;8484 }8585 if (btree->internal) {8686- a = btree->u.internal[n].down;8787- btree->u.internal[n].file_secno = -1;8686+ a = le32_to_cpu(btree->u.internal[n].down);8787+ btree->u.internal[n].file_secno = cpu_to_le32(-1);8888 mark_buffer_dirty(bh);8989 brelse(bh);9090 if (hpfs_sb(s)->sb_chk)···9494 goto go_down;9595 }9696 if (n >= 0) {9797- if (btree->u.external[n].file_secno + btree->u.external[n].length != fsecno) {9797+ if (le32_to_cpu(btree->u.external[n].file_secno) + le32_to_cpu(btree->u.external[n].length) != fsecno) {9898 hpfs_error(s, "allocated size %08x, trying to add sector %08x, %cnode %08x",9999- btree->u.external[n].file_secno + btree->u.external[n].length, fsecno,9999+ le32_to_cpu(btree->u.external[n].file_secno) + le32_to_cpu(btree->u.external[n].length), fsecno,100100 fnod?'f':'a', node);101101 brelse(bh);102102 return -1;103103 }104104- if (hpfs_alloc_if_possible(s, se = btree->u.external[n].disk_secno + btree->u.external[n].length)) {105105- btree->u.external[n].length++;104104+ if (hpfs_alloc_if_possible(s, se = le32_to_cpu(btree->u.external[n].disk_secno) + le32_to_cpu(btree->u.external[n].length))) {105105+ btree->u.external[n].length = cpu_to_le32(le32_to_cpu(btree->u.external[n].length) + 1);106106 mark_buffer_dirty(bh);107107 brelse(bh);108108 return se;···115115 }116116 se = !fnod ? node : (node + 16384) & ~16383;117117 } 118118- if (!(se = hpfs_alloc_sector(s, se, 1, fsecno*ALLOC_M>ALLOC_FWD_MAX ? ALLOC_FWD_MAX : fsecno*ALLOC_M<ALLOC_FWD_MIN ? ALLOC_FWD_MIN : fsecno*ALLOC_M, 1))) {118118+ if (!(se = hpfs_alloc_sector(s, se, 1, fsecno*ALLOC_M>ALLOC_FWD_MAX ? ALLOC_FWD_MAX : fsecno*ALLOC_M<ALLOC_FWD_MIN ? ALLOC_FWD_MIN : fsecno*ALLOC_M))) {119119 brelse(bh);120120 return -1;121121 }122122- fs = n < 0 ? 0 : btree->u.external[n].file_secno + btree->u.external[n].length;122122+ fs = n < 0 ? 0 : le32_to_cpu(btree->u.external[n].file_secno) + le32_to_cpu(btree->u.external[n].length);123123 if (!btree->n_free_nodes) {124124- up = a != node ? anode->up : -1;124124+ up = a != node ? le32_to_cpu(anode->up) : -1;125125 if (!(anode = hpfs_alloc_anode(s, a, &na, &bh1))) {126126 brelse(bh);127127 hpfs_free_sectors(s, se, 1);128128 return -1;129129 }130130 if (a == node && fnod) {131131- anode->up = node;131131+ anode->up = cpu_to_le32(node);132132 anode->btree.fnode_parent = 1;133133 anode->btree.n_used_nodes = btree->n_used_nodes;134134 anode->btree.first_free = btree->first_free;···137137 btree->internal = 1;138138 btree->n_free_nodes = 11;139139 btree->n_used_nodes = 1;140140- btree->first_free = (char *)&(btree->u.internal[1]) - (char *)btree;141141- btree->u.internal[0].file_secno = -1;142142- btree->u.internal[0].down = na;140140+ btree->first_free = cpu_to_le16((char *)&(btree->u.internal[1]) - (char *)btree);141141+ btree->u.internal[0].file_secno = cpu_to_le32(-1);142142+ btree->u.internal[0].down = cpu_to_le32(na);143143 mark_buffer_dirty(bh);144144 } else if (!(ranode = hpfs_alloc_anode(s, /*a*/0, &ra, &bh2))) {145145 brelse(bh);···153153 btree = &anode->btree;154154 }155155 btree->n_free_nodes--; n = btree->n_used_nodes++;156156- btree->first_free += 12;157157- btree->u.external[n].disk_secno = se;158158- btree->u.external[n].file_secno = fs;159159- btree->u.external[n].length = 1;156156+ btree->first_free = cpu_to_le16(le16_to_cpu(btree->first_free) + 12);157157+ btree->u.external[n].disk_secno = cpu_to_le32(se);158158+ btree->u.external[n].file_secno = cpu_to_le32(fs);159159+ btree->u.external[n].length = cpu_to_le32(1);160160 mark_buffer_dirty(bh);161161 brelse(bh);162162 if ((a == node && fnod) || na == -1) return se;163163 c2 = 0;164164- while (up != -1) {164164+ while (up != (anode_secno)-1) {165165 struct anode *new_anode;166166 if (hpfs_sb(s)->sb_chk)167167 if (hpfs_stop_cycles(s, up, &c1, &c2, "hpfs_add_sector_to_btree #2")) return -1;···174174 }175175 if (btree->n_free_nodes) {176176 btree->n_free_nodes--; n = btree->n_used_nodes++;177177- btree->first_free += 8;178178- btree->u.internal[n].file_secno = -1;179179- btree->u.internal[n].down = na;180180- btree->u.internal[n-1].file_secno = fs;177177+ btree->first_free = cpu_to_le16(le16_to_cpu(btree->first_free) + 8);178178+ btree->u.internal[n].file_secno = cpu_to_le32(-1);179179+ btree->u.internal[n].down = cpu_to_le32(na);180180+ btree->u.internal[n-1].file_secno = cpu_to_le32(fs);181181 mark_buffer_dirty(bh);182182 brelse(bh);183183 brelse(bh2);184184 hpfs_free_sectors(s, ra, 1);185185 if ((anode = hpfs_map_anode(s, na, &bh))) {186186- anode->up = up;186186+ anode->up = cpu_to_le32(up);187187 anode->btree.fnode_parent = up == node && fnod;188188 mark_buffer_dirty(bh);189189 brelse(bh);190190 }191191 return se;192192 }193193- up = up != node ? anode->up : -1;194194- btree->u.internal[btree->n_used_nodes - 1].file_secno = /*fs*/-1;193193+ up = up != node ? le32_to_cpu(anode->up) : -1;194194+ btree->u.internal[btree->n_used_nodes - 1].file_secno = cpu_to_le32(/*fs*/-1);195195 mark_buffer_dirty(bh);196196 brelse(bh);197197 a = na;198198 if ((new_anode = hpfs_alloc_anode(s, a, &na, &bh))) {199199 anode = new_anode;200200- /*anode->up = up != -1 ? up : ra;*/200200+ /*anode->up = cpu_to_le32(up != -1 ? up : ra);*/201201 anode->btree.internal = 1;202202 anode->btree.n_used_nodes = 1;203203 anode->btree.n_free_nodes = 59;204204- anode->btree.first_free = 16;205205- anode->btree.u.internal[0].down = a;206206- anode->btree.u.internal[0].file_secno = -1;204204+ anode->btree.first_free = cpu_to_le16(16);205205+ anode->btree.u.internal[0].down = cpu_to_le32(a);206206+ anode->btree.u.internal[0].file_secno = cpu_to_le32(-1);207207 mark_buffer_dirty(bh);208208 brelse(bh);209209 if ((anode = hpfs_map_anode(s, a, &bh))) {210210- anode->up = na;210210+ anode->up = cpu_to_le32(na);211211 mark_buffer_dirty(bh);212212 brelse(bh);213213 }214214 } else na = a;215215 }216216 if ((anode = hpfs_map_anode(s, na, &bh))) {217217- anode->up = node;217217+ anode->up = cpu_to_le32(node);218218 if (fnod) anode->btree.fnode_parent = 1;219219 mark_buffer_dirty(bh);220220 brelse(bh);···232232 }233233 btree = &fnode->btree;234234 }235235- ranode->up = node;236236- memcpy(&ranode->btree, btree, btree->first_free);235235+ ranode->up = cpu_to_le32(node);236236+ memcpy(&ranode->btree, btree, le16_to_cpu(btree->first_free));237237 if (fnod) ranode->btree.fnode_parent = 1;238238 ranode->btree.n_free_nodes = (ranode->btree.internal ? 60 : 40) - ranode->btree.n_used_nodes;239239 if (ranode->btree.internal) for (n = 0; n < ranode->btree.n_used_nodes; n++) {240240 struct anode *unode;241241- if ((unode = hpfs_map_anode(s, ranode->u.internal[n].down, &bh1))) {242242- unode->up = ra;241241+ if ((unode = hpfs_map_anode(s, le32_to_cpu(ranode->u.internal[n].down), &bh1))) {242242+ unode->up = cpu_to_le32(ra);243243 unode->btree.fnode_parent = 0;244244 mark_buffer_dirty(bh1);245245 brelse(bh1);···248248 btree->internal = 1;249249 btree->n_free_nodes = fnod ? 10 : 58;250250 btree->n_used_nodes = 2;251251- btree->first_free = (char *)&btree->u.internal[2] - (char *)btree;252252- btree->u.internal[0].file_secno = fs;253253- btree->u.internal[0].down = ra;254254- btree->u.internal[1].file_secno = -1;255255- btree->u.internal[1].down = na;251251+ btree->first_free = cpu_to_le16((char *)&btree->u.internal[2] - (char *)btree);252252+ btree->u.internal[0].file_secno = cpu_to_le32(fs);253253+ btree->u.internal[0].down = cpu_to_le32(ra);254254+ btree->u.internal[1].file_secno = cpu_to_le32(-1);255255+ btree->u.internal[1].down = cpu_to_le32(na);256256 mark_buffer_dirty(bh);257257 brelse(bh);258258 mark_buffer_dirty(bh2);···279279 go_down:280280 d2 = 0;281281 while (btree1->internal) {282282- ano = btree1->u.internal[pos].down;282282+ ano = le32_to_cpu(btree1->u.internal[pos].down);283283 if (level) brelse(bh);284284 if (hpfs_sb(s)->sb_chk)285285 if (hpfs_stop_cycles(s, ano, &d1, &d2, "hpfs_remove_btree #1"))···290290 pos = 0;291291 }292292 for (i = 0; i < btree1->n_used_nodes; i++)293293- hpfs_free_sectors(s, btree1->u.external[i].disk_secno, btree1->u.external[i].length);293293+ hpfs_free_sectors(s, le32_to_cpu(btree1->u.external[i].disk_secno), le32_to_cpu(btree1->u.external[i].length));294294 go_up:295295 if (!level) return;296296 brelse(bh);···298298 if (hpfs_stop_cycles(s, ano, &c1, &c2, "hpfs_remove_btree #2")) return;299299 hpfs_free_sectors(s, ano, 1);300300 oano = ano;301301- ano = anode->up;301301+ ano = le32_to_cpu(anode->up);302302 if (--level) {303303 if (!(anode = hpfs_map_anode(s, ano, &bh))) return;304304 btree1 = &anode->btree;305305 } else btree1 = btree;306306 for (i = 0; i < btree1->n_used_nodes; i++) {307307- if (btree1->u.internal[i].down == oano) {307307+ if (le32_to_cpu(btree1->u.internal[i].down) == oano) {308308 if ((pos = i + 1) < btree1->n_used_nodes)309309 goto go_down;310310 else···411411 if (fno) {412412 btree->n_free_nodes = 8;413413 btree->n_used_nodes = 0;414414- btree->first_free = 8;414414+ btree->first_free = cpu_to_le16(8);415415 btree->internal = 0;416416 mark_buffer_dirty(bh);417417 } else hpfs_free_sectors(s, f, 1);···421421 while (btree->internal) {422422 nodes = btree->n_used_nodes + btree->n_free_nodes;423423 for (i = 0; i < btree->n_used_nodes; i++)424424- if (btree->u.internal[i].file_secno >= secs) goto f;424424+ if (le32_to_cpu(btree->u.internal[i].file_secno) >= secs) goto f;425425 brelse(bh);426426 hpfs_error(s, "internal btree %08x doesn't end with -1", node);427427 return;428428 f:429429 for (j = i + 1; j < btree->n_used_nodes; j++)430430- hpfs_ea_remove(s, btree->u.internal[j].down, 1, 0);430430+ hpfs_ea_remove(s, le32_to_cpu(btree->u.internal[j].down), 1, 0);431431 btree->n_used_nodes = i + 1;432432 btree->n_free_nodes = nodes - btree->n_used_nodes;433433- btree->first_free = 8 + 8 * btree->n_used_nodes;433433+ btree->first_free = cpu_to_le16(8 + 8 * btree->n_used_nodes);434434 mark_buffer_dirty(bh);435435- if (btree->u.internal[i].file_secno == secs) {435435+ if (btree->u.internal[i].file_secno == cpu_to_le32(secs)) {436436 brelse(bh);437437 return;438438 }439439- node = btree->u.internal[i].down;439439+ node = le32_to_cpu(btree->u.internal[i].down);440440 brelse(bh);441441 if (hpfs_sb(s)->sb_chk)442442 if (hpfs_stop_cycles(s, node, &c1, &c2, "hpfs_truncate_btree"))···446446 } 447447 nodes = btree->n_used_nodes + btree->n_free_nodes;448448 for (i = 0; i < btree->n_used_nodes; i++)449449- if (btree->u.external[i].file_secno + btree->u.external[i].length >= secs) goto ff;449449+ if (le32_to_cpu(btree->u.external[i].file_secno) + le32_to_cpu(btree->u.external[i].length) >= secs) goto ff;450450 brelse(bh);451451 return;452452 ff:453453- if (secs <= btree->u.external[i].file_secno) {453453+ if (secs <= le32_to_cpu(btree->u.external[i].file_secno)) {454454 hpfs_error(s, "there is an allocation error in file %08x, sector %08x", f, secs);455455 if (i) i--;456456 }457457- else if (btree->u.external[i].file_secno + btree->u.external[i].length > secs) {458458- hpfs_free_sectors(s, btree->u.external[i].disk_secno + secs -459459- btree->u.external[i].file_secno, btree->u.external[i].length460460- - secs + btree->u.external[i].file_secno); /* I hope gcc optimizes this :-) */461461- btree->u.external[i].length = secs - btree->u.external[i].file_secno;457457+ else if (le32_to_cpu(btree->u.external[i].file_secno) + le32_to_cpu(btree->u.external[i].length) > secs) {458458+ hpfs_free_sectors(s, le32_to_cpu(btree->u.external[i].disk_secno) + secs -459459+ le32_to_cpu(btree->u.external[i].file_secno), le32_to_cpu(btree->u.external[i].length)460460+ - secs + le32_to_cpu(btree->u.external[i].file_secno)); /* I hope gcc optimizes this :-) */461461+ btree->u.external[i].length = cpu_to_le32(secs - le32_to_cpu(btree->u.external[i].file_secno));462462 }463463 for (j = i + 1; j < btree->n_used_nodes; j++)464464- hpfs_free_sectors(s, btree->u.external[j].disk_secno, btree->u.external[j].length);464464+ hpfs_free_sectors(s, le32_to_cpu(btree->u.external[j].disk_secno), le32_to_cpu(btree->u.external[j].length));465465 btree->n_used_nodes = i + 1;466466 btree->n_free_nodes = nodes - btree->n_used_nodes;467467- btree->first_free = 8 + 12 * btree->n_used_nodes;467467+ btree->first_free = cpu_to_le16(8 + 12 * btree->n_used_nodes);468468 mark_buffer_dirty(bh);469469 brelse(bh);470470}···480480 struct extended_attribute *ea_end;481481 if (!(fnode = hpfs_map_fnode(s, fno, &bh))) return;482482 if (!fnode->dirflag) hpfs_remove_btree(s, &fnode->btree);483483- else hpfs_remove_dtree(s, fnode->u.external[0].disk_secno);483483+ else hpfs_remove_dtree(s, le32_to_cpu(fnode->u.external[0].disk_secno));484484 ea_end = fnode_end_ea(fnode);485485 for (ea = fnode_ea(fnode); ea < ea_end; ea = next_ea(ea))486486 if (ea->indirect)487487 hpfs_ea_remove(s, ea_sec(ea), ea->anode, ea_len(ea));488488- hpfs_ea_ext_remove(s, fnode->ea_secno, fnode->ea_anode, fnode->ea_size_l);488488+ hpfs_ea_ext_remove(s, le32_to_cpu(fnode->ea_secno), fnode->ea_anode, le32_to_cpu(fnode->ea_size_l));489489 brelse(bh);490490 hpfs_free_sectors(s, fno, 1);491491}
+8-16
fs/hpfs/buffer.c
···99#include <linux/slab.h>1010#include "hpfs_fn.h"11111212-void hpfs_lock_creation(struct super_block *s)1313-{1414-#ifdef DEBUG_LOCKS1515- printk("lock creation\n");1616-#endif1717- mutex_lock(&hpfs_sb(s)->hpfs_creation_de);1818-}1919-2020-void hpfs_unlock_creation(struct super_block *s)2121-{2222-#ifdef DEBUG_LOCKS2323- printk("unlock creation\n");2424-#endif2525- mutex_unlock(&hpfs_sb(s)->hpfs_creation_de);2626-}2727-2812/* Map a sector into a buffer and return pointers to it and to the buffer. */29133014void *hpfs_map_sector(struct super_block *s, unsigned secno, struct buffer_head **bhp,3115 int ahead)3216{3317 struct buffer_head *bh;1818+1919+ hpfs_lock_assert(s);34203521 cond_resched();3622···3549{3650 struct buffer_head *bh;3751 /*return hpfs_map_sector(s, secno, bhp, 0);*/5252+5353+ hpfs_lock_assert(s);38543955 cond_resched();4056···5769{5870 struct buffer_head *bh;5971 char *data;7272+7373+ hpfs_lock_assert(s);60746175 cond_resched();6276···114124 struct quad_buffer_head *qbh)115125{116126 cond_resched();127127+128128+ hpfs_lock_assert(s);117129118130 if (secno & 3) {119131 printk("HPFS: hpfs_get_4sectors: unaligned read\n");
+10-12
fs/hpfs/dir.c
···8888 hpfs_error(inode->i_sb, "not a directory, fnode %08lx",8989 (unsigned long)inode->i_ino);9090 }9191- if (hpfs_inode->i_dno != fno->u.external[0].disk_secno) {9191+ if (hpfs_inode->i_dno != le32_to_cpu(fno->u.external[0].disk_secno)) {9292 e = 1;9393- hpfs_error(inode->i_sb, "corrupted inode: i_dno == %08x, fnode -> dnode == %08x", hpfs_inode->i_dno, fno->u.external[0].disk_secno);9393+ hpfs_error(inode->i_sb, "corrupted inode: i_dno == %08x, fnode -> dnode == %08x", hpfs_inode->i_dno, le32_to_cpu(fno->u.external[0].disk_secno));9494 }9595 brelse(bh);9696 if (e) {···156156 goto again;157157 }158158 tempname = hpfs_translate_name(inode->i_sb, de->name, de->namelen, lc, de->not_8x3);159159- if (filldir(dirent, tempname, de->namelen, old_pos, de->fnode, DT_UNKNOWN) < 0) {159159+ if (filldir(dirent, tempname, de->namelen, old_pos, le32_to_cpu(de->fnode), DT_UNKNOWN) < 0) {160160 filp->f_pos = old_pos;161161 if (tempname != de->name) kfree(tempname);162162 hpfs_brelse4(&qbh);···221221 * Get inode number, what we're after.222222 */223223224224- ino = de->fnode;224224+ ino = le32_to_cpu(de->fnode);225225226226 /*227227 * Go find or make an inode.···236236 hpfs_init_inode(result);237237 if (de->directory)238238 hpfs_read_inode(result);239239- else if (de->ea_size && hpfs_sb(dir->i_sb)->sb_eas)239239+ else if (le32_to_cpu(de->ea_size) && hpfs_sb(dir->i_sb)->sb_eas)240240 hpfs_read_inode(result);241241 else {242242 result->i_mode |= S_IFREG;···250250 hpfs_result = hpfs_i(result);251251 if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino;252252253253- hpfs_decide_conv(result, name, len);254254-255253 if (de->has_acl || de->has_xtd_perm) if (!(dir->i_sb->s_flags & MS_RDONLY)) {256254 hpfs_error(result->i_sb, "ACLs or XPERM found. This is probably HPFS386. This driver doesn't support it now. Send me some info on these structures");257255 goto bail1;···261263 */262264263265 if (!result->i_ctime.tv_sec) {264264- if (!(result->i_ctime.tv_sec = local_to_gmt(dir->i_sb, de->creation_date)))266266+ if (!(result->i_ctime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->creation_date))))265267 result->i_ctime.tv_sec = 1;266268 result->i_ctime.tv_nsec = 0;267267- result->i_mtime.tv_sec = local_to_gmt(dir->i_sb, de->write_date);269269+ result->i_mtime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->write_date));268270 result->i_mtime.tv_nsec = 0;269269- result->i_atime.tv_sec = local_to_gmt(dir->i_sb, de->read_date);271271+ result->i_atime.tv_sec = local_to_gmt(dir->i_sb, le32_to_cpu(de->read_date));270272 result->i_atime.tv_nsec = 0;271271- hpfs_result->i_ea_size = de->ea_size;273273+ hpfs_result->i_ea_size = le32_to_cpu(de->ea_size);272274 if (!hpfs_result->i_ea_mode && de->read_only)273275 result->i_mode &= ~0222;274276 if (!de->directory) {275277 if (result->i_size == -1) {276276- result->i_size = de->file_size;278278+ result->i_size = le32_to_cpu(de->file_size);277279 result->i_data.a_ops = &hpfs_aops;278280 hpfs_i(result)->mmu_private = result->i_size;279281 /*
+84-90
fs/hpfs/dnode.c
···1414 struct hpfs_dirent *de_end = dnode_end_de(d);1515 int i = 1;1616 for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) {1717- if (de == fde) return ((loff_t) d->self << 4) | (loff_t)i;1717+ if (de == fde) return ((loff_t) le32_to_cpu(d->self) << 4) | (loff_t)i;1818 i++;1919 }2020 printk("HPFS: get_pos: not_found\n");2121- return ((loff_t)d->self << 4) | (loff_t)1;2121+ return ((loff_t)le32_to_cpu(d->self) << 4) | (loff_t)1;2222}23232424void hpfs_add_pos(struct inode *inode, loff_t *pos)···130130{131131 struct hpfs_dirent *de;132132 if (!(de = dnode_last_de(d))) {133133- hpfs_error(s, "set_last_pointer: empty dnode %08x", d->self);133133+ hpfs_error(s, "set_last_pointer: empty dnode %08x", le32_to_cpu(d->self));134134 return;135135 }136136 if (hpfs_sb(s)->sb_chk) {137137 if (de->down) {138138 hpfs_error(s, "set_last_pointer: dnode %08x has already last pointer %08x",139139- d->self, de_down_pointer(de));139139+ le32_to_cpu(d->self), de_down_pointer(de));140140 return;141141 }142142- if (de->length != 32) {143143- hpfs_error(s, "set_last_pointer: bad last dirent in dnode %08x", d->self);142142+ if (le16_to_cpu(de->length) != 32) {143143+ hpfs_error(s, "set_last_pointer: bad last dirent in dnode %08x", le32_to_cpu(d->self));144144 return;145145 }146146 }147147 if (ptr) {148148- if ((d->first_free += 4) > 2048) {149149- hpfs_error(s,"set_last_pointer: too long dnode %08x", d->self);150150- d->first_free -= 4;148148+ d->first_free = cpu_to_le32(le32_to_cpu(d->first_free) + 4);149149+ if (le32_to_cpu(d->first_free) > 2048) {150150+ hpfs_error(s, "set_last_pointer: too long dnode %08x", le32_to_cpu(d->self));151151+ d->first_free = cpu_to_le32(le32_to_cpu(d->first_free) - 4);151152 return;152153 }153153- de->length = 36;154154+ de->length = cpu_to_le16(36);154155 de->down = 1;155155- *(dnode_secno *)((char *)de + 32) = ptr;156156+ *(dnode_secno *)((char *)de + 32) = cpu_to_le32(ptr);156157 }157158}158159···169168 for (de = dnode_first_de(d); de < de_end; de = de_next_de(de)) {170169 int c = hpfs_compare_names(s, name, namelen, de->name, de->namelen, de->last);171170 if (!c) {172172- hpfs_error(s, "name (%c,%d) already exists in dnode %08x", *name, namelen, d->self);171171+ hpfs_error(s, "name (%c,%d) already exists in dnode %08x", *name, namelen, le32_to_cpu(d->self));173172 return NULL;174173 }175174 if (c < 0) break;···177176 memmove((char *)de + d_size, de, (char *)de_end - (char *)de);178177 memset(de, 0, d_size);179178 if (down_ptr) {180180- *(int *)((char *)de + d_size - 4) = down_ptr;179179+ *(dnode_secno *)((char *)de + d_size - 4) = cpu_to_le32(down_ptr);181180 de->down = 1;182181 }183183- de->length = d_size;184184- if (down_ptr) de->down = 1;182182+ de->length = cpu_to_le16(d_size);185183 de->not_8x3 = hpfs_is_name_long(name, namelen);186184 de->namelen = namelen;187185 memcpy(de->name, name, namelen);188188- d->first_free += d_size;186186+ d->first_free = cpu_to_le32(le32_to_cpu(d->first_free) + d_size);189187 return de;190188}191189···194194 struct hpfs_dirent *de)195195{196196 if (de->last) {197197- hpfs_error(s, "attempt to delete last dirent in dnode %08x", d->self);197197+ hpfs_error(s, "attempt to delete last dirent in dnode %08x", le32_to_cpu(d->self));198198 return;199199 }200200- d->first_free -= de->length;201201- memmove(de, de_next_de(de), d->first_free + (char *)d - (char *)de);200200+ d->first_free = cpu_to_le32(le32_to_cpu(d->first_free) - le16_to_cpu(de->length));201201+ memmove(de, de_next_de(de), le32_to_cpu(d->first_free) + (char *)d - (char *)de);202202}203203204204static void fix_up_ptrs(struct super_block *s, struct dnode *d)205205{206206 struct hpfs_dirent *de;207207 struct hpfs_dirent *de_end = dnode_end_de(d);208208- dnode_secno dno = d->self;208208+ dnode_secno dno = le32_to_cpu(d->self);209209 for (de = dnode_first_de(d); de < de_end; de = de_next_de(de))210210 if (de->down) {211211 struct quad_buffer_head qbh;212212 struct dnode *dd;213213 if ((dd = hpfs_map_dnode(s, de_down_pointer(de), &qbh))) {214214- if (dd->up != dno || dd->root_dnode) {215215- dd->up = dno;214214+ if (le32_to_cpu(dd->up) != dno || dd->root_dnode) {215215+ dd->up = cpu_to_le32(dno);216216 dd->root_dnode = 0;217217 hpfs_mark_4buffers_dirty(&qbh);218218 }···262262 kfree(nname);263263 return 1;264264 }265265- if (d->first_free + de_size(namelen, down_ptr) <= 2048) {265265+ if (le32_to_cpu(d->first_free) + de_size(namelen, down_ptr) <= 2048) {266266 loff_t t;267267 copy_de(de=hpfs_add_de(i->i_sb, d, name, namelen, down_ptr), new_de);268268 t = get_pos(d, de);···286286 kfree(nname);287287 return 1;288288 } 289289- memcpy(nd, d, d->first_free);289289+ memcpy(nd, d, le32_to_cpu(d->first_free));290290 copy_de(de = hpfs_add_de(i->i_sb, nd, name, namelen, down_ptr), new_de);291291 for_all_poss(i, hpfs_pos_ins, get_pos(nd, de), 1);292292 h = ((char *)dnode_last_de(nd) - (char *)nd) / 2 + 10;293293- if (!(ad = hpfs_alloc_dnode(i->i_sb, d->up, &adno, &qbh1, 0))) {293293+ if (!(ad = hpfs_alloc_dnode(i->i_sb, le32_to_cpu(d->up), &adno, &qbh1))) {294294 hpfs_error(i->i_sb, "unable to alloc dnode - dnode tree will be corrupted");295295 hpfs_brelse4(&qbh);296296 kfree(nd);···313313 down_ptr = adno;314314 set_last_pointer(i->i_sb, ad, de->down ? de_down_pointer(de) : 0);315315 de = de_next_de(de);316316- memmove((char *)nd + 20, de, nd->first_free + (char *)nd - (char *)de);317317- nd->first_free -= (char *)de - (char *)nd - 20;318318- memcpy(d, nd, nd->first_free);316316+ memmove((char *)nd + 20, de, le32_to_cpu(nd->first_free) + (char *)nd - (char *)de);317317+ nd->first_free = cpu_to_le32(le32_to_cpu(nd->first_free) - ((char *)de - (char *)nd - 20));318318+ memcpy(d, nd, le32_to_cpu(nd->first_free));319319 for_all_poss(i, hpfs_pos_del, (loff_t)dno << 4, pos);320320 fix_up_ptrs(i->i_sb, ad);321321 if (!d->root_dnode) {322322- dno = ad->up = d->up;322322+ ad->up = d->up;323323+ dno = le32_to_cpu(ad->up);323324 hpfs_mark_4buffers_dirty(&qbh);324325 hpfs_brelse4(&qbh);325326 hpfs_mark_4buffers_dirty(&qbh1);326327 hpfs_brelse4(&qbh1);327328 goto go_up;328329 }329329- if (!(rd = hpfs_alloc_dnode(i->i_sb, d->up, &rdno, &qbh2, 0))) {330330+ if (!(rd = hpfs_alloc_dnode(i->i_sb, le32_to_cpu(d->up), &rdno, &qbh2))) {330331 hpfs_error(i->i_sb, "unable to alloc dnode - dnode tree will be corrupted");331332 hpfs_brelse4(&qbh);332333 hpfs_brelse4(&qbh1);···339338 i->i_blocks += 4;340339 rd->root_dnode = 1;341340 rd->up = d->up;342342- if (!(fnode = hpfs_map_fnode(i->i_sb, d->up, &bh))) {341341+ if (!(fnode = hpfs_map_fnode(i->i_sb, le32_to_cpu(d->up), &bh))) {343342 hpfs_free_dnode(i->i_sb, rdno);344343 hpfs_brelse4(&qbh);345344 hpfs_brelse4(&qbh1);···348347 kfree(nname);349348 return 1;350349 }351351- fnode->u.external[0].disk_secno = rdno;350350+ fnode->u.external[0].disk_secno = cpu_to_le32(rdno);352351 mark_buffer_dirty(bh);353352 brelse(bh);354354- d->up = ad->up = hpfs_i(i)->i_dno = rdno;353353+ hpfs_i(i)->i_dno = rdno;354354+ d->up = ad->up = cpu_to_le32(rdno);355355 d->root_dnode = ad->root_dnode = 0;356356 hpfs_mark_4buffers_dirty(&qbh);357357 hpfs_brelse4(&qbh);···375373376374int hpfs_add_dirent(struct inode *i,377375 const unsigned char *name, unsigned namelen,378378- struct hpfs_dirent *new_de, int cdepth)376376+ struct hpfs_dirent *new_de)379377{380378 struct hpfs_inode_info *hpfs_inode = hpfs_i(i);381379 struct dnode *d;···405403 }406404 }407405 hpfs_brelse4(&qbh);408408- if (!cdepth) hpfs_lock_creation(i->i_sb);409406 if (hpfs_check_free_dnodes(i->i_sb, FREE_DNODES_ADD)) {410407 c = 1;411408 goto ret;···412411 i->i_version++;413412 c = hpfs_add_to_dnode(i, dno, name, namelen, new_de, 0);414413 ret:415415- if (!cdepth) hpfs_unlock_creation(i->i_sb);416414 return c;417415}418416···437437 return 0;438438 if (!(dnode = hpfs_map_dnode(i->i_sb, dno, &qbh))) return 0;439439 if (hpfs_sb(i->i_sb)->sb_chk) {440440- if (dnode->up != chk_up) {440440+ if (le32_to_cpu(dnode->up) != chk_up) {441441 hpfs_error(i->i_sb, "move_to_top: up pointer from %08x should be %08x, is %08x",442442- dno, chk_up, dnode->up);442442+ dno, chk_up, le32_to_cpu(dnode->up));443443 hpfs_brelse4(&qbh);444444 return 0;445445 }···455455 hpfs_brelse4(&qbh);456456 }457457 while (!(de = dnode_pre_last_de(dnode))) {458458- dnode_secno up = dnode->up;458458+ dnode_secno up = le32_to_cpu(dnode->up);459459 hpfs_brelse4(&qbh);460460 hpfs_free_dnode(i->i_sb, dno);461461 i->i_size -= 2048;···474474 hpfs_brelse4(&qbh);475475 return 0;476476 }477477- dnode->first_free -= 4;478478- de->length -= 4;477477+ dnode->first_free = cpu_to_le32(le32_to_cpu(dnode->first_free) - 4);478478+ de->length = cpu_to_le16(le16_to_cpu(de->length) - 4);479479 de->down = 0;480480 hpfs_mark_4buffers_dirty(&qbh);481481 dno = up;···483483 t = get_pos(dnode, de);484484 for_all_poss(i, hpfs_pos_subst, t, 4);485485 for_all_poss(i, hpfs_pos_subst, t + 1, 5);486486- if (!(nde = kmalloc(de->length, GFP_NOFS))) {486486+ if (!(nde = kmalloc(le16_to_cpu(de->length), GFP_NOFS))) {487487 hpfs_error(i->i_sb, "out of memory for dirent - directory will be corrupted");488488 hpfs_brelse4(&qbh);489489 return 0;490490 }491491- memcpy(nde, de, de->length);491491+ memcpy(nde, de, le16_to_cpu(de->length));492492 ddno = de->down ? de_down_pointer(de) : 0;493493 hpfs_delete_de(i->i_sb, dnode, de);494494 set_last_pointer(i->i_sb, dnode, ddno);···517517 try_it_again:518518 if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "delete_empty_dnode")) return;519519 if (!(dnode = hpfs_map_dnode(i->i_sb, dno, &qbh))) return;520520- if (dnode->first_free > 56) goto end;521521- if (dnode->first_free == 52 || dnode->first_free == 56) {520520+ if (le32_to_cpu(dnode->first_free) > 56) goto end;521521+ if (le32_to_cpu(dnode->first_free) == 52 || le32_to_cpu(dnode->first_free) == 56) {522522 struct hpfs_dirent *de_end;523523 int root = dnode->root_dnode;524524- up = dnode->up;524524+ up = le32_to_cpu(dnode->up);525525 de = dnode_first_de(dnode);526526 down = de->down ? de_down_pointer(de) : 0;527527 if (hpfs_sb(i->i_sb)->sb_chk) if (root && !down) {···545545 return;546546 }547547 if ((d1 = hpfs_map_dnode(i->i_sb, down, &qbh1))) {548548- d1->up = up;548548+ d1->up = cpu_to_le32(up);549549 d1->root_dnode = 1;550550 hpfs_mark_4buffers_dirty(&qbh1);551551 hpfs_brelse4(&qbh1);552552 }553553 if ((fnode = hpfs_map_fnode(i->i_sb, up, &bh))) {554554- fnode->u.external[0].disk_secno = down;554554+ fnode->u.external[0].disk_secno = cpu_to_le32(down);555555 mark_buffer_dirty(bh);556556 brelse(bh);557557 }···570570 for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | 1, ((loff_t)up << 4) | p);571571 if (!down) {572572 de->down = 0;573573- de->length -= 4;574574- dnode->first_free -= 4;573573+ de->length = cpu_to_le16(le16_to_cpu(de->length) - 4);574574+ dnode->first_free = cpu_to_le32(le32_to_cpu(dnode->first_free) - 4);575575 memmove(de_next_de(de), (char *)de_next_de(de) + 4,576576- (char *)dnode + dnode->first_free - (char *)de_next_de(de));576576+ (char *)dnode + le32_to_cpu(dnode->first_free) - (char *)de_next_de(de));577577 } else {578578 struct dnode *d1;579579 struct quad_buffer_head qbh1;580580- *(dnode_secno *) ((void *) de + de->length - 4) = down;580580+ *(dnode_secno *) ((void *) de + le16_to_cpu(de->length) - 4) = down;581581 if ((d1 = hpfs_map_dnode(i->i_sb, down, &qbh1))) {582582- d1->up = up;582582+ d1->up = cpu_to_le32(up);583583 hpfs_mark_4buffers_dirty(&qbh1);584584 hpfs_brelse4(&qbh1);585585 }586586 }587587 } else {588588- hpfs_error(i->i_sb, "delete_empty_dnode: dnode %08x, first_free == %03x", dno, dnode->first_free);588588+ hpfs_error(i->i_sb, "delete_empty_dnode: dnode %08x, first_free == %03x", dno, le32_to_cpu(dnode->first_free));589589 goto end;590590 }591591···596596 struct quad_buffer_head qbh1;597597 if (!de_next->down) goto endm;598598 ndown = de_down_pointer(de_next);599599- if (!(de_cp = kmalloc(de->length, GFP_NOFS))) {599599+ if (!(de_cp = kmalloc(le16_to_cpu(de->length), GFP_NOFS))) {600600 printk("HPFS: out of memory for dtree balancing\n");601601 goto endm;602602 }603603- memcpy(de_cp, de, de->length);603603+ memcpy(de_cp, de, le16_to_cpu(de->length));604604 hpfs_delete_de(i->i_sb, dnode, de);605605 hpfs_mark_4buffers_dirty(&qbh);606606 hpfs_brelse4(&qbh);607607 for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | p, 4);608608 for_all_poss(i, hpfs_pos_del, ((loff_t)up << 4) | p, 1);609609 if (de_cp->down) if ((d1 = hpfs_map_dnode(i->i_sb, de_down_pointer(de_cp), &qbh1))) {610610- d1->up = ndown;610610+ d1->up = cpu_to_le32(ndown);611611 hpfs_mark_4buffers_dirty(&qbh1);612612 hpfs_brelse4(&qbh1);613613 }···635635 struct hpfs_dirent *del = dnode_last_de(d1);636636 dlp = del->down ? de_down_pointer(del) : 0;637637 if (!dlp && down) {638638- if (d1->first_free > 2044) {638638+ if (le32_to_cpu(d1->first_free) > 2044) {639639 if (hpfs_sb(i->i_sb)->sb_chk >= 2) {640640 printk("HPFS: warning: unbalanced dnode tree, see hpfs.txt 4 more info\n");641641 printk("HPFS: warning: terminating balancing operation\n");···647647 printk("HPFS: warning: unbalanced dnode tree, see hpfs.txt 4 more info\n");648648 printk("HPFS: warning: goin'on\n");649649 }650650- del->length += 4;650650+ del->length = cpu_to_le16(le16_to_cpu(del->length) + 4);651651 del->down = 1;652652- d1->first_free += 4;652652+ d1->first_free = cpu_to_le32(le32_to_cpu(d1->first_free) + 4);653653 }654654 if (dlp && !down) {655655- del->length -= 4;655655+ del->length = cpu_to_le16(le16_to_cpu(del->length) - 4);656656 del->down = 0;657657- d1->first_free -= 4;657657+ d1->first_free = cpu_to_le32(le32_to_cpu(d1->first_free) - 4);658658 } else if (down)659659- *(dnode_secno *) ((void *) del + del->length - 4) = down;659659+ *(dnode_secno *) ((void *) del + le16_to_cpu(del->length) - 4) = cpu_to_le32(down);660660 } else goto endm;661661- if (!(de_cp = kmalloc(de_prev->length, GFP_NOFS))) {661661+ if (!(de_cp = kmalloc(le16_to_cpu(de_prev->length), GFP_NOFS))) {662662 printk("HPFS: out of memory for dtree balancing\n");663663 hpfs_brelse4(&qbh1);664664 goto endm;665665 }666666 hpfs_mark_4buffers_dirty(&qbh1);667667 hpfs_brelse4(&qbh1);668668- memcpy(de_cp, de_prev, de_prev->length);668668+ memcpy(de_cp, de_prev, le16_to_cpu(de_prev->length));669669 hpfs_delete_de(i->i_sb, dnode, de_prev);670670 if (!de_prev->down) {671671- de_prev->length += 4;671671+ de_prev->length = cpu_to_le16(le16_to_cpu(de_prev->length) + 4);672672 de_prev->down = 1;673673- dnode->first_free += 4;673673+ dnode->first_free = cpu_to_le32(le32_to_cpu(dnode->first_free) + 4);674674 }675675- *(dnode_secno *) ((void *) de_prev + de_prev->length - 4) = ndown;675675+ *(dnode_secno *) ((void *) de_prev + le16_to_cpu(de_prev->length) - 4) = cpu_to_le32(ndown);676676 hpfs_mark_4buffers_dirty(&qbh);677677 hpfs_brelse4(&qbh);678678 for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | (p - 1), 4);679679 for_all_poss(i, hpfs_pos_subst, ((loff_t)up << 4) | p, ((loff_t)up << 4) | (p - 1));680680 if (down) if ((d1 = hpfs_map_dnode(i->i_sb, de_down_pointer(de), &qbh1))) {681681- d1->up = ndown;681681+ d1->up = cpu_to_le32(ndown);682682 hpfs_mark_4buffers_dirty(&qbh1);683683 hpfs_brelse4(&qbh1);684684 }···701701{702702 struct dnode *dnode = qbh->data;703703 dnode_secno down = 0;704704- int lock = 0;705704 loff_t t;706705 if (de->first || de->last) {707706 hpfs_error(i->i_sb, "hpfs_remove_dirent: attempt to delete first or last dirent in dnode %08x", dno);···709710 }710711 if (de->down) down = de_down_pointer(de);711712 if (depth && (de->down || (de == dnode_first_de(dnode) && de_next_de(de)->last))) {712712- lock = 1;713713- hpfs_lock_creation(i->i_sb);714713 if (hpfs_check_free_dnodes(i->i_sb, FREE_DNODES_DEL)) {715714 hpfs_brelse4(qbh);716716- hpfs_unlock_creation(i->i_sb);717715 return 2;718716 }719717 }···723727 dnode_secno a = move_to_top(i, down, dno);724728 for_all_poss(i, hpfs_pos_subst, 5, t);725729 if (a) delete_empty_dnode(i, a);726726- if (lock) hpfs_unlock_creation(i->i_sb);727730 return !a;728731 }729732 delete_empty_dnode(i, dno);730730- if (lock) hpfs_unlock_creation(i->i_sb);731733 return 0;732734}733735···745751 ptr = 0;746752 go_up:747753 if (!(dnode = hpfs_map_dnode(s, dno, &qbh))) return;748748- if (hpfs_sb(s)->sb_chk) if (odno && odno != -1 && dnode->up != odno)749749- hpfs_error(s, "hpfs_count_dnodes: bad up pointer; dnode %08x, down %08x points to %08x", odno, dno, dnode->up);754754+ if (hpfs_sb(s)->sb_chk) if (odno && odno != -1 && le32_to_cpu(dnode->up) != odno)755755+ hpfs_error(s, "hpfs_count_dnodes: bad up pointer; dnode %08x, down %08x points to %08x", odno, dno, le32_to_cpu(dnode->up));750756 de = dnode_first_de(dnode);751757 if (ptr) while(1) {752758 if (de->down) if (de_down_pointer(de) == ptr) goto process_de;···770776 if (!de->first && !de->last && n_items) (*n_items)++;771777 if ((de = de_next_de(de)) < dnode_end_de(dnode)) goto next_de;772778 ptr = dno;773773- dno = dnode->up;779779+ dno = le32_to_cpu(dnode->up);774780 if (dnode->root_dnode) {775781 hpfs_brelse4(&qbh);776782 return;···818824 return d;819825 if (!(de = map_nth_dirent(s, d, 1, &qbh, NULL))) return dno;820826 if (hpfs_sb(s)->sb_chk)821821- if (up && ((struct dnode *)qbh.data)->up != up)822822- hpfs_error(s, "hpfs_de_as_down_as_possible: bad up pointer; dnode %08x, down %08x points to %08x", up, d, ((struct dnode *)qbh.data)->up);827827+ if (up && le32_to_cpu(((struct dnode *)qbh.data)->up) != up)828828+ hpfs_error(s, "hpfs_de_as_down_as_possible: bad up pointer; dnode %08x, down %08x points to %08x", up, d, le32_to_cpu(((struct dnode *)qbh.data)->up));823829 if (!de->down) {824830 hpfs_brelse4(&qbh);825831 return d;···868874 /* Going up */869875 if (dnode->root_dnode) goto bail;870876871871- if (!(up_dnode = hpfs_map_dnode(inode->i_sb, dnode->up, &qbh0)))877877+ if (!(up_dnode = hpfs_map_dnode(inode->i_sb, le32_to_cpu(dnode->up), &qbh0)))872878 goto bail;873879874880 end_up_de = dnode_end_de(up_dnode);···876882 for (up_de = dnode_first_de(up_dnode); up_de < end_up_de;877883 up_de = de_next_de(up_de)) {878884 if (!(++c & 077)) hpfs_error(inode->i_sb,879879- "map_pos_dirent: pos crossed dnode boundary; dnode = %08x", dnode->up);885885+ "map_pos_dirent: pos crossed dnode boundary; dnode = %08x", le32_to_cpu(dnode->up));880886 if (up_de->down && de_down_pointer(up_de) == dno) {881881- *posp = ((loff_t) dnode->up << 4) + c;887887+ *posp = ((loff_t) le32_to_cpu(dnode->up) << 4) + c;882888 hpfs_brelse4(&qbh0);883889 return de;884890 }885891 }886892887893 hpfs_error(inode->i_sb, "map_pos_dirent: pointer to dnode %08x not found in parent dnode %08x",888888- dno, dnode->up);894894+ dno, le32_to_cpu(dnode->up));889895 hpfs_brelse4(&qbh0);890896891897 bail:···10111017 /*name2[15] = 0xff;*/10121018 name1len = 15; name2len = 256;10131019 }10141014- if (!(upf = hpfs_map_fnode(s, f->up, &bh))) {10201020+ if (!(upf = hpfs_map_fnode(s, le32_to_cpu(f->up), &bh))) {10151021 kfree(name2);10161022 return NULL;10171023 } 10181024 if (!upf->dirflag) {10191025 brelse(bh);10201020- hpfs_error(s, "fnode %08x has non-directory parent %08x", fno, f->up);10261026+ hpfs_error(s, "fnode %08x has non-directory parent %08x", fno, le32_to_cpu(f->up));10211027 kfree(name2);10221028 return NULL;10231029 }10241024- dno = upf->u.external[0].disk_secno;10301030+ dno = le32_to_cpu(upf->u.external[0].disk_secno);10251031 brelse(bh);10261032 go_down:10271033 downd = 0;···10431049 return NULL;10441050 }10451051 next_de:10461046- if (de->fnode == fno) {10521052+ if (le32_to_cpu(de->fnode) == fno) {10471053 kfree(name2);10481054 return de;10491055 }···10591065 goto go_down;10601066 }10611067 f:10621062- if (de->fnode == fno) {10681068+ if (le32_to_cpu(de->fnode) == fno) {10631069 kfree(name2);10641070 return de;10651071 }···10681074 if ((de = de_next_de(de)) < de_end) goto next_de;10691075 if (d->root_dnode) goto not_found;10701076 downd = dno;10711071- dno = d->up;10771077+ dno = le32_to_cpu(d->up);10721078 hpfs_brelse4(qbh);10731079 if (hpfs_sb(s)->sb_chk)10741080 if (hpfs_stop_cycles(s, downd, &d1, &d2, "map_fnode_dirent #2")) {
+69-67
fs/hpfs/ea.c
···2424 }2525 if (hpfs_ea_read(s, a, ano, pos, 4, ex)) return;2626 if (ea->indirect) {2727- if (ea->valuelen != 8) {2727+ if (ea_valuelen(ea) != 8) {2828 hpfs_error(s, "ea->indirect set while ea->valuelen!=8, %s %08x, pos %08x",2929 ano ? "anode" : "sectors", a, pos);3030 return;···3333 return;3434 hpfs_ea_remove(s, ea_sec(ea), ea->anode, ea_len(ea));3535 }3636- pos += ea->namelen + ea->valuelen + 5;3636+ pos += ea->namelen + ea_valuelen(ea) + 5;3737 }3838 if (!ano) hpfs_free_sectors(s, a, (len+511) >> 9);3939 else {···7676 unsigned pos;7777 int ano, len;7878 secno a;7979+ char ex[4 + 255 + 1 + 8];7980 struct extended_attribute *ea;8081 struct extended_attribute *ea_end = fnode_end_ea(fnode);8182 for (ea = fnode_ea(fnode); ea < ea_end; ea = next_ea(ea))8283 if (!strcmp(ea->name, key)) {8384 if (ea->indirect)8485 goto indirect;8585- if (ea->valuelen >= size)8686+ if (ea_valuelen(ea) >= size)8687 return -EINVAL;8787- memcpy(buf, ea_data(ea), ea->valuelen);8888- buf[ea->valuelen] = 0;8888+ memcpy(buf, ea_data(ea), ea_valuelen(ea));8989+ buf[ea_valuelen(ea)] = 0;8990 return 0;9091 }9191- a = fnode->ea_secno;9292- len = fnode->ea_size_l;9292+ a = le32_to_cpu(fnode->ea_secno);9393+ len = le32_to_cpu(fnode->ea_size_l);9394 ano = fnode->ea_anode;9495 pos = 0;9596 while (pos < len) {9696- char ex[4 + 255 + 1 + 8];9797 ea = (struct extended_attribute *)ex;9898 if (pos + 4 > len) {9999 hpfs_error(s, "EAs don't end correctly, %s %08x, len %08x",···106106 if (!strcmp(ea->name, key)) {107107 if (ea->indirect)108108 goto indirect;109109- if (ea->valuelen >= size)109109+ if (ea_valuelen(ea) >= size)110110 return -EINVAL;111111- if (hpfs_ea_read(s, a, ano, pos + 4 + ea->namelen + 1, ea->valuelen, buf))111111+ if (hpfs_ea_read(s, a, ano, pos + 4 + ea->namelen + 1, ea_valuelen(ea), buf))112112 return -EIO;113113- buf[ea->valuelen] = 0;113113+ buf[ea_valuelen(ea)] = 0;114114 return 0;115115 }116116- pos += ea->namelen + ea->valuelen + 5;116116+ pos += ea->namelen + ea_valuelen(ea) + 5;117117 }118118 return -ENOENT;119119indirect:···138138 if (!strcmp(ea->name, key)) {139139 if (ea->indirect)140140 return get_indirect_ea(s, ea->anode, ea_sec(ea), *size = ea_len(ea));141141- if (!(ret = kmalloc((*size = ea->valuelen) + 1, GFP_NOFS))) {141141+ if (!(ret = kmalloc((*size = ea_valuelen(ea)) + 1, GFP_NOFS))) {142142 printk("HPFS: out of memory for EA\n");143143 return NULL;144144 }145145- memcpy(ret, ea_data(ea), ea->valuelen);146146- ret[ea->valuelen] = 0;145145+ memcpy(ret, ea_data(ea), ea_valuelen(ea));146146+ ret[ea_valuelen(ea)] = 0;147147 return ret;148148 }149149- a = fnode->ea_secno;150150- len = fnode->ea_size_l;149149+ a = le32_to_cpu(fnode->ea_secno);150150+ len = le32_to_cpu(fnode->ea_size_l);151151 ano = fnode->ea_anode;152152 pos = 0;153153 while (pos < len) {···164164 if (!strcmp(ea->name, key)) {165165 if (ea->indirect)166166 return get_indirect_ea(s, ea->anode, ea_sec(ea), *size = ea_len(ea));167167- if (!(ret = kmalloc((*size = ea->valuelen) + 1, GFP_NOFS))) {167167+ if (!(ret = kmalloc((*size = ea_valuelen(ea)) + 1, GFP_NOFS))) {168168 printk("HPFS: out of memory for EA\n");169169 return NULL;170170 }171171- if (hpfs_ea_read(s, a, ano, pos + 4 + ea->namelen + 1, ea->valuelen, ret)) {171171+ if (hpfs_ea_read(s, a, ano, pos + 4 + ea->namelen + 1, ea_valuelen(ea), ret)) {172172 kfree(ret);173173 return NULL;174174 }175175- ret[ea->valuelen] = 0;175175+ ret[ea_valuelen(ea)] = 0;176176 return ret;177177 }178178- pos += ea->namelen + ea->valuelen + 5;178178+ pos += ea->namelen + ea_valuelen(ea) + 5;179179 }180180 return NULL;181181}···202202 if (ea->indirect) {203203 if (ea_len(ea) == size)204204 set_indirect_ea(s, ea->anode, ea_sec(ea), data, size);205205- } else if (ea->valuelen == size) {205205+ } else if (ea_valuelen(ea) == size) {206206 memcpy(ea_data(ea), data, size);207207 }208208 return;209209 }210210- a = fnode->ea_secno;211211- len = fnode->ea_size_l;210210+ a = le32_to_cpu(fnode->ea_secno);211211+ len = le32_to_cpu(fnode->ea_size_l);212212 ano = fnode->ea_anode;213213 pos = 0;214214 while (pos < len) {···228228 set_indirect_ea(s, ea->anode, ea_sec(ea), data, size);229229 }230230 else {231231- if (ea->valuelen == size)231231+ if (ea_valuelen(ea) == size)232232 hpfs_ea_write(s, a, ano, pos + 4 + ea->namelen + 1, size, data);233233 }234234 return;235235 }236236- pos += ea->namelen + ea->valuelen + 5;236236+ pos += ea->namelen + ea_valuelen(ea) + 5;237237 }238238- if (!fnode->ea_offs) {239239- /*if (fnode->ea_size_s) {238238+ if (!le16_to_cpu(fnode->ea_offs)) {239239+ /*if (le16_to_cpu(fnode->ea_size_s)) {240240 hpfs_error(s, "fnode %08x: ea_size_s == %03x, ea_offs == 0",241241- inode->i_ino, fnode->ea_size_s);241241+ inode->i_ino, le16_to_cpu(fnode->ea_size_s));242242 return;243243 }*/244244- fnode->ea_offs = 0xc4;244244+ fnode->ea_offs = cpu_to_le16(0xc4);245245 }246246- if (fnode->ea_offs < 0xc4 || fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s > 0x200) {246246+ if (le16_to_cpu(fnode->ea_offs) < 0xc4 || le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s) + le16_to_cpu(fnode->ea_size_s) > 0x200) {247247 hpfs_error(s, "fnode %08lx: ea_offs == %03x, ea_size_s == %03x",248248 (unsigned long)inode->i_ino,249249- fnode->ea_offs, fnode->ea_size_s);249249+ le32_to_cpu(fnode->ea_offs), le16_to_cpu(fnode->ea_size_s));250250 return;251251 }252252- if ((fnode->ea_size_s || !fnode->ea_size_l) &&253253- fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s + strlen(key) + size + 5 <= 0x200) {252252+ if ((le16_to_cpu(fnode->ea_size_s) || !le32_to_cpu(fnode->ea_size_l)) &&253253+ le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s) + le16_to_cpu(fnode->ea_size_s) + strlen(key) + size + 5 <= 0x200) {254254 ea = fnode_end_ea(fnode);255255 *(char *)ea = 0;256256 ea->namelen = strlen(key);257257- ea->valuelen = size;257257+ ea->valuelen_lo = size;258258+ ea->valuelen_hi = size >> 8;258259 strcpy(ea->name, key);259260 memcpy(ea_data(ea), data, size);260260- fnode->ea_size_s += strlen(key) + size + 5;261261+ fnode->ea_size_s = cpu_to_le16(le16_to_cpu(fnode->ea_size_s) + strlen(key) + size + 5);261262 goto ret;262263 }263264 /* Most the code here is 99.9993422% unused. I hope there are no bugs.264265 But what .. HPFS.IFS has also bugs in ea management. */265265- if (fnode->ea_size_s && !fnode->ea_size_l) {266266+ if (le16_to_cpu(fnode->ea_size_s) && !le32_to_cpu(fnode->ea_size_l)) {266267 secno n;267268 struct buffer_head *bh;268269 char *data;269269- if (!(n = hpfs_alloc_sector(s, fno, 1, 0, 1))) return;270270+ if (!(n = hpfs_alloc_sector(s, fno, 1, 0))) return;270271 if (!(data = hpfs_get_sector(s, n, &bh))) {271272 hpfs_free_sectors(s, n, 1);272273 return;273274 }274274- memcpy(data, fnode_ea(fnode), fnode->ea_size_s);275275- fnode->ea_size_l = fnode->ea_size_s;276276- fnode->ea_size_s = 0;277277- fnode->ea_secno = n;278278- fnode->ea_anode = 0;275275+ memcpy(data, fnode_ea(fnode), le16_to_cpu(fnode->ea_size_s));276276+ fnode->ea_size_l = cpu_to_le32(le16_to_cpu(fnode->ea_size_s));277277+ fnode->ea_size_s = cpu_to_le16(0);278278+ fnode->ea_secno = cpu_to_le32(n);279279+ fnode->ea_anode = cpu_to_le32(0);279280 mark_buffer_dirty(bh);280281 brelse(bh);281282 }282282- pos = fnode->ea_size_l + 5 + strlen(key) + size;283283- len = (fnode->ea_size_l + 511) >> 9;283283+ pos = le32_to_cpu(fnode->ea_size_l) + 5 + strlen(key) + size;284284+ len = (le32_to_cpu(fnode->ea_size_l) + 511) >> 9;284285 if (pos >= 30000) goto bail;285286 while (((pos + 511) >> 9) > len) {286287 if (!len) {287287- if (!(fnode->ea_secno = hpfs_alloc_sector(s, fno, 1, 0, 1)))288288- goto bail;288288+ secno q = hpfs_alloc_sector(s, fno, 1, 0);289289+ if (!q) goto bail;290290+ fnode->ea_secno = cpu_to_le32(q);289291 fnode->ea_anode = 0;290292 len++;291293 } else if (!fnode->ea_anode) {292292- if (hpfs_alloc_if_possible(s, fnode->ea_secno + len)) {294294+ if (hpfs_alloc_if_possible(s, le32_to_cpu(fnode->ea_secno) + len)) {293295 len++;294296 } else {295297 /* Aargh... don't know how to create ea anodes :-( */···300298 anode_secno a_s;301299 if (!(anode = hpfs_alloc_anode(s, fno, &a_s, &bh)))302300 goto bail;303303- anode->up = fno;301301+ anode->up = cpu_to_le32(fno);304302 anode->btree.fnode_parent = 1;305303 anode->btree.n_free_nodes--;306304 anode->btree.n_used_nodes++;307307- anode->btree.first_free += 12;308308- anode->u.external[0].disk_secno = fnode->ea_secno;309309- anode->u.external[0].file_secno = 0;310310- anode->u.external[0].length = len;305305+ anode->btree.first_free = cpu_to_le16(le16_to_cpu(anode->btree.first_free) + 12);306306+ anode->u.external[0].disk_secno = cpu_to_le32(le32_to_cpu(fnode->ea_secno));307307+ anode->u.external[0].file_secno = cpu_to_le32(0);308308+ anode->u.external[0].length = cpu_to_le32(len);311309 mark_buffer_dirty(bh);312310 brelse(bh);313311 fnode->ea_anode = 1;314314- fnode->ea_secno = a_s;*/312312+ fnode->ea_secno = cpu_to_le32(a_s);*/315313 secno new_sec;316314 int i;317317- if (!(new_sec = hpfs_alloc_sector(s, fno, 1, 1 - ((pos + 511) >> 9), 1)))315315+ if (!(new_sec = hpfs_alloc_sector(s, fno, 1, 1 - ((pos + 511) >> 9))))318316 goto bail;319317 for (i = 0; i < len; i++) {320318 struct buffer_head *bh1, *bh2;321319 void *b1, *b2;322322- if (!(b1 = hpfs_map_sector(s, fnode->ea_secno + i, &bh1, len - i - 1))) {320320+ if (!(b1 = hpfs_map_sector(s, le32_to_cpu(fnode->ea_secno) + i, &bh1, len - i - 1))) {323321 hpfs_free_sectors(s, new_sec, (pos + 511) >> 9);324322 goto bail;325323 }···333331 mark_buffer_dirty(bh2);334332 brelse(bh2);335333 }336336- hpfs_free_sectors(s, fnode->ea_secno, len);337337- fnode->ea_secno = new_sec;334334+ hpfs_free_sectors(s, le32_to_cpu(fnode->ea_secno), len);335335+ fnode->ea_secno = cpu_to_le32(new_sec);338336 len = (pos + 511) >> 9;339337 }340338 }341339 if (fnode->ea_anode) {342342- if (hpfs_add_sector_to_btree(s, fnode->ea_secno,340340+ if (hpfs_add_sector_to_btree(s, le32_to_cpu(fnode->ea_secno),343341 0, len) != -1) {344342 len++;345343 } else {···351349 h[1] = strlen(key);352350 h[2] = size & 0xff;353351 h[3] = size >> 8;354354- if (hpfs_ea_write(s, fnode->ea_secno, fnode->ea_anode, fnode->ea_size_l, 4, h)) goto bail;355355- if (hpfs_ea_write(s, fnode->ea_secno, fnode->ea_anode, fnode->ea_size_l + 4, h[1] + 1, key)) goto bail;356356- if (hpfs_ea_write(s, fnode->ea_secno, fnode->ea_anode, fnode->ea_size_l + 5 + h[1], size, data)) goto bail;357357- fnode->ea_size_l = pos;352352+ if (hpfs_ea_write(s, le32_to_cpu(fnode->ea_secno), fnode->ea_anode, le32_to_cpu(fnode->ea_size_l), 4, h)) goto bail;353353+ if (hpfs_ea_write(s, le32_to_cpu(fnode->ea_secno), fnode->ea_anode, le32_to_cpu(fnode->ea_size_l) + 4, h[1] + 1, key)) goto bail;354354+ if (hpfs_ea_write(s, le32_to_cpu(fnode->ea_secno), fnode->ea_anode, le32_to_cpu(fnode->ea_size_l) + 5 + h[1], size, data)) goto bail;355355+ fnode->ea_size_l = cpu_to_le32(pos);358356 ret:359357 hpfs_i(inode)->i_ea_size += 5 + strlen(key) + size;360358 return;361359 bail:362362- if (fnode->ea_secno)363363- if (fnode->ea_anode) hpfs_truncate_btree(s, fnode->ea_secno, 1, (fnode->ea_size_l + 511) >> 9);364364- else hpfs_free_sectors(s, fnode->ea_secno + ((fnode->ea_size_l + 511) >> 9), len - ((fnode->ea_size_l + 511) >> 9));365365- else fnode->ea_secno = fnode->ea_size_l = 0;360360+ if (le32_to_cpu(fnode->ea_secno))361361+ if (fnode->ea_anode) hpfs_truncate_btree(s, le32_to_cpu(fnode->ea_secno), 1, (le32_to_cpu(fnode->ea_size_l) + 511) >> 9);362362+ else hpfs_free_sectors(s, le32_to_cpu(fnode->ea_secno) + ((le32_to_cpu(fnode->ea_size_l) + 511) >> 9), len - ((le32_to_cpu(fnode->ea_size_l) + 511) >> 9));363363+ else fnode->ea_secno = fnode->ea_size_l = cpu_to_le32(0);366364}367365
···1919 For definitive information on HPFS, ask somebody else -- this is guesswork.2020 There are certain to be many mistakes. */21212222+#if !defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN)2323+#error unknown endian2424+#endif2525+2226/* Notation */23272424-typedef unsigned secno; /* sector number, partition relative */2828+typedef u32 secno; /* sector number, partition relative */25292630typedef secno dnode_secno; /* sector number of a dnode */2731typedef secno fnode_secno; /* sector number of an fnode */···42384339struct hpfs_boot_block4440{4545- unsigned char jmp[3];4646- unsigned char oem_id[8];4747- unsigned char bytes_per_sector[2]; /* 512 */4848- unsigned char sectors_per_cluster;4949- unsigned char n_reserved_sectors[2];5050- unsigned char n_fats;5151- unsigned char n_rootdir_entries[2];5252- unsigned char n_sectors_s[2];5353- unsigned char media_byte;5454- unsigned short sectors_per_fat;5555- unsigned short sectors_per_track;5656- unsigned short heads_per_cyl;5757- unsigned int n_hidden_sectors;5858- unsigned int n_sectors_l; /* size of partition */5959- unsigned char drive_number;6060- unsigned char mbz;6161- unsigned char sig_28h; /* 28h */6262- unsigned char vol_serno[4];6363- unsigned char vol_label[11];6464- unsigned char sig_hpfs[8]; /* "HPFS " */6565- unsigned char pad[448];6666- unsigned short magic; /* aa55 */4141+ u8 jmp[3];4242+ u8 oem_id[8];4343+ u8 bytes_per_sector[2]; /* 512 */4444+ u8 sectors_per_cluster;4545+ u8 n_reserved_sectors[2];4646+ u8 n_fats;4747+ u8 n_rootdir_entries[2];4848+ u8 n_sectors_s[2];4949+ u8 media_byte;5050+ u16 sectors_per_fat;5151+ u16 sectors_per_track;5252+ u16 heads_per_cyl;5353+ u32 n_hidden_sectors;5454+ u32 n_sectors_l; /* size of partition */5555+ u8 drive_number;5656+ u8 mbz;5757+ u8 sig_28h; /* 28h */5858+ u8 vol_serno[4];5959+ u8 vol_label[11];6060+ u8 sig_hpfs[8]; /* "HPFS " */6161+ u8 pad[448];6262+ u16 magic; /* aa55 */6763};68646965···75717672struct hpfs_super_block7773{7878- unsigned magic; /* f995 e849 */7979- unsigned magic1; /* fa53 e9c5, more magic? */8080- /*unsigned huh202;*/ /* ?? 202 = N. of B. in 1.00390625 S.*/8181- char version; /* version of a filesystem usually 2 */8282- char funcversion; /* functional version - oldest version7474+ u32 magic; /* f995 e849 */7575+ u32 magic1; /* fa53 e9c5, more magic? */7676+ u8 version; /* version of a filesystem usually 2 */7777+ u8 funcversion; /* functional version - oldest version8378 of filesystem that can understand8479 this disk */8585- unsigned short int zero; /* 0 */8080+ u16 zero; /* 0 */8681 fnode_secno root; /* fnode of root directory */8782 secno n_sectors; /* size of filesystem */8888- unsigned n_badblocks; /* number of bad blocks */8383+ u32 n_badblocks; /* number of bad blocks */8984 secno bitmaps; /* pointers to free space bit maps */9090- unsigned zero1; /* 0 */8585+ u32 zero1; /* 0 */9186 secno badblocks; /* bad block list */9292- unsigned zero3; /* 0 */8787+ u32 zero3; /* 0 */9388 time32_t last_chkdsk; /* date last checked, 0 if never */9494- /*unsigned zero4;*/ /* 0 */9595- time32_t last_optimize; /* date last optimized, 0 if never */8989+ time32_t last_optimize; /* date last optimized, 0 if never */9690 secno n_dir_band; /* number of sectors in dir band */9791 secno dir_band_start; /* first sector in dir band */9892 secno dir_band_end; /* last sector in dir band */9993 secno dir_band_bitmap; /* free space map, 1 dnode per bit */100100- char volume_name[32]; /* not used */9494+ u8 volume_name[32]; /* not used */10195 secno user_id_table; /* 8 preallocated sectors - user id */102102- unsigned zero6[103]; /* 0 */9696+ u32 zero6[103]; /* 0 */10397};1049810599···109107110108struct hpfs_spare_block111109{112112- unsigned magic; /* f991 1849 */113113- unsigned magic1; /* fa52 29c5, more magic? */110110+ u32 magic; /* f991 1849 */111111+ u32 magic1; /* fa52 29c5, more magic? */114112115115- unsigned dirty: 1; /* 0 clean, 1 "improperly stopped" */116116- /*unsigned flag1234: 4;*/ /* unknown flags */117117- unsigned sparedir_used: 1; /* spare dirblks used */118118- unsigned hotfixes_used: 1; /* hotfixes used */119119- unsigned bad_sector: 1; /* bad sector, corrupted disk (???) */120120- unsigned bad_bitmap: 1; /* bad bitmap */121121- unsigned fast: 1; /* partition was fast formatted */122122- unsigned old_wrote: 1; /* old version wrote to partion */123123- unsigned old_wrote_1: 1; /* old version wrote to partion (?) */124124- unsigned install_dasd_limits: 1; /* HPFS386 flags */125125- unsigned resynch_dasd_limits: 1;126126- unsigned dasd_limits_operational: 1;127127- unsigned multimedia_active: 1;128128- unsigned dce_acls_active: 1;129129- unsigned dasd_limits_dirty: 1;130130- unsigned flag67: 2;131131- unsigned char mm_contlgulty;132132- unsigned char unused;113113+#ifdef __LITTLE_ENDIAN114114+ u8 dirty: 1; /* 0 clean, 1 "improperly stopped" */115115+ u8 sparedir_used: 1; /* spare dirblks used */116116+ u8 hotfixes_used: 1; /* hotfixes used */117117+ u8 bad_sector: 1; /* bad sector, corrupted disk (???) */118118+ u8 bad_bitmap: 1; /* bad bitmap */119119+ u8 fast: 1; /* partition was fast formatted */120120+ u8 old_wrote: 1; /* old version wrote to partion */121121+ u8 old_wrote_1: 1; /* old version wrote to partion (?) */122122+#else123123+ u8 old_wrote_1: 1; /* old version wrote to partion (?) */124124+ u8 old_wrote: 1; /* old version wrote to partion */125125+ u8 fast: 1; /* partition was fast formatted */126126+ u8 bad_bitmap: 1; /* bad bitmap */127127+ u8 bad_sector: 1; /* bad sector, corrupted disk (???) */128128+ u8 hotfixes_used: 1; /* hotfixes used */129129+ u8 sparedir_used: 1; /* spare dirblks used */130130+ u8 dirty: 1; /* 0 clean, 1 "improperly stopped" */131131+#endif132132+133133+#ifdef __LITTLE_ENDIAN134134+ u8 install_dasd_limits: 1; /* HPFS386 flags */135135+ u8 resynch_dasd_limits: 1;136136+ u8 dasd_limits_operational: 1;137137+ u8 multimedia_active: 1;138138+ u8 dce_acls_active: 1;139139+ u8 dasd_limits_dirty: 1;140140+ u8 flag67: 2;141141+#else142142+ u8 flag67: 2;143143+ u8 dasd_limits_dirty: 1;144144+ u8 dce_acls_active: 1;145145+ u8 multimedia_active: 1;146146+ u8 dasd_limits_operational: 1;147147+ u8 resynch_dasd_limits: 1;148148+ u8 install_dasd_limits: 1; /* HPFS386 flags */149149+#endif150150+151151+ u8 mm_contlgulty;152152+ u8 unused;133153134154 secno hotfix_map; /* info about remapped bad sectors */135135- unsigned n_spares_used; /* number of hotfixes */136136- unsigned n_spares; /* number of spares in hotfix map */137137- unsigned n_dnode_spares_free; /* spare dnodes unused */138138- unsigned n_dnode_spares; /* length of spare_dnodes[] list,155155+ u32 n_spares_used; /* number of hotfixes */156156+ u32 n_spares; /* number of spares in hotfix map */157157+ u32 n_dnode_spares_free; /* spare dnodes unused */158158+ u32 n_dnode_spares; /* length of spare_dnodes[] list,139159 follows in this block*/140160 secno code_page_dir; /* code page directory block */141141- unsigned n_code_pages; /* number of code pages */142142- /*unsigned large_numbers[2];*/ /* ?? */143143- unsigned super_crc; /* on HPFS386 and LAN Server this is161161+ u32 n_code_pages; /* number of code pages */162162+ u32 super_crc; /* on HPFS386 and LAN Server this is144163 checksum of superblock, on normal145164 OS/2 unused */146146- unsigned spare_crc; /* on HPFS386 checksum of spareblock */147147- unsigned zero1[15]; /* unused */165165+ u32 spare_crc; /* on HPFS386 checksum of spareblock */166166+ u32 zero1[15]; /* unused */148167 dnode_secno spare_dnodes[100]; /* emergency free dnode list */149149- unsigned zero2[1]; /* room for more? */168168+ u32 zero2[1]; /* room for more? */150169};151170152171/* The bad block list is 4 sectors long. The first word must be zero,···202179203180struct code_page_directory204181{205205- unsigned magic; /* 4945 21f7 */206206- unsigned n_code_pages; /* number of pointers following */207207- unsigned zero1[2];182182+ u32 magic; /* 4945 21f7 */183183+ u32 n_code_pages; /* number of pointers following */184184+ u32 zero1[2];208185 struct {209209- unsigned short ix; /* index */210210- unsigned short code_page_number; /* code page number */211211- unsigned bounds; /* matches corresponding word186186+ u16 ix; /* index */187187+ u16 code_page_number; /* code page number */188188+ u32 bounds; /* matches corresponding word212189 in data block */213190 secno code_page_data; /* sector number of a code_page_data214191 containing c.p. array */215215- unsigned short index; /* index in c.p. array in that sector*/216216- unsigned short unknown; /* some unknown value; usually 0;192192+ u16 index; /* index in c.p. array in that sector*/193193+ u16 unknown; /* some unknown value; usually 0;217194 2 in Japanese version */218195 } array[31]; /* unknown length */219196};···224201225202struct code_page_data226203{227227- unsigned magic; /* 8945 21f7 */228228- unsigned n_used; /* # elements used in c_p_data[] */229229- unsigned bounds[3]; /* looks a bit like204204+ u32 magic; /* 8945 21f7 */205205+ u32 n_used; /* # elements used in c_p_data[] */206206+ u32 bounds[3]; /* looks a bit like230207 (beg1,end1), (beg2,end2)231208 one byte each */232232- unsigned short offs[3]; /* offsets from start of sector209209+ u16 offs[3]; /* offsets from start of sector233210 to start of c_p_data[ix] */234211 struct {235235- unsigned short ix; /* index */236236- unsigned short code_page_number; /* code page number */237237- unsigned short unknown; /* the same as in cp directory */238238- unsigned char map[128]; /* upcase table for chars 80..ff */239239- unsigned short zero2;212212+ u16 ix; /* index */213213+ u16 code_page_number; /* code page number */214214+ u16 unknown; /* the same as in cp directory */215215+ u8 map[128]; /* upcase table for chars 80..ff */216216+ u16 zero2;240217 } code_page[3];241241- unsigned char incognita[78];218218+ u8 incognita[78];242219};243220244221···278255#define DNODE_MAGIC 0x77e40aae279256280257struct dnode {281281- unsigned magic; /* 77e4 0aae */282282- unsigned first_free; /* offset from start of dnode to258258+ u32 magic; /* 77e4 0aae */259259+ u32 first_free; /* offset from start of dnode to283260 first free dir entry */284284- unsigned root_dnode:1; /* Is it root dnode? */285285- unsigned increment_me:31; /* some kind of activity counter?286286- Neither HPFS.IFS nor CHKDSK cares261261+#ifdef __LITTLE_ENDIAN262262+ u8 root_dnode: 1; /* Is it root dnode? */263263+ u8 increment_me: 7; /* some kind of activity counter? */264264+ /* Neither HPFS.IFS nor CHKDSK cares287265 if you change this word */266266+#else267267+ u8 increment_me: 7; /* some kind of activity counter? */268268+ /* Neither HPFS.IFS nor CHKDSK cares269269+ if you change this word */270270+ u8 root_dnode: 1; /* Is it root dnode? */271271+#endif272272+ u8 increment_me2[3];288273 secno up; /* (root dnode) directory's fnode289274 (nonroot) parent dnode */290275 dnode_secno self; /* pointer to this dnode */291291- unsigned char dirent[2028]; /* one or more dirents */276276+ u8 dirent[2028]; /* one or more dirents */292277};293278294279struct hpfs_dirent {295295- unsigned short length; /* offset to next dirent */296296- unsigned first: 1; /* set on phony ^A^A (".") entry */297297- unsigned has_acl: 1;298298- unsigned down: 1; /* down pointer present (after name) */299299- unsigned last: 1; /* set on phony \377 entry */300300- unsigned has_ea: 1; /* entry has EA */301301- unsigned has_xtd_perm: 1; /* has extended perm list (???) */302302- unsigned has_explicit_acl: 1;303303- unsigned has_needea: 1; /* ?? some EA has NEEDEA set280280+ u16 length; /* offset to next dirent */281281+282282+#ifdef __LITTLE_ENDIAN283283+ u8 first: 1; /* set on phony ^A^A (".") entry */284284+ u8 has_acl: 1;285285+ u8 down: 1; /* down pointer present (after name) */286286+ u8 last: 1; /* set on phony \377 entry */287287+ u8 has_ea: 1; /* entry has EA */288288+ u8 has_xtd_perm: 1; /* has extended perm list (???) */289289+ u8 has_explicit_acl: 1;290290+ u8 has_needea: 1; /* ?? some EA has NEEDEA set304291 I have no idea why this is305292 interesting in a dir entry */306306- unsigned read_only: 1; /* dos attrib */307307- unsigned hidden: 1; /* dos attrib */308308- unsigned system: 1; /* dos attrib */309309- unsigned flag11: 1; /* would be volume label dos attrib */310310- unsigned directory: 1; /* dos attrib */311311- unsigned archive: 1; /* dos attrib */312312- unsigned not_8x3: 1; /* name is not 8.3 */313313- unsigned flag15: 1;293293+#else294294+ u8 has_needea: 1; /* ?? some EA has NEEDEA set295295+ I have no idea why this is296296+ interesting in a dir entry */297297+ u8 has_explicit_acl: 1;298298+ u8 has_xtd_perm: 1; /* has extended perm list (???) */299299+ u8 has_ea: 1; /* entry has EA */300300+ u8 last: 1; /* set on phony \377 entry */301301+ u8 down: 1; /* down pointer present (after name) */302302+ u8 has_acl: 1;303303+ u8 first: 1; /* set on phony ^A^A (".") entry */304304+#endif305305+306306+#ifdef __LITTLE_ENDIAN307307+ u8 read_only: 1; /* dos attrib */308308+ u8 hidden: 1; /* dos attrib */309309+ u8 system: 1; /* dos attrib */310310+ u8 flag11: 1; /* would be volume label dos attrib */311311+ u8 directory: 1; /* dos attrib */312312+ u8 archive: 1; /* dos attrib */313313+ u8 not_8x3: 1; /* name is not 8.3 */314314+ u8 flag15: 1;315315+#else316316+ u8 flag15: 1;317317+ u8 not_8x3: 1; /* name is not 8.3 */318318+ u8 archive: 1; /* dos attrib */319319+ u8 directory: 1; /* dos attrib */320320+ u8 flag11: 1; /* would be volume label dos attrib */321321+ u8 system: 1; /* dos attrib */322322+ u8 hidden: 1; /* dos attrib */323323+ u8 read_only: 1; /* dos attrib */324324+#endif325325+314326 fnode_secno fnode; /* fnode giving allocation info */315327 time32_t write_date; /* mtime */316316- unsigned file_size; /* file length, bytes */328328+ u32 file_size; /* file length, bytes */317329 time32_t read_date; /* atime */318330 time32_t creation_date; /* ctime */319319- unsigned ea_size; /* total EA length, bytes */320320- unsigned char no_of_acls : 3; /* number of ACL's */321321- unsigned char reserver : 5;322322- unsigned char ix; /* code page index (of filename), see331331+ u32 ea_size; /* total EA length, bytes */332332+ u8 no_of_acls; /* number of ACL's (low 3 bits) */333333+ u8 ix; /* code page index (of filename), see323334 struct code_page_data */324324- unsigned char namelen, name[1]; /* file name */335335+ u8 namelen, name[1]; /* file name */325336 /* dnode_secno down; btree down pointer, if present,326337 follows name on next word boundary, or maybe it327338 precedes next dirent, which is on a word boundary. */···375318376319struct bplus_leaf_node377320{378378- unsigned file_secno; /* first file sector in extent */379379- unsigned length; /* length, sectors */321321+ u32 file_secno; /* first file sector in extent */322322+ u32 length; /* length, sectors */380323 secno disk_secno; /* first corresponding disk sector */381324};382325383326struct bplus_internal_node384327{385385- unsigned file_secno; /* subtree maps sectors < this */328328+ u32 file_secno; /* subtree maps sectors < this */386329 anode_secno down; /* pointer to subtree */387330};388331389332struct bplus_header390333{391391- unsigned hbff: 1; /* high bit of first free entry offset */392392- unsigned flag1: 1;393393- unsigned flag2: 1;394394- unsigned flag3: 1;395395- unsigned flag4: 1;396396- unsigned fnode_parent: 1; /* ? we're pointed to by an fnode,334334+#ifdef __LITTLE_ENDIAN335335+ u8 hbff: 1; /* high bit of first free entry offset */336336+ u8 flag1234: 4;337337+ u8 fnode_parent: 1; /* ? we're pointed to by an fnode,397338 the data btree or some ea or the398339 main ea bootage pointer ea_secno */399340 /* also can get set in fnodes, which400341 may be a chkdsk glitch or may mean401342 this bit is irrelevant in fnodes,402343 or this interpretation is all wet */403403- unsigned binary_search: 1; /* suggest binary search (unused) */404404- unsigned internal: 1; /* 1 -> (internal) tree of anodes344344+ u8 binary_search: 1; /* suggest binary search (unused) */345345+ u8 internal: 1; /* 1 -> (internal) tree of anodes405346 0 -> (leaf) list of extents */406406- unsigned char fill[3];407407- unsigned char n_free_nodes; /* free nodes in following array */408408- unsigned char n_used_nodes; /* used nodes in following array */409409- unsigned short first_free; /* offset from start of header to347347+#else348348+ u8 internal: 1; /* 1 -> (internal) tree of anodes349349+ 0 -> (leaf) list of extents */350350+ u8 binary_search: 1; /* suggest binary search (unused) */351351+ u8 fnode_parent: 1; /* ? we're pointed to by an fnode,352352+ the data btree or some ea or the353353+ main ea bootage pointer ea_secno */354354+ /* also can get set in fnodes, which355355+ may be a chkdsk glitch or may mean356356+ this bit is irrelevant in fnodes,357357+ or this interpretation is all wet */358358+ u8 flag1234: 4;359359+ u8 hbff: 1; /* high bit of first free entry offset */360360+#endif361361+ u8 fill[3];362362+ u8 n_free_nodes; /* free nodes in following array */363363+ u8 n_used_nodes; /* used nodes in following array */364364+ u16 first_free; /* offset from start of header to410365 first free node in array */411366 union {412367 struct bplus_internal_node internal[0]; /* (internal) 2-word entries giving···438369439370struct fnode440371{441441- unsigned magic; /* f7e4 0aae */442442- unsigned zero1[2]; /* read history */443443- unsigned char len, name[15]; /* true length, truncated name */372372+ u32 magic; /* f7e4 0aae */373373+ u32 zero1[2]; /* read history */374374+ u8 len, name[15]; /* true length, truncated name */444375 fnode_secno up; /* pointer to file's directory fnode */445445- /*unsigned zero2[3];*/446376 secno acl_size_l;447377 secno acl_secno;448448- unsigned short acl_size_s;449449- char acl_anode;450450- char zero2; /* history bit count */451451- unsigned ea_size_l; /* length of disk-resident ea's */378378+ u16 acl_size_s;379379+ u8 acl_anode;380380+ u8 zero2; /* history bit count */381381+ u32 ea_size_l; /* length of disk-resident ea's */452382 secno ea_secno; /* first sector of disk-resident ea's*/453453- unsigned short ea_size_s; /* length of fnode-resident ea's */383383+ u16 ea_size_s; /* length of fnode-resident ea's */454384455455- unsigned flag0: 1;456456- unsigned ea_anode: 1; /* 1 -> ea_secno is an anode */457457- unsigned flag2: 1;458458- unsigned flag3: 1;459459- unsigned flag4: 1;460460- unsigned flag5: 1;461461- unsigned flag6: 1;462462- unsigned flag7: 1;463463- unsigned dirflag: 1; /* 1 -> directory. first & only extent385385+#ifdef __LITTLE_ENDIAN386386+ u8 flag0: 1;387387+ u8 ea_anode: 1; /* 1 -> ea_secno is an anode */388388+ u8 flag234567: 6;389389+#else390390+ u8 flag234567: 6;391391+ u8 ea_anode: 1; /* 1 -> ea_secno is an anode */392392+ u8 flag0: 1;393393+#endif394394+395395+#ifdef __LITTLE_ENDIAN396396+ u8 dirflag: 1; /* 1 -> directory. first & only extent464397 points to dnode. */465465- unsigned flag9: 1;466466- unsigned flag10: 1;467467- unsigned flag11: 1;468468- unsigned flag12: 1;469469- unsigned flag13: 1;470470- unsigned flag14: 1;471471- unsigned flag15: 1;398398+ u8 flag9012345: 7;399399+#else400400+ u8 flag9012345: 7;401401+ u8 dirflag: 1; /* 1 -> directory. first & only extent402402+ points to dnode. */403403+#endif472404473405 struct bplus_header btree; /* b+ tree, 8 extents or 12 subtrees */474406 union {···477407 struct bplus_internal_node internal[12];478408 } u;479409480480- unsigned file_size; /* file length, bytes */481481- unsigned n_needea; /* number of EA's with NEEDEA set */482482- char user_id[16]; /* unused */483483- unsigned short ea_offs; /* offset from start of fnode410410+ u32 file_size; /* file length, bytes */411411+ u32 n_needea; /* number of EA's with NEEDEA set */412412+ u8 user_id[16]; /* unused */413413+ u16 ea_offs; /* offset from start of fnode484414 to first fnode-resident ea */485485- char dasd_limit_treshhold;486486- char dasd_limit_delta;487487- unsigned dasd_limit;488488- unsigned dasd_usage;489489- /*unsigned zero5[2];*/490490- unsigned char ea[316]; /* zero or more EA's, packed together415415+ u8 dasd_limit_treshhold;416416+ u8 dasd_limit_delta;417417+ u32 dasd_limit;418418+ u32 dasd_usage;419419+ u8 ea[316]; /* zero or more EA's, packed together491420 with no alignment padding.492421 (Do not use this name, get here493422 via fnode + ea_offs. I think.) */···499430500431struct anode501432{502502- unsigned magic; /* 37e4 0aae */433433+ u32 magic; /* 37e4 0aae */503434 anode_secno self; /* pointer to this anode */504435 secno up; /* parent anode or fnode */505436···509440 struct bplus_internal_node internal[60];510441 } u;511442512512- unsigned fill[3]; /* unused */443443+ u32 fill[3]; /* unused */513444};514445515446···530461531462struct extended_attribute532463{533533- unsigned indirect: 1; /* 1 -> value gives sector number464464+#ifdef __LITTLE_ENDIAN465465+ u8 indirect: 1; /* 1 -> value gives sector number534466 where real value starts */535535- unsigned anode: 1; /* 1 -> sector is an anode467467+ u8 anode: 1; /* 1 -> sector is an anode536468 that points to fragmented value */537537- unsigned flag2: 1;538538- unsigned flag3: 1;539539- unsigned flag4: 1;540540- unsigned flag5: 1;541541- unsigned flag6: 1;542542- unsigned needea: 1; /* required ea */543543- unsigned char namelen; /* length of name, bytes */544544- unsigned short valuelen; /* length of value, bytes */545545- unsigned char name[0];469469+ u8 flag23456: 5;470470+ u8 needea: 1; /* required ea */471471+#else472472+ u8 needea: 1; /* required ea */473473+ u8 flag23456: 5;474474+ u8 anode: 1; /* 1 -> sector is an anode475475+ that points to fragmented value */476476+ u8 indirect: 1; /* 1 -> value gives sector number477477+ where real value starts */478478+#endif479479+ u8 namelen; /* length of name, bytes */480480+ u8 valuelen_lo; /* length of value, bytes */481481+ u8 valuelen_hi; /* length of value, bytes */482482+ u8 name[0];546483 /*547547- unsigned char name[namelen]; ascii attrib name548548- unsigned char nul; terminating '\0', not counted549549- unsigned char value[valuelen]; value, arbitrary484484+ u8 name[namelen]; ascii attrib name485485+ u8 nul; terminating '\0', not counted486486+ u8 value[valuelen]; value, arbitrary550487 if this.indirect, valuelen is 8 and the value is551551- unsigned length; real length of value, bytes488488+ u32 length; real length of value, bytes552489 secno secno; sector address where it starts553490 if this.anode, the above sector number is the root of an anode tree554491 which points to the value.
+37-43
fs/hpfs/hpfs_fn.h
···1313#include <linux/pagemap.h>1414#include <linux/buffer_head.h>1515#include <linux/slab.h>1616+#include <asm/unaligned.h>16171718#include "hpfs.h"1819···5251 unsigned i_disk_sec; /* (files) minimalist cache of alloc info */5352 unsigned i_n_secs; /* (files) minimalist cache of alloc info */5453 unsigned i_ea_size; /* size of extended attributes */5555- unsigned i_conv : 2; /* (files) crlf->newline hackery */5654 unsigned i_ea_mode : 1; /* file's permission is stored in ea */5755 unsigned i_ea_uid : 1; /* file's uid is stored in ea */5856 unsigned i_ea_gid : 1; /* file's gid is stored in ea */5957 unsigned i_dirty : 1;6060- struct mutex i_mutex;6161- struct mutex i_parent_mutex;6258 loff_t **i_rddir_off;6359 struct inode vfs_inode;6460};65616662struct hpfs_sb_info {6363+ struct mutex hpfs_mutex; /* global hpfs lock */6764 ino_t sb_root; /* inode number of root dir */6865 unsigned sb_fs_size; /* file system size, sectors */6966 unsigned sb_bitmaps; /* sector number of bitmap list */···7374 uid_t sb_uid; /* uid from mount options */7475 gid_t sb_gid; /* gid from mount options */7576 umode_t sb_mode; /* mode from mount options */7676- unsigned sb_conv : 2; /* crlf->newline hackery */7777 unsigned sb_eas : 2; /* eas: 0-ignore, 1-ro, 2-rw */7878 unsigned sb_err : 2; /* on errs: 0-cont, 1-ro, 2-panic */7979 unsigned sb_chk : 2; /* checks: 0-no, 1-normal, 2-strict */···8587 unsigned *sb_bmp_dir; /* main bitmap directory */8688 unsigned sb_c_bitmap; /* current bitmap */8789 unsigned sb_max_fwd_alloc; /* max forwad allocation */8888- struct mutex hpfs_creation_de; /* when creating dirents, nobody else8989- can alloc blocks */9090- /*unsigned sb_mounting : 1;*/9190 int sb_timeshift;9291};9393-9494-/*9595- * conv= options9696- */9797-9898-#define CONV_BINARY 0 /* no conversion */9999-#define CONV_TEXT 1 /* crlf->newline */100100-#define CONV_AUTO 2 /* decide based on file contents */1019210293/* Four 512-byte buffers and the 2k block obtained by concatenating them */10394···100113static inline dnode_secno de_down_pointer (struct hpfs_dirent *de)101114{102115 CHKCOND(de->down,("HPFS: de_down_pointer: !de->down\n"));103103- return *(dnode_secno *) ((void *) de + de->length - 4);116116+ return le32_to_cpu(*(dnode_secno *) ((void *) de + le16_to_cpu(de->length) - 4));104117}105118106119/* The first dir entry in a dnode */···114127115128static inline struct hpfs_dirent *dnode_end_de (struct dnode *dnode)116129{117117- CHKCOND(dnode->first_free>=0x14 && dnode->first_free<=0xa00,("HPFS: dnode_end_de: dnode->first_free = %d\n",(int)dnode->first_free));118118- return (void *) dnode + dnode->first_free;130130+ CHKCOND(le32_to_cpu(dnode->first_free)>=0x14 && le32_to_cpu(dnode->first_free)<=0xa00,("HPFS: dnode_end_de: dnode->first_free = %x\n",(unsigned)le32_to_cpu(dnode->first_free)));131131+ return (void *) dnode + le32_to_cpu(dnode->first_free);119132}120133121134/* The dir entry after dir entry de */122135123136static inline struct hpfs_dirent *de_next_de (struct hpfs_dirent *de)124137{125125- CHKCOND(de->length>=0x20 && de->length<0x800,("HPFS: de_next_de: de->length = %d\n",(int)de->length));126126- return (void *) de + de->length;138138+ CHKCOND(le16_to_cpu(de->length)>=0x20 && le16_to_cpu(de->length)<0x800,("HPFS: de_next_de: de->length = %x\n",(unsigned)le16_to_cpu(de->length)));139139+ return (void *) de + le16_to_cpu(de->length);127140}128141129142static inline struct extended_attribute *fnode_ea(struct fnode *fnode)130143{131131- return (struct extended_attribute *)((char *)fnode + fnode->ea_offs + fnode->acl_size_s);144144+ return (struct extended_attribute *)((char *)fnode + le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s));132145}133146134147static inline struct extended_attribute *fnode_end_ea(struct fnode *fnode)135148{136136- return (struct extended_attribute *)((char *)fnode + fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s);149149+ return (struct extended_attribute *)((char *)fnode + le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s) + le16_to_cpu(fnode->ea_size_s));150150+}151151+152152+static unsigned ea_valuelen(struct extended_attribute *ea)153153+{154154+ return ea->valuelen_lo + 256 * ea->valuelen_hi;137155}138156139157static inline struct extended_attribute *next_ea(struct extended_attribute *ea)140158{141141- return (struct extended_attribute *)((char *)ea + 5 + ea->namelen + ea->valuelen);159159+ return (struct extended_attribute *)((char *)ea + 5 + ea->namelen + ea_valuelen(ea));142160}143161144162static inline secno ea_sec(struct extended_attribute *ea)145163{146146- return *(secno *)((char *)ea + 9 + ea->namelen);164164+ return le32_to_cpu(get_unaligned((secno *)((char *)ea + 9 + ea->namelen)));147165}148166149167static inline secno ea_len(struct extended_attribute *ea)150168{151151- return *(secno *)((char *)ea + 5 + ea->namelen);169169+ return le32_to_cpu(get_unaligned((secno *)((char *)ea + 5 + ea->namelen)));152170}153171154172static inline char *ea_data(struct extended_attribute *ea)···178186 dst->not_8x3 = n;179187}180188181181-static inline unsigned tstbits(unsigned *bmp, unsigned b, unsigned n)189189+static inline unsigned tstbits(u32 *bmp, unsigned b, unsigned n)182190{183191 int i;184192 if ((b >= 0x4000) || (b + n - 1 >= 0x4000)) return n;185185- if (!((bmp[(b & 0x3fff) >> 5] >> (b & 0x1f)) & 1)) return 1;193193+ if (!((le32_to_cpu(bmp[(b & 0x3fff) >> 5]) >> (b & 0x1f)) & 1)) return 1;186194 for (i = 1; i < n; i++)187187- if (/*b+i < 0x4000 &&*/ !((bmp[((b+i) & 0x3fff) >> 5] >> ((b+i) & 0x1f)) & 1))195195+ if (!((le32_to_cpu(bmp[((b+i) & 0x3fff) >> 5]) >> ((b+i) & 0x1f)) & 1))188196 return i + 1;189197 return 0;190198}···192200/* alloc.c */193201194202int hpfs_chk_sectors(struct super_block *, secno, int, char *);195195-secno hpfs_alloc_sector(struct super_block *, secno, unsigned, int, int);203203+secno hpfs_alloc_sector(struct super_block *, secno, unsigned, int);196204int hpfs_alloc_if_possible(struct super_block *, secno);197205void hpfs_free_sectors(struct super_block *, secno, unsigned);198206int hpfs_check_free_dnodes(struct super_block *, int);199207void hpfs_free_dnode(struct super_block *, secno);200200-struct dnode *hpfs_alloc_dnode(struct super_block *, secno, dnode_secno *, struct quad_buffer_head *, int);208208+struct dnode *hpfs_alloc_dnode(struct super_block *, secno, dnode_secno *, struct quad_buffer_head *);201209struct fnode *hpfs_alloc_fnode(struct super_block *, secno, fnode_secno *, struct buffer_head **);202210struct anode *hpfs_alloc_anode(struct super_block *, secno, anode_secno *, struct buffer_head **);203211···214222215223/* buffer.c */216224217217-void hpfs_lock_creation(struct super_block *);218218-void hpfs_unlock_creation(struct super_block *);219225void *hpfs_map_sector(struct super_block *, unsigned, struct buffer_head **, int);220226void *hpfs_get_sector(struct super_block *, unsigned, struct buffer_head **);221227void *hpfs_map_4sectors(struct super_block *, unsigned, struct quad_buffer_head *, int);···237247struct hpfs_dirent *hpfs_add_de(struct super_block *, struct dnode *,238248 const unsigned char *, unsigned, secno);239249int hpfs_add_dirent(struct inode *, const unsigned char *, unsigned,240240- struct hpfs_dirent *, int);250250+ struct hpfs_dirent *);241251int hpfs_remove_dirent(struct inode *, dnode_secno, struct hpfs_dirent *, struct quad_buffer_head *, int);242252void hpfs_count_dnodes(struct super_block *, dnode_secno, int *, int *, int *);243253dnode_secno hpfs_de_as_down_as_possible(struct super_block *, dnode_secno dno);···293303 const unsigned char *, unsigned, int);294304int hpfs_is_name_long(const unsigned char *, unsigned);295305void hpfs_adjust_length(const unsigned char *, unsigned *);296296-void hpfs_decide_conv(struct inode *, const unsigned char *, unsigned);297306298307/* namei.c */299308···335346/*336347 * Locking:337348 *338338- * hpfs_lock() is a leftover from the big kernel lock.339339- * Right now, these functions are empty and only left340340- * for documentation purposes. The file system no longer341341- * works on SMP systems, so the lock is not needed342342- * any more.349349+ * hpfs_lock() locks the whole filesystem. It must be taken350350+ * on any method called by the VFS.343351 *344344- * If someone is interested in making it work again, this345345- * would be the place to start by adding a per-superblock346346- * mutex and fixing all the bugs and performance issues347347- * caused by that.352352+ * We don't do any per-file locking anymore, it is hard to353353+ * review and HPFS is not performance-sensitive anyway.348354 */349355static inline void hpfs_lock(struct super_block *s)350356{357357+ struct hpfs_sb_info *sbi = hpfs_sb(s);358358+ mutex_lock(&sbi->hpfs_mutex);351359}352360353361static inline void hpfs_unlock(struct super_block *s)354362{363363+ struct hpfs_sb_info *sbi = hpfs_sb(s);364364+ mutex_unlock(&sbi->hpfs_mutex);365365+}366366+367367+static inline void hpfs_lock_assert(struct super_block *s)368368+{369369+ struct hpfs_sb_info *sbi = hpfs_sb(s);370370+ WARN_ON(!mutex_is_locked(&sbi->hpfs_mutex));355371}
···4646#include <linux/nfs4.h>4747#include <linux/nfs_fs.h>4848#include <linux/nfs_page.h>4949+#include <linux/nfs_mount.h>4950#include <linux/namei.h>5051#include <linux/mount.h>5152#include <linux/module.h>···444443 if (res->sr_status == 1)445444 res->sr_status = NFS_OK;446445447447- /* -ERESTARTSYS can result in skipping nfs41_sequence_setup */448448- if (!res->sr_slot)446446+ /* don't increment the sequence number if the task wasn't sent */447447+ if (!RPC_WAS_SENT(task))449448 goto out;450449451450 /* Check the SEQUENCE operation status */···21862185 struct nfs4_exception exception = { };21872186 int err;21882187 do {21892189- err = nfs4_handle_exception(server,21902190- _nfs4_lookup_root(server, fhandle, info),21912191- &exception);21882188+ err = _nfs4_lookup_root(server, fhandle, info);21892189+ switch (err) {21902190+ case 0:21912191+ case -NFS4ERR_WRONGSEC:21922192+ break;21932193+ default:21942194+ err = nfs4_handle_exception(server, err, &exception);21952195+ }21922196 } while (exception.retry);21932197 return err;21942198}···22142208 return ret;22152209}2216221022112211+static int nfs4_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,22122212+ struct nfs_fsinfo *info)22132213+{22142214+ int i, len, status = 0;22152215+ rpc_authflavor_t flav_array[NFS_MAX_SECFLAVORS];22162216+22172217+ len = gss_mech_list_pseudoflavors(&flav_array[0]);22182218+ flav_array[len] = RPC_AUTH_NULL;22192219+ len += 1;22202220+22212221+ for (i = 0; i < len; i++) {22222222+ status = nfs4_lookup_root_sec(server, fhandle, info, flav_array[i]);22232223+ if (status == -NFS4ERR_WRONGSEC || status == -EACCES)22242224+ continue;22252225+ break;22262226+ }22272227+ /*22282228+ * -EACCESS could mean that the user doesn't have correct permissions22292229+ * to access the mount. It could also mean that we tried to mount22302230+ * with a gss auth flavor, but rpc.gssd isn't running. Either way,22312231+ * existing mount programs don't handle -EACCES very well so it should22322232+ * be mapped to -EPERM instead.22332233+ */22342234+ if (status == -EACCES)22352235+ status = -EPERM;22362236+ return status;22372237+}22382238+22172239/*22182240 * get the file handle for the "/" directory on the server22192241 */22202242static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,22212243 struct nfs_fsinfo *info)22222244{22232223- int i, len, status = 0;22242224- rpc_authflavor_t flav_array[NFS_MAX_SECFLAVORS + 2];22252225-22262226- flav_array[0] = RPC_AUTH_UNIX;22272227- len = gss_mech_list_pseudoflavors(&flav_array[1]);22282228- flav_array[1+len] = RPC_AUTH_NULL;22292229- len += 2;22302230-22312231- for (i = 0; i < len; i++) {22322232- status = nfs4_lookup_root_sec(server, fhandle, info, flav_array[i]);22332233- if (status != -EPERM)22342234- break;22352235- }22452245+ int status = nfs4_lookup_root(server, fhandle, info);22462246+ if ((status == -NFS4ERR_WRONGSEC) && !(server->flags & NFS_MOUNT_SECFLAVOUR))22472247+ /*22482248+ * A status of -NFS4ERR_WRONGSEC will be mapped to -EPERM22492249+ * by nfs4_map_errors() as this function exits.22502250+ */22512251+ status = nfs4_find_root_sec(server, fhandle, info);22362252 if (status == 0)22372253 status = nfs4_server_capabilities(server, fhandle);22382254 if (status == 0)···37513723 sizeof(setclientid.sc_uaddr), "%s.%u.%u",37523724 clp->cl_ipaddr, port >> 8, port & 255);3753372537543754- status = rpc_call_sync(clp->cl_rpcclient, &msg, 0);37263726+ status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);37553727 if (status != -NFS4ERR_CLID_INUSE)37563728 break;37573757- if (signalled())37293729+ if (loop != 0) {37303730+ ++clp->cl_id_uniquifier;37583731 break;37593759- if (loop++ & 1)37603760- ssleep(clp->cl_lease_time / HZ + 1);37613761- else37623762- if (++clp->cl_id_uniquifier == 0)37633763- break;37323732+ }37333733+ ++loop;37343734+ ssleep(clp->cl_lease_time / HZ + 1);37643735 }37653736 return status;37663737}3767373837683768-static int _nfs4_proc_setclientid_confirm(struct nfs_client *clp,37393739+int nfs4_proc_setclientid_confirm(struct nfs_client *clp,37693740 struct nfs4_setclientid_res *arg,37703741 struct rpc_cred *cred)37713742{···37793752 int status;3780375337813754 now = jiffies;37823782- status = rpc_call_sync(clp->cl_rpcclient, &msg, 0);37553755+ status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);37833756 if (status == 0) {37843757 spin_lock(&clp->cl_lock);37853758 clp->cl_lease_time = fsinfo.lease_time * HZ;···37873760 spin_unlock(&clp->cl_lock);37883761 }37893762 return status;37903790-}37913791-37923792-int nfs4_proc_setclientid_confirm(struct nfs_client *clp,37933793- struct nfs4_setclientid_res *arg,37943794- struct rpc_cred *cred)37953795-{37963796- long timeout = 0;37973797- int err;37983798- do {37993799- err = _nfs4_proc_setclientid_confirm(clp, arg, cred);38003800- switch (err) {38013801- case 0:38023802- return err;38033803- case -NFS4ERR_RESOURCE:38043804- /* The IBM lawyers misread another document! */38053805- case -NFS4ERR_DELAY:38063806- err = nfs4_delay(clp->cl_rpcclient, &timeout);38073807- }38083808- } while (err == 0);38093809- return err;38103763}3811376438123765struct nfs4_delegreturndata {···47934786 init_utsname()->domainname,47944787 clp->cl_rpcclient->cl_auth->au_flavor);4795478847964796- status = rpc_call_sync(clp->cl_rpcclient, &msg, 0);47894789+ status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);47974790 if (!status)47984791 status = nfs4_check_cl_exchange_flags(clp->cl_exchange_flags);47994792 dprintk("<-- %s status= %d\n", __func__, status);···48764869 .rpc_client = clp->cl_rpcclient,48774870 .rpc_message = &msg,48784871 .callback_ops = &nfs4_get_lease_time_ops,48794879- .callback_data = &data48724872+ .callback_data = &data,48734873+ .flags = RPC_TASK_TIMEOUT,48804874 };48814875 int status;48824876···51795171 nfs4_init_channel_attrs(&args);51805172 args.flags = (SESSION4_PERSIST | SESSION4_BACK_CHAN);5181517351825182- status = rpc_call_sync(session->clp->cl_rpcclient, &msg, 0);51745174+ status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);5183517551845176 if (!status)51855177 /* Verify the session's negotiated channel_attrs values */···52025194 int status;52035195 unsigned *ptr;52045196 struct nfs4_session *session = clp->cl_session;52055205- long timeout = 0;52065206- int err;5207519752085198 dprintk("--> %s clp=%p session=%p\n", __func__, clp, session);5209519952105210- do {52115211- status = _nfs4_proc_create_session(clp);52125212- if (status == -NFS4ERR_DELAY) {52135213- err = nfs4_delay(clp->cl_rpcclient, &timeout);52145214- if (err)52155215- status = err;52165216- }52175217- } while (status == -NFS4ERR_DELAY);52185218-52005200+ status = _nfs4_proc_create_session(clp);52195201 if (status)52205202 goto out;52215203···52465248 msg.rpc_argp = session;52475249 msg.rpc_resp = NULL;52485250 msg.rpc_cred = NULL;52495249- status = rpc_call_sync(session->clp->cl_rpcclient, &msg, 0);52515251+ status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);5250525252515253 if (status)52525254 printk(KERN_WARNING
+34-17
fs/nfs/nfs4state.c
···64646565int nfs4_init_clientid(struct nfs_client *clp, struct rpc_cred *cred)6666{6767- struct nfs4_setclientid_res clid;6767+ struct nfs4_setclientid_res clid = {6868+ .clientid = clp->cl_clientid,6969+ .confirm = clp->cl_confirm,7070+ };6871 unsigned short port;6972 int status;70737474+ if (test_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state))7575+ goto do_confirm;7176 port = nfs_callback_tcpport;7277 if (clp->cl_addr.ss_family == AF_INET6)7378 port = nfs_callback_tcpport6;···8075 status = nfs4_proc_setclientid(clp, NFS4_CALLBACK, port, cred, &clid);8176 if (status != 0)8277 goto out;7878+ clp->cl_clientid = clid.clientid;7979+ clp->cl_confirm = clid.confirm;8080+ set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);8181+do_confirm:8382 status = nfs4_proc_setclientid_confirm(clp, &clid, cred);8483 if (status != 0)8584 goto out;8686- clp->cl_clientid = clid.clientid;8585+ clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);8786 nfs4_schedule_state_renewal(clp);8887out:8988 return status;···239230{240231 int status;241232233233+ if (test_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state))234234+ goto do_confirm;242235 nfs4_begin_drain_session(clp);243236 status = nfs4_proc_exchange_id(clp, cred);244237 if (status != 0)245238 goto out;239239+ set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);240240+do_confirm:246241 status = nfs4_proc_create_session(clp);247242 if (status != 0)248243 goto out;244244+ clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);249245 nfs41_setup_state_renewal(clp);250246 nfs_mark_client_ready(clp, NFS_CS_READY);251247out:···15981584 */15991585static void nfs4_set_lease_expired(struct nfs_client *clp, int status)16001586{16011601- if (nfs4_has_session(clp)) {16021602- switch (status) {16031603- case -NFS4ERR_DELAY:16041604- case -NFS4ERR_CLID_INUSE:16051605- case -EAGAIN:16061606- break;15871587+ switch (status) {15881588+ case -NFS4ERR_CLID_INUSE:15891589+ case -NFS4ERR_STALE_CLIENTID:15901590+ clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);15911591+ break;15921592+ case -NFS4ERR_DELAY:15931593+ case -ETIMEDOUT:15941594+ case -EAGAIN:15951595+ ssleep(1);15961596+ break;1607159716081608- case -EKEYEXPIRED:16091609- nfs4_warn_keyexpired(clp->cl_hostname);16101610- case -NFS4ERR_NOT_SAME: /* FixMe: implement recovery16111611- * in nfs4_exchange_id */16121612- default:16131613- return;16141614- }15981598+ case -EKEYEXPIRED:15991599+ nfs4_warn_keyexpired(clp->cl_hostname);16001600+ case -NFS4ERR_NOT_SAME: /* FixMe: implement recovery16011601+ * in nfs4_exchange_id */16021602+ default:16031603+ return;16151604 }16161605 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);16171606}···16241607 int status = 0;1625160816261609 /* Ensure exclusive access to NFSv4 state */16271627- for(;;) {16101610+ do {16281611 if (test_and_clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) {16291612 /* We're going to have to re-establish a clientid */16301613 status = nfs4_reclaim_lease(clp);···17081691 break;17091692 if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0)17101693 break;17111711- }16941694+ } while (atomic_read(&clp->cl_count) > 1);17121695 return;17131696out_error:17141697 printk(KERN_WARNING "Error: state manager failed on NFSv4 server %s"
+28-25
fs/nfs/nfs4xdr.c
···1452145214531453static void encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req, struct compound_hdr *hdr)14541454{14551455- uint32_t attrs[2] = {0, 0};14551455+ uint32_t attrs[2] = {14561456+ FATTR4_WORD0_RDATTR_ERROR,14571457+ FATTR4_WORD1_MOUNTED_ON_FILEID,14581458+ };14561459 uint32_t dircount = readdir->count >> 1;14571460 __be32 *p;1458146114591462 if (readdir->plus) {14601463 attrs[0] |= FATTR4_WORD0_TYPE|FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE|14611461- FATTR4_WORD0_FSID|FATTR4_WORD0_FILEHANDLE;14641464+ FATTR4_WORD0_FSID|FATTR4_WORD0_FILEHANDLE|FATTR4_WORD0_FILEID;14621465 attrs[1] |= FATTR4_WORD1_MODE|FATTR4_WORD1_NUMLINKS|FATTR4_WORD1_OWNER|14631466 FATTR4_WORD1_OWNER_GROUP|FATTR4_WORD1_RAWDEV|14641467 FATTR4_WORD1_SPACE_USED|FATTR4_WORD1_TIME_ACCESS|14651468 FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY;14661469 dircount >>= 1;14671470 }14681468- attrs[0] |= FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID;14691469- attrs[1] |= FATTR4_WORD1_MOUNTED_ON_FILEID;14701470- /* Switch to mounted_on_fileid if the server supports it */14711471- if (readdir->bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)14721472- attrs[0] &= ~FATTR4_WORD0_FILEID;14731473- else14741474- attrs[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID;14711471+ /* Use mounted_on_fileid only if the server supports it */14721472+ if (!(readdir->bitmask[1] & FATTR4_WORD1_MOUNTED_ON_FILEID))14731473+ attrs[0] |= FATTR4_WORD0_FILEID;1475147414761475 p = reserve_space(xdr, 12+NFS4_VERIFIER_SIZE+20);14771476 *p++ = cpu_to_be32(OP_READDIR);···31393140 goto out_overflow;31403141 xdr_decode_hyper(p, fileid);31413142 bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID;31423142- ret = NFS_ATTR_FATTR_FILEID;31433143+ ret = NFS_ATTR_FATTR_MOUNTED_ON_FILEID;31433144 }31443145 dprintk("%s: fileid=%Lu\n", __func__, (unsigned long long)*fileid);31453146 return ret;···40014002{40024003 int status;40034004 umode_t fmode = 0;40044004- uint64_t fileid;40054005 uint32_t type;4006400640074007 status = decode_attr_type(xdr, bitmap, &type);···40994101 goto xdr_error;41004102 fattr->valid |= status;4101410341024102- status = decode_attr_mounted_on_fileid(xdr, bitmap, &fileid);41044104+ status = decode_attr_mounted_on_fileid(xdr, bitmap, &fattr->mounted_on_fileid);41034105 if (status < 0)41044106 goto xdr_error;41054105- if (status != 0 && !(fattr->valid & status)) {41064106- fattr->fileid = fileid;41074107- fattr->valid |= status;41084108- }41074107+ fattr->valid |= status;4109410841104109xdr_error:41114110 dprintk("%s: xdr returned %d\n", __func__, -status);···48334838 struct nfs4_secinfo_flavor *sec_flavor;48344839 int status;48354840 __be32 *p;48364836- int i;48414841+ int i, num_flavors;4837484248384843 status = decode_op_hdr(xdr, OP_SECINFO);48444844+ if (status)48454845+ goto out;48394846 p = xdr_inline_decode(xdr, 4);48404847 if (unlikely(!p))48414848 goto out_overflow;48424842- res->flavors->num_flavors = be32_to_cpup(p);4843484948444844- for (i = 0; i < res->flavors->num_flavors; i++) {48504850+ res->flavors->num_flavors = 0;48514851+ num_flavors = be32_to_cpup(p);48524852+48534853+ for (i = 0; i < num_flavors; i++) {48454854 sec_flavor = &res->flavors->flavors[i];48464846- if ((char *)&sec_flavor[1] - (char *)res > PAGE_SIZE)48554855+ if ((char *)&sec_flavor[1] - (char *)res->flavors > PAGE_SIZE)48474856 break;4848485748494858 p = xdr_inline_decode(xdr, 4);···48564857 sec_flavor->flavor = be32_to_cpup(p);4857485848584859 if (sec_flavor->flavor == RPC_AUTH_GSS) {48594859- if (decode_secinfo_gss(xdr, sec_flavor))48604860- break;48604860+ status = decode_secinfo_gss(xdr, sec_flavor);48614861+ if (status)48624862+ goto out;48614863 }48644864+ res->flavors->num_flavors++;48624865 }4863486648644864- return 0;48654865-48674867+out:48684868+ return status;48664869out_overflow:48674870 print_overflow_msg(__func__, xdr);48684871 return -EIO;···64096408 if (decode_getfattr_attrs(xdr, bitmap, entry->fattr, entry->fh,64106409 entry->server, 1) < 0)64116410 goto out_overflow;64126412- if (entry->fattr->valid & NFS_ATTR_FATTR_FILEID)64116411+ if (entry->fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID)64126412+ entry->ino = entry->fattr->mounted_on_fileid;64136413+ else if (entry->fattr->valid & NFS_ATTR_FATTR_FILEID)64136414 entry->ino = entry->fattr->fileid;6414641564156416 entry->d_type = DT_UNKNOWN;
+7-1
fs/nfs/pnfs.c
···10041004{10051005 struct nfs_inode *nfsi = NFS_I(wdata->inode);10061006 loff_t end_pos = wdata->args.offset + wdata->res.count;10071007+ bool mark_as_dirty = false;1007100810081009 spin_lock(&nfsi->vfs_inode.i_lock);10091010 if (!test_and_set_bit(NFS_INO_LAYOUTCOMMIT, &nfsi->flags)) {···10121011 get_lseg(wdata->lseg);10131012 wdata->lseg->pls_lc_cred =10141013 get_rpccred(wdata->args.context->state->owner->so_cred);10151015- mark_inode_dirty_sync(wdata->inode);10141014+ mark_as_dirty = true;10161015 dprintk("%s: Set layoutcommit for inode %lu ",10171016 __func__, wdata->inode->i_ino);10181017 }10191018 if (end_pos > wdata->lseg->pls_end_pos)10201019 wdata->lseg->pls_end_pos = end_pos;10211020 spin_unlock(&nfsi->vfs_inode.i_lock);10211021+10221022+ /* if pnfs_layoutcommit_inode() runs between inode locks, the next one10231023+ * will be a noop because NFS_INO_LAYOUTCOMMIT will not be set */10241024+ if (mark_as_dirty)10251025+ mark_inode_dirty_sync(wdata->inode);10221026}10231027EXPORT_SYMBOL_GPL(pnfs_set_layoutcommit);10241028
+11-2
fs/nfs/super.c
···10041004 return 0;10051005 }1006100610071007+ mnt->flags |= NFS_MOUNT_SECFLAVOUR;10071008 mnt->auth_flavor_len = 1;10081009 return 1;10091010}···19771976 if (error < 0)19781977 goto out;1979197819791979+ /*19801980+ * noac is a special case. It implies -o sync, but that's not19811981+ * necessarily reflected in the mtab options. do_remount_sb19821982+ * will clear MS_SYNCHRONOUS if -o sync wasn't specified in the19831983+ * remount options, so we have to explicitly reset it.19841984+ */19851985+ if (data->flags & NFS_MOUNT_NOAC)19861986+ *flags |= MS_SYNCHRONOUS;19871987+19801988 /* compare new mount options with old ones */19811989 error = nfs_compare_remount_data(nfss, data);19821990out:···22452235 if (!s->s_root) {22462236 /* initial superblock/root creation */22472237 nfs_fill_super(s, data);22482248- nfs_fscache_get_super_cookie(22492249- s, data ? data->fscache_uniq : NULL, NULL);22382238+ nfs_fscache_get_super_cookie(s, data->fscache_uniq, NULL);22502239 }2251224022522241 mntroot = nfs_get_root(s, mntfh, dev_name);
···10191019 __le16 xe_name_offset; /* byte offset from the 1st entry in the10201020 local xattr storage(inode, xattr block or10211021 xattr bucket). */10221022- __u8 xe_name_len; /* xattr name len, does't include prefix. */10221022+ __u8 xe_name_len; /* xattr name len, doesn't include prefix. */10231023 __u8 xe_type; /* the low 7 bits indicate the name prefix10241024 * type and the highest bit indicates whether10251025 * the EA is stored in the local storage. */
+6
fs/partitions/efi.c
···348348 goto fail;349349 }350350351351+ /* Check that sizeof_partition_entry has the correct value */352352+ if (le32_to_cpu((*gpt)->sizeof_partition_entry) != sizeof(gpt_entry)) {353353+ pr_debug("GUID Partitition Entry Size check failed.\n");354354+ goto fail;355355+ }356356+351357 if (!(*ptes = alloc_read_gpt_entries(state, *gpt)))352358 goto fail;353359
+7-5
fs/proc/task_mmu.c
···214214 int flags = vma->vm_flags;215215 unsigned long ino = 0;216216 unsigned long long pgoff = 0;217217- unsigned long start;217217+ unsigned long start, end;218218 dev_t dev = 0;219219 int len;220220···227227228228 /* We don't show the stack guard page in /proc/maps */229229 start = vma->vm_start;230230- if (vma->vm_flags & VM_GROWSDOWN)231231- if (!vma_stack_continue(vma->vm_prev, vma->vm_start))232232- start += PAGE_SIZE;230230+ if (stack_guard_page_start(vma, start))231231+ start += PAGE_SIZE;232232+ end = vma->vm_end;233233+ if (stack_guard_page_end(vma, end))234234+ end -= PAGE_SIZE;233235234236 seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",235237 start,236236- vma->vm_end,238238+ end,237239 flags & VM_READ ? 'r' : '-',238240 flags & VM_WRITE ? 'w' : '-',239241 flags & VM_EXEC ? 'x' : '-',
-20
fs/ubifs/log.c
···175175}176176177177/**178178- * ubifs_create_buds_lists - create journal head buds lists for remount rw.179179- * @c: UBIFS file-system description object180180- */181181-void ubifs_create_buds_lists(struct ubifs_info *c)182182-{183183- struct rb_node *p;184184-185185- spin_lock(&c->buds_lock);186186- p = rb_first(&c->buds);187187- while (p) {188188- struct ubifs_bud *bud = rb_entry(p, struct ubifs_bud, rb);189189- struct ubifs_jhead *jhead = &c->jheads[bud->jhead];190190-191191- list_add_tail(&bud->list, &jhead->buds_list);192192- p = rb_next(p);193193- }194194- spin_unlock(&c->buds_lock);195195-}196196-197197-/**198178 * ubifs_add_bud_to_log - add a new bud to the log.199179 * @c: UBIFS file-system description object200180 * @jhead: journal head the bud belongs to
+12-6
fs/ubifs/replay.c
···5959 * @new_size: truncation new size6060 * @free: amount of free space in a bud6161 * @dirty: amount of dirty space in a bud from padding and deletion nodes6262+ * @jhead: journal head number of the bud6263 *6364 * UBIFS journal replay must compare node sequence numbers, which means it must6465 * build a tree of node information to insert into the TNC.···8180 struct {8281 int free;8382 int dirty;8383+ int jhead;8484 };8585 };8686};···161159 err = PTR_ERR(lp);162160 goto out;163161 }162162+163163+ /* Make sure the journal head points to the latest bud */164164+ err = ubifs_wbuf_seek_nolock(&c->jheads[r->jhead].wbuf, r->lnum,165165+ c->leb_size - r->free, UBI_SHORTTERM);166166+164167out:165168 ubifs_release_lprops(c);166169 return err;···634627 ubifs_assert(sleb->endpt - offs >= used);635628 ubifs_assert(sleb->endpt % c->min_io_size == 0);636629637637- if (sleb->endpt + c->min_io_size <= c->leb_size && !c->ro_mount)638638- err = ubifs_wbuf_seek_nolock(&c->jheads[jhead].wbuf, lnum,639639- sleb->endpt, UBI_SHORTTERM);640640-641630 *dirty = sleb->endpt - offs - used;642631 *free = c->leb_size - sleb->endpt;643632···656653 * @sqnum: sequence number657654 * @free: amount of free space in bud658655 * @dirty: amount of dirty space from padding and deletion nodes656656+ * @jhead: journal head number for the bud659657 *660658 * This function inserts a reference node to the replay tree and returns zero661659 * in case of success or a negative error code in case of failure.662660 */663661static int insert_ref_node(struct ubifs_info *c, int lnum, int offs,664664- unsigned long long sqnum, int free, int dirty)662662+ unsigned long long sqnum, int free, int dirty,663663+ int jhead)665664{666665 struct rb_node **p = &c->replay_tree.rb_node, *parent = NULL;667666 struct replay_entry *r;···693688 r->flags = REPLAY_REF;694689 r->free = free;695690 r->dirty = dirty;691691+ r->jhead = jhead;696692697693 rb_link_node(&r->rb, parent, p);698694 rb_insert_color(&r->rb, &c->replay_tree);···718712 if (err)719713 return err;720714 err = insert_ref_node(c, b->bud->lnum, b->bud->start, b->sqnum,721721- free, dirty);715715+ free, dirty, b->bud->jhead);722716 if (err)723717 return err;724718 }
+4-11
fs/ubifs/super.c
···12571257 goto out_free;12581258 }1259125912601260+ err = alloc_wbufs(c);12611261+ if (err)12621262+ goto out_cbuf;12631263+12601264 sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, c->vi.vol_id);12611265 if (!c->ro_mount) {12621262- err = alloc_wbufs(c);12631263- if (err)12641264- goto out_cbuf;12651265-12661266 /* Create background thread */12671267 c->bgt = kthread_create(ubifs_bg_thread, c, "%s", c->bgt_name);12681268 if (IS_ERR(c->bgt)) {···16311631 if (err)16321632 goto out;1633163316341634- err = alloc_wbufs(c);16351635- if (err)16361636- goto out;16371637-16381638- ubifs_create_buds_lists(c);16391639-16401634 /* Create background thread */16411635 c->bgt = kthread_create(ubifs_bg_thread, c, "%s", c->bgt_name);16421636 if (IS_ERR(c->bgt)) {···17381744 if (err)17391745 ubifs_ro_mode(c, err);1740174617411741- free_wbufs(c);17421747 vfree(c->orph_buf);17431748 c->orph_buf = NULL;17441749 kfree(c->write_reserve_buf);
···909909#define RADEON_INFO_WANT_CMASK 0x08 /* get access to CMASK on r300 */910910#define RADEON_INFO_CLOCK_CRYSTAL_FREQ 0x09 /* clock crystal frequency */911911#define RADEON_INFO_NUM_BACKENDS 0x0a /* DB/backends for r600+ - need for OQ */912912+#define RADEON_INFO_NUM_TILE_PIPES 0x0b /* tile pipes for r600+ */913913+#define RADEON_INFO_FUSION_GART_WORKING 0x0c /* fusion writes to GTT were broken before this */912914913915struct drm_radeon_info {914916 uint32_t request;
+1-1
include/linux/flex_array.h
···6161struct flex_array *flex_array_alloc(int element_size, unsigned int total,6262 gfp_t flags);6363int flex_array_prealloc(struct flex_array *fa, unsigned int start,6464- unsigned int end, gfp_t flags);6464+ unsigned int nr_elements, gfp_t flags);6565void flex_array_free(struct flex_array *fa);6666void flex_array_free_parts(struct flex_array *fa);6767int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src,
+1
include/linux/ftrace_event.h
···3737 unsigned char flags;3838 unsigned char preempt_count;3939 int pid;4040+ int padding;4041};41424243#define FTRACE_MAX_EVENT \
+1-1
include/linux/huge_mm.h
···117117 unsigned long end,118118 long adjust_next)119119{120120- if (!vma->anon_vma || vma->vm_ops || vma->vm_file)120120+ if (!vma->anon_vma || vma->vm_ops)121121 return;122122 __vma_adjust_trans_huge(vma, start, end, adjust_next);123123}
+2
include/linux/mfd/wm831x/pdata.h
···8181 int rpu; /** Pen down sensitivity resistor divider */8282 int pressure; /** Report pressure (boolean) */8383 unsigned int data_irq; /** Touch data ready IRQ */8484+ int data_irqf; /** IRQ flags for data ready IRQ */8485 unsigned int pd_irq; /** Touch pendown detect IRQ */8686+ int pd_irqf; /** IRQ flags for pen down IRQ */8587};86888789enum wm831x_watchdog_action {
+25-2
include/linux/mm.h
···137137#define VM_RandomReadHint(v) ((v)->vm_flags & VM_RAND_READ)138138139139/*140140- * special vmas that are non-mergable, non-mlock()able140140+ * Special vmas that are non-mergable, non-mlock()able.141141+ * Note: mm/huge_memory.c VM_NO_THP depends on this definition.141142 */142143#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_RESERVED | VM_PFNMAP)143144···10111010int clear_page_dirty_for_io(struct page *page);1012101110131012/* Is the vma a continuation of the stack vma above it? */10141014-static inline int vma_stack_continue(struct vm_area_struct *vma, unsigned long addr)10131013+static inline int vma_growsdown(struct vm_area_struct *vma, unsigned long addr)10151014{10161015 return vma && (vma->vm_end == addr) && (vma->vm_flags & VM_GROWSDOWN);10161016+}10171017+10181018+static inline int stack_guard_page_start(struct vm_area_struct *vma,10191019+ unsigned long addr)10201020+{10211021+ return (vma->vm_flags & VM_GROWSDOWN) &&10221022+ (vma->vm_start == addr) &&10231023+ !vma_growsdown(vma->vm_prev, addr);10241024+}10251025+10261026+/* Is the vma a continuation of the stack vma below it? */10271027+static inline int vma_growsup(struct vm_area_struct *vma, unsigned long addr)10281028+{10291029+ return vma && (vma->vm_start == addr) && (vma->vm_flags & VM_GROWSUP);10301030+}10311031+10321032+static inline int stack_guard_page_end(struct vm_area_struct *vma,10331033+ unsigned long addr)10341034+{10351035+ return (vma->vm_flags & VM_GROWSUP) &&10361036+ (vma->vm_end == addr) &&10371037+ !vma_growsup(vma->vm_next, addr);10171038}1018103910191040extern unsigned long move_page_tables(struct vm_area_struct *vma,
-1
include/linux/mmc/host.h
···183183 struct work_struct clk_gate_work; /* delayed clock gate */184184 unsigned int clk_old; /* old clock value cache */185185 spinlock_t clk_lock; /* lock for clk fields */186186- struct mutex clk_gate_mutex; /* mutex for clock gating */187186#endif188187189188 /* host specific block data */
···163163({ \164164 struct v4l2_subdev *__sd; \165165 __v4l2_device_call_subdevs_until_err_p(v4l2_dev, __sd, cond, o, \166166- f, args...); \166166+ f , ##args); \167167})168168169169/* Call the specified callback for all subdevs matching grp_id (if 0, then
+9-8
init/Kconfig
···924924 environments which can tolerate a "non-standard" kernel.925925 Only use this if you really know what you are doing.926926927927-config EMBEDDED928928- bool "Embedded system"929929- select EXPERT930930- help931931- This option should be enabled if compiling the kernel for932932- an embedded system so certain expert options are available933933- for configuration.934934-935927config UID16936928 bool "Enable 16-bit UID system calls" if EXPERT937929 depends on ARM || BLACKFIN || CRIS || FRV || H8300 || X86_32 || M68K || (S390 && !64BIT) || SUPERH || SPARC32 || (SPARC64 && COMPAT) || UML || (X86_64 && IA32_EMULATION)···10961104 by some high performance threaded applications. Disabling10971105 this option saves about 7k.1098110611071107+config EMBEDDED11081108+ bool "Embedded system"11091109+ select EXPERT11101110+ help11111111+ This option should be enabled if compiling the kernel for11121112+ an embedded system so certain expert options are available11131113+ for configuration.11141114+10991115config HAVE_PERF_EVENTS11001116 bool11011117 help···12261226 per cpu and per node queues.1227122712281228config SLUB12291229+ depends on BROKEN || NUMA || !DISCONTIGMEM12291230 bool "SLUB (Unqueued Allocator)"12301231 help12311232 SLUB is a slab allocator that minimizes cache line usage
+1-1
kernel/exit.c
···10161016 /*10171017 * FIXME: do that only when needed, using sched_exit tracepoint10181018 */10191019- flush_ptrace_hw_breakpoint(tsk);10191019+ ptrace_put_breakpoints(tsk);1020102010211021 exit_notify(tsk, group_dead);10221022#ifdef CONFIG_NUMA
···430430 p = kthread_create(watchdog, (void *)(unsigned long)cpu, "watchdog/%d", cpu);431431 if (IS_ERR(p)) {432432 printk(KERN_ERR "softlockup watchdog for %i failed\n", cpu);433433- if (!err)433433+ if (!err) {434434 /* if hardlockup hasn't already set this */435435 err = PTR_ERR(p);436436+ /* and disable the perf event */437437+ watchdog_nmi_disable(cpu);438438+ }436439 goto out;437440 }438441 kthread_bind(p, cpu);
+7-1
kernel/workqueue.c
···12911291 return true;12921292 spin_unlock_irq(&gcwq->lock);1293129312941294- /* CPU has come up in between, retry migration */12941294+ /*12951295+ * We've raced with CPU hot[un]plug. Give it a breather12961296+ * and retry migration. cond_resched() is required here;12971297+ * otherwise, we might deadlock against cpu_stop trying to12981298+ * bring down the CPU on non-preemptive kernel.12991299+ */12951300 cpu_relax();13011301+ cond_resched();12961302 }12971303}12981304
+18-6
lib/flex_array.c
···232232233233/**234234 * flex_array_prealloc - guarantee that array space exists235235- * @fa: the flex array for which to preallocate parts236236- * @start: index of first array element for which space is allocated237237- * @end: index of last (inclusive) element for which space is allocated238238- * @flags: page allocation flags235235+ * @fa: the flex array for which to preallocate parts236236+ * @start: index of first array element for which space is allocated237237+ * @nr_elements: number of elements for which space is allocated238238+ * @flags: page allocation flags239239 *240240 * This will guarantee that no future calls to flex_array_put()241241 * will allocate memory. It can be used if you are expecting to···245245 * Locking must be provided by the caller.246246 */247247int flex_array_prealloc(struct flex_array *fa, unsigned int start,248248- unsigned int end, gfp_t flags)248248+ unsigned int nr_elements, gfp_t flags)249249{250250 int start_part;251251 int end_part;252252 int part_nr;253253+ unsigned int end;253254 struct flex_array_part *part;254255255255- if (start >= fa->total_nr_elements || end >= fa->total_nr_elements)256256+ if (!start && !nr_elements)257257+ return 0;258258+ if (start >= fa->total_nr_elements)259259+ return -ENOSPC;260260+ if (!nr_elements)261261+ return 0;262262+263263+ end = start + nr_elements - 1;264264+265265+ if (end >= fa->total_nr_elements)256266 return -ENOSPC;257267 if (elements_fit_in_base(fa))258268 return 0;···353343 int part_nr;354344 int ret = 0;355345346346+ if (!fa->total_nr_elements)347347+ return 0;356348 if (elements_fit_in_base(fa))357349 return ret;358350 for (part_nr = 0; part_nr < FLEX_ARRAY_NR_BASE_PTRS; part_nr++) {
···14081408 return ret;14091409}1410141014111411+#define VM_NO_THP (VM_SPECIAL|VM_INSERTPAGE|VM_MIXEDMAP|VM_SAO| \14121412+ VM_HUGETLB|VM_SHARED|VM_MAYSHARE)14131413+14111414int hugepage_madvise(struct vm_area_struct *vma,14121415 unsigned long *vm_flags, int advice)14131416{···14191416 /*14201417 * Be somewhat over-protective like KSM for now!14211418 */14221422- if (*vm_flags & (VM_HUGEPAGE |14231423- VM_SHARED | VM_MAYSHARE |14241424- VM_PFNMAP | VM_IO | VM_DONTEXPAND |14251425- VM_RESERVED | VM_HUGETLB | VM_INSERTPAGE |14261426- VM_MIXEDMAP | VM_SAO))14191419+ if (*vm_flags & (VM_HUGEPAGE | VM_NO_THP))14271420 return -EINVAL;14281421 *vm_flags &= ~VM_NOHUGEPAGE;14291422 *vm_flags |= VM_HUGEPAGE;···14351436 /*14361437 * Be somewhat over-protective like KSM for now!14371438 */14381438- if (*vm_flags & (VM_NOHUGEPAGE |14391439- VM_SHARED | VM_MAYSHARE |14401440- VM_PFNMAP | VM_IO | VM_DONTEXPAND |14411441- VM_RESERVED | VM_HUGETLB | VM_INSERTPAGE |14421442- VM_MIXEDMAP | VM_SAO))14391439+ if (*vm_flags & (VM_NOHUGEPAGE | VM_NO_THP))14431440 return -EINVAL;14441441 *vm_flags &= ~VM_HUGEPAGE;14451442 *vm_flags |= VM_NOHUGEPAGE;···15691574 * page fault if needed.15701575 */15711576 return 0;15721572- if (vma->vm_file || vma->vm_ops)15771577+ if (vma->vm_ops)15731578 /* khugepaged not yet working on file or special mappings */15741579 return 0;15751575- VM_BUG_ON(is_linear_pfn_mapping(vma) || is_pfn_mapping(vma));15801580+ /*15811581+ * If is_pfn_mapping() is true is_learn_pfn_mapping() must be15821582+ * true too, verify it here.15831583+ */15841584+ VM_BUG_ON(is_linear_pfn_mapping(vma) || vma->vm_flags & VM_NO_THP);15761585 hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK;15771586 hend = vma->vm_end & HPAGE_PMD_MASK;15781587 if (hstart < hend)···18271828 (vma->vm_flags & VM_NOHUGEPAGE))18281829 goto out;1829183018301830- /* VM_PFNMAP vmas may have vm_ops null but vm_file set */18311831- if (!vma->anon_vma || vma->vm_ops || vma->vm_file)18311831+ if (!vma->anon_vma || vma->vm_ops)18321832 goto out;18331833 if (is_vma_temporary_stack(vma))18341834 goto out;18351835- VM_BUG_ON(is_linear_pfn_mapping(vma) || is_pfn_mapping(vma));18351835+ /*18361836+ * If is_pfn_mapping() is true is_learn_pfn_mapping() must be18371837+ * true too, verify it here.18381838+ */18391839+ VM_BUG_ON(is_linear_pfn_mapping(vma) || vma->vm_flags & VM_NO_THP);1836184018371841 pgd = pgd_offset(mm, address);18381842 if (!pgd_present(*pgd))···20682066 progress++;20692067 continue;20702068 }20712071- /* VM_PFNMAP vmas may have vm_ops null but vm_file set */20722072- if (!vma->anon_vma || vma->vm_ops || vma->vm_file)20692069+ if (!vma->anon_vma || vma->vm_ops)20732070 goto skip;20742071 if (is_vma_temporary_stack(vma))20752072 goto skip;20762076-20772077- VM_BUG_ON(is_linear_pfn_mapping(vma) || is_pfn_mapping(vma));20732073+ /*20742074+ * If is_pfn_mapping() is true is_learn_pfn_mapping()20752075+ * must be true too, verify it here.20762076+ */20772077+ VM_BUG_ON(is_linear_pfn_mapping(vma) ||20782078+ vma->vm_flags & VM_NO_THP);2078207920792080 hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK;20802081 hend = vma->vm_end & HPAGE_PMD_MASK;
+9-12
mm/memory.c
···13591359 */13601360 mark_page_accessed(page);13611361 }13621362- if (flags & FOLL_MLOCK) {13621362+ if ((flags & FOLL_MLOCK) && (vma->vm_flags & VM_LOCKED)) {13631363 /*13641364 * The preliminary mapping check is mainly to avoid the13651365 * pointless overhead of lock_page on the ZERO_PAGE···1412141214131413static inline int stack_guard_page(struct vm_area_struct *vma, unsigned long addr)14141414{14151415- return (vma->vm_flags & VM_GROWSDOWN) &&14161416- (vma->vm_start == addr) &&14171417- !vma_stack_continue(vma->vm_prev, addr);14151415+ return stack_guard_page_start(vma, addr) ||14161416+ stack_guard_page_end(vma, addr+PAGE_SIZE);14181417}1419141814201419/**···15501551 continue;15511552 }1552155315531553- /*15541554- * If we don't actually want the page itself,15551555- * and it's the stack guard page, just skip it.15561556- */15571557- if (!pages && stack_guard_page(vma, start))15581558- goto next_page;15591559-15601554 do {15611555 struct page *page;15621556 unsigned int foll_flags = gup_flags;···15661574 int ret;15671575 unsigned int fault_flags = 0;1568157615771577+ /* For mlock, just skip the stack guard page. */15781578+ if (foll_flags & FOLL_MLOCK) {15791579+ if (stack_guard_page(vma, start))15801580+ goto next_page;15811581+ }15691582 if (foll_flags & FOLL_WRITE)15701583 fault_flags |= FAULT_FLAG_WRITE;15711584 if (nonblocking)···33933396 * run pte_offset_map on the pmd, if an huge pmd could33943397 * materialize from under us from a different thread.33953398 */33963396- if (unlikely(__pte_alloc(mm, vma, pmd, address)))33993399+ if (unlikely(pmd_none(*pmd)) && __pte_alloc(mm, vma, pmd, address))33973400 return VM_FAULT_OOM;33983401 /* if an huge pmd materialized from under us just retry later */33993402 if (unlikely(pmd_trans_huge(*pmd)))
+1-4
mm/mlock.c
···162162 VM_BUG_ON(end > vma->vm_end);163163 VM_BUG_ON(!rwsem_is_locked(&mm->mmap_sem));164164165165- gup_flags = FOLL_TOUCH;165165+ gup_flags = FOLL_TOUCH | FOLL_MLOCK;166166 /*167167 * We want to touch writable mappings with a write fault in order168168 * to break COW, except for shared mappings because these don't COW···177177 */178178 if (vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))179179 gup_flags |= FOLL_FORCE;180180-181181- if (vma->vm_flags & VM_LOCKED)182182- gup_flags |= FOLL_MLOCK;183180184181 return __get_user_pages(current, mm, addr, nr_pages, gup_flags,185182 NULL, NULL, nonblocking);
···172172173173 /*174174 * The baseline for the badness score is the proportion of RAM that each175175- * task's rss and swap space use.175175+ * task's rss, pagetable and swap space use.176176 */177177- points = (get_mm_rss(p->mm) + get_mm_counter(p->mm, MM_SWAPENTS)) * 1000 /178178- totalpages;177177+ points = get_mm_rss(p->mm) + p->mm->nr_ptes;178178+ points += get_mm_counter(p->mm, MM_SWAPENTS);179179+180180+ points *= 1000;181181+ points /= totalpages;179182 task_unlock(p);180183181184 /*
+2-2
mm/slub.c
···19401940 * Since this is without lock semantics the protection is only against19411941 * code executing on this cpu *not* from access by other cpus.19421942 */19431943- if (unlikely(!this_cpu_cmpxchg_double(19431943+ if (unlikely(!irqsafe_cpu_cmpxchg_double(19441944 s->cpu_slab->freelist, s->cpu_slab->tid,19451945 object, tid,19461946 get_freepointer(s, object), next_tid(tid)))) {···21452145 set_freepointer(s, object, c->freelist);2146214621472147#ifdef CONFIG_CMPXCHG_LOCAL21482148- if (unlikely(!this_cpu_cmpxchg_double(21482148+ if (unlikely(!irqsafe_cpu_cmpxchg_double(21492149 s->cpu_slab->freelist, s->cpu_slab->tid,21502150 c->freelist, tid,21512151 object, next_tid(tid)))) {
+2-3
net/bluetooth/hci_core.c
···587587 hci_req_cancel(hdev, ENODEV);588588 hci_req_lock(hdev);589589590590- /* Stop timer, it might be running */591591- del_timer_sync(&hdev->cmd_timer);592592-593590 if (!test_and_clear_bit(HCI_UP, &hdev->flags)) {591591+ del_timer_sync(&hdev->cmd_timer);594592 hci_req_unlock(hdev);595593 return 0;596594 }···627629628630 /* Drop last sent command */629631 if (hdev->sent_cmd) {632632+ del_timer_sync(&hdev->cmd_timer);630633 kfree_skb(hdev->sent_cmd);631634 hdev->sent_cmd = NULL;632635 }
···4141 default n42424343config NET_DSA_MV88E61314444- bool "Marvell 88E6095/6095F/6131 ethernet switch chip support"4444+ bool "Marvell 88E6085/6095/6095F/6131 ethernet switch chip support"4545 select NET_DSA_MV88E6XXX4646 select NET_DSA_MV88E6XXX_NEED_PPU4747 select NET_DSA_TAG_DSA4848 ---help---4949- This enables support for the Marvell 88E6095/6095F/61314949+ This enables support for the Marvell 88E6085/6095/6095F/61315050 ethernet switch chips.51515252config NET_DSA_MV88E6123_61_65
+21-5
net/dsa/mv88e6131.c
···207207 * mode, but do not enable forwarding of unknown unicasts.208208 */209209 val = 0x0433;210210- if (p == dsa_upstream_port(ds))210210+ if (p == dsa_upstream_port(ds)) {211211 val |= 0x0104;212212+ /*213213+ * On 6085, unknown multicast forward is controlled214214+ * here rather than in Port Control 2 register.215215+ */216216+ if (ps->id == ID_6085)217217+ val |= 0x0008;218218+ }212219 if (ds->dsa_port_mask & (1 << p))213220 val |= 0x0100;214221 REG_WRITE(addr, 0x04, val);···258251 * If this is the upstream port for this switch, enable259252 * forwarding of unknown multicast addresses.260253 */261261- val = 0x0080 | dsa_upstream_port(ds);262262- if (p == dsa_upstream_port(ds))263263- val |= 0x0040;264264- REG_WRITE(addr, 0x08, val);254254+ if (ps->id == ID_6085)255255+ /*256256+ * on 6085, bits 3:0 are reserved, bit 6 control ARP257257+ * mirroring, and multicast forward is handled in258258+ * Port Control register.259259+ */260260+ REG_WRITE(addr, 0x08, 0x0080);261261+ else {262262+ val = 0x0080 | dsa_upstream_port(ds);263263+ if (p == dsa_upstream_port(ds))264264+ val |= 0x0040;265265+ REG_WRITE(addr, 0x08, val);266266+ }265267266268 /*267269 * Rate Control: disable ingress rate limiting.
···13351335 skb->ip_summed = CHECKSUM_NONE;1336133613371337 /* Check if there is enough headroom to insert fragment header. */13381338- if ((skb_headroom(skb) < frag_hdr_sz) &&13381338+ if ((skb_mac_header(skb) < skb->head + frag_hdr_sz) &&13391339 pskb_expand_head(skb, frag_hdr_sz, 0, GFP_ATOMIC))13401340 goto out;13411341
+1-1
net/l2tp/l2tp_ip.c
···667667MODULE_DESCRIPTION("L2TP over IP");668668MODULE_VERSION("1.0");669669670670-/* Use the value of SOCK_DGRAM (2) directory, because __stringify does't like670670+/* Use the value of SOCK_DGRAM (2) directory, because __stringify doesn't like671671 * enums672672 */673673MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_INET, 2, IPPROTO_L2TP);
···502502 goto out;503503504504 rc = flex_array_prealloc(p->type_val_to_struct_array, 0,505505- p->p_types.nprim - 1, GFP_KERNEL | __GFP_ZERO);505505+ p->p_types.nprim, GFP_KERNEL | __GFP_ZERO);506506 if (rc)507507 goto out;508508···519519 goto out;520520521521 rc = flex_array_prealloc(p->sym_val_to_name[i],522522- 0, p->symtab[i].nprim - 1,522522+ 0, p->symtab[i].nprim,523523 GFP_KERNEL | __GFP_ZERO);524524 if (rc)525525 goto out;···23752375 goto bad;2376237623772377 /* preallocate so we don't have to worry about the put ever failing */23782378- rc = flex_array_prealloc(p->type_attr_map_array, 0, p->p_types.nprim - 1,23782378+ rc = flex_array_prealloc(p->type_attr_map_array, 0, p->p_types.nprim,23792379 GFP_KERNEL | __GFP_ZERO);23802380 if (rc)23812381 goto bad;
+1-1
sound/aoa/codecs/tas.c
···170170 /* analysing the volume and mixer tables shows171171 * that they are similar enough when we shift172172 * the mixer table down by 4 bits. The error173173- * is minuscule, in just one item the error173173+ * is miniscule, in just one item the error174174 * is 1, at a value of 0x07f17b (mixer table175175 * value is 0x07f17a) */176176 tmp = tas_gaintable[left];