···33Contact: Kay Sievers <kay.sievers@vrfy.org>44Description:55 Shows the list of currently configured66- tty devices used for the console,77- like 'tty1 ttyS0'.66+ console devices, like 'tty1 ttyS0'.87 The last entry in the file is the active98 device connected to /dev/console.109 The file supports poll() to detect virtual
+109-10
Documentation/PCI/MSI-HOWTO.txt
···8282has to request that the PCI layer set up the MSI capability for this8383device.84848585-4.2.1 pci_enable_msi_range8585+4.2.1 pci_enable_msi8686+8787+int pci_enable_msi(struct pci_dev *dev)8888+8989+A successful call allocates ONE interrupt to the device, regardless9090+of how many MSIs the device supports. The device is switched from9191+pin-based interrupt mode to MSI mode. The dev->irq number is changed9292+to a new number which represents the message signaled interrupt;9393+consequently, this function should be called before the driver calls9494+request_irq(), because an MSI is delivered via a vector that is9595+different from the vector of a pin-based interrupt.9696+9797+4.2.2 pci_enable_msi_range86988799int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec)88100···159147 return pci_enable_msi_range(pdev, nvec, nvec);160148}161149150150+Note, unlike pci_enable_msi_exact() function, which could be also used to151151+enable a particular number of MSI-X interrupts, pci_enable_msi_range()152152+returns either a negative errno or 'nvec' (not negative errno or 0 - as153153+pci_enable_msi_exact() does).154154+1621554.2.1.3 Single MSI mode163156164157The most notorious example of the request type described above is···175158 return pci_enable_msi_range(pdev, 1, 1);176159}177160178178-4.2.2 pci_disable_msi161161+Note, unlike pci_enable_msi() function, which could be also used to162162+enable the single MSI mode, pci_enable_msi_range() returns either a163163+negative errno or 1 (not negative errno or 0 - as pci_enable_msi()164164+does).165165+166166+4.2.3 pci_enable_msi_exact167167+168168+int pci_enable_msi_exact(struct pci_dev *dev, int nvec)169169+170170+This variation on pci_enable_msi_range() call allows a device driver to171171+request exactly 'nvec' MSIs.172172+173173+If this function returns a negative number, it indicates an error and174174+the driver should not attempt to request any more MSI interrupts for175175+this device.176176+177177+By contrast with pci_enable_msi_range() function, pci_enable_msi_exact()178178+returns zero in case of success, which indicates MSI interrupts have been179179+successfully allocated.180180+181181+4.2.4 pci_disable_msi179182180183void pci_disable_msi(struct pci_dev *dev)181184···209172Failure to do so results in a BUG_ON(), leaving the device with210173MSI enabled and thus leaking its vector.211174212212-4.2.3 pci_msi_vec_count175175+4.2.4 pci_msi_vec_count213176214177int pci_msi_vec_count(struct pci_dev *dev)215178···294257295258static int foo_driver_enable_msix(struct foo_adapter *adapter, int nvec)296259{297297- return pci_enable_msi_range(adapter->pdev, adapter->msix_entries,298298- 1, nvec);260260+ return pci_enable_msix_range(adapter->pdev, adapter->msix_entries,261261+ 1, nvec);299262}300263301264Note the value of 'minvec' parameter is 1. As 'minvec' is inclusive,···306269307270static int foo_driver_enable_msix(struct foo_adapter *adapter, int nvec)308271{309309- return pci_enable_msi_range(adapter->pdev, adapter->msix_entries,310310- FOO_DRIVER_MINIMUM_NVEC, nvec);272272+ return pci_enable_msix_range(adapter->pdev, adapter->msix_entries,273273+ FOO_DRIVER_MINIMUM_NVEC, nvec);311274}3122753132764.3.1.2 Exact number of MSI-X interrupts···319282320283static int foo_driver_enable_msix(struct foo_adapter *adapter, int nvec)321284{322322- return pci_enable_msi_range(adapter->pdev, adapter->msix_entries,323323- nvec, nvec);285285+ return pci_enable_msix_range(adapter->pdev, adapter->msix_entries,286286+ nvec, nvec);324287}288288+289289+Note, unlike pci_enable_msix_exact() function, which could be also used to290290+enable a particular number of MSI-X interrupts, pci_enable_msix_range()291291+returns either a negative errno or 'nvec' (not negative errno or 0 - as292292+pci_enable_msix_exact() does).3252933262944.3.1.3 Specific requirements to the number of MSI-X interrupts327295···374332any error code other than -ENOSPC indicates a fatal error and should not375333be retried.376334377377-4.3.2 pci_disable_msix335335+4.3.2 pci_enable_msix_exact336336+337337+int pci_enable_msix_exact(struct pci_dev *dev,338338+ struct msix_entry *entries, int nvec)339339+340340+This variation on pci_enable_msix_range() call allows a device driver to341341+request exactly 'nvec' MSI-Xs.342342+343343+If this function returns a negative number, it indicates an error and344344+the driver should not attempt to allocate any more MSI-X interrupts for345345+this device.346346+347347+By contrast with pci_enable_msix_range() function, pci_enable_msix_exact()348348+returns zero in case of success, which indicates MSI-X interrupts have been349349+successfully allocated.350350+351351+Another version of a routine that enables MSI-X mode for a device with352352+specific requirements described in chapter 4.3.1.3 might look like this:353353+354354+/*355355+ * Assume 'minvec' and 'maxvec' are non-zero356356+ */357357+static int foo_driver_enable_msix(struct foo_adapter *adapter,358358+ int minvec, int maxvec)359359+{360360+ int rc;361361+362362+ minvec = roundup_pow_of_two(minvec);363363+ maxvec = rounddown_pow_of_two(maxvec);364364+365365+ if (minvec > maxvec)366366+ return -ERANGE;367367+368368+retry:369369+ rc = pci_enable_msix_exact(adapter->pdev,370370+ adapter->msix_entries, maxvec);371371+372372+ /*373373+ * -ENOSPC is the only error code allowed to be analyzed374374+ */375375+ if (rc == -ENOSPC) {376376+ if (maxvec == 1)377377+ return -ENOSPC;378378+379379+ maxvec /= 2;380380+381381+ if (minvec > maxvec)382382+ return -ENOSPC;383383+384384+ goto retry;385385+ } else if (rc < 0) {386386+ return rc;387387+ }388388+389389+ return maxvec;390390+}391391+392392+4.3.3 pci_disable_msix378393379394void pci_disable_msix(struct pci_dev *dev)380395
···11+STMicroelectronics SoC DWMAC glue layer controller22+33+The device node has following properties.44+55+Required properties:66+ - compatible : Can be "st,stih415-dwmac", "st,stih416-dwmac" or77+ "st,stid127-dwmac".88+ - reg : Offset of the glue configuration register map in system99+ configuration regmap pointed by st,syscon property and size.1010+1111+ - reg-names : Should be "sti-ethconf".1212+1313+ - st,syscon : Should be phandle to system configuration node which1414+ encompases this glue registers.1515+1616+ - st,tx-retime-src: On STi Parts for Giga bit speeds, 125Mhz clocks can be1717+ wired up in from different sources. One via TXCLK pin and other via CLK_1251818+ pin. This wiring is totally board dependent. However the retiming glue1919+ logic should be configured accordingly. Possible values for this property2020+2121+ "txclk" - if 125Mhz clock is wired up via txclk line.2222+ "clk_125" - if 125Mhz clock is wired up via clk_125 line.2323+2424+ This property is only valid for Giga bit setup( GMII, RGMII), and it is2525+ un-used for non-giga bit (MII and RMII) setups. Also note that internal2626+ clockgen can not generate stable 125Mhz clock.2727+2828+ - st,ext-phyclk: This boolean property indicates who is generating the clock2929+ for tx and rx. This property is only valid for RMII case where the clock can3030+ be generated from the MAC or PHY.3131+3232+ - clock-names: should be "sti-ethclk".3333+ - clocks: Should point to ethernet clockgen which can generate phyclk.3434+3535+3636+Example:3737+3838+ethernet0: dwmac@fe810000 {3939+ device_type = "network";4040+ compatible = "st,stih416-dwmac", "snps,dwmac", "snps,dwmac-3.710";4141+ reg = <0xfe810000 0x8000>, <0x8bc 0x4>;4242+ reg-names = "stmmaceth", "sti-ethconf";4343+ interrupts = <0 133 0>, <0 134 0>, <0 135 0>;4444+ interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";4545+ phy-mode = "mii";4646+4747+ st,syscon = <&syscfg_rear>;4848+4949+ snps,pbl = <32>;5050+ snps,mixed-burst;5151+5252+ resets = <&softreset STIH416_ETH0_SOFTRESET>;5353+ reset-names = "stmmaceth";5454+ pinctrl-0 = <&pinctrl_mii0>;5555+ pinctrl-names = "default";5656+ clocks = <&CLK_S_GMAC0_PHY>;5757+ clock-names = "stmmaceth";5858+};
-45
Documentation/networking/3c505.txt
···11-The 3Com Etherlink Plus (3c505) driver.22-33-This driver now uses DMA. There is currently no support for PIO operation.44-The default DMA channel is 6; this is _not_ autoprobed, so you must55-make sure you configure it correctly. If loading the driver as a66-module, you can do this with "modprobe 3c505 dma=n". If the driver is77-linked statically into the kernel, you must either use an "ether="88-statement on the command line, or change the definition of ELP_DMA in 3c505.h.99-1010-The driver will warn you if it has to fall back on the compiled in1111-default DMA channel. 1212-1313-If no base address is given at boot time, the driver will autoprobe1414-ports 0x300, 0x280 and 0x310 (in that order). If no IRQ is given, the driver1515-will try to probe for it.1616-1717-The driver can be used as a loadable module.1818-1919-Theoretically, one instance of the driver can now run multiple cards,2020-in the standard way (when loading a module, say "modprobe 3c5052121-io=0x300,0x340 irq=10,11 dma=6,7" or whatever). I have not tested2222-this, though.2323-2424-The driver may now support revision 2 hardware; the dependency on2525-being able to read the host control register has been removed. This2626-is also untested, since I don't have a suitable card.2727-2828-Known problems:2929- I still see "DMA upload timed out" messages from time to time. These3030-seem to be fairly non-fatal though.3131- The card is old and slow.3232-3333-To do:3434- Improve probe/setup code3535- Test multicast and promiscuous operation3636-3737-Authors:3838- The driver is mainly written by Craig Southeren, email3939- <craigs@ineluki.apana.org.au>.4040- Parts of the driver (adapting the driver to 1.1.4+ kernels,4141- IRQ/address detection, some changes) and this README by4242- Juha Laiho <jlaiho@ichaos.nullnet.fi>.4343- DMA mode, more fixes, etc, by Philip Blundell <pjb27@cam.ac.uk>4444- Multicard support, Software configurable DMA, etc., by4545- Christopher Collins <ccollins@pcug.org.au>
+14-1
MAINTAINERS
···1860186018611861BROADCOM BCM281XX/BCM11XXX ARM ARCHITECTURE18621862M: Christian Daudt <bcm@fixthebug.org>18631863+M: Matt Porter <mporter@linaro.org>18631864L: bcm-kernel-feedback-list@broadcom.com18641865T: git git://git.github.com/broadcom/bcm1135118651866S: Maintained···2409240824102409CPUSETS24112410M: Li Zefan <lizefan@huawei.com>24112411+L: cgroups@vger.kernel.org24122412W: http://www.bullopensource.org/cpuset/24132413W: http://oss.sgi.com/projects/cpusets/24142414+T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git24142415S: Maintained24152416F: Documentation/cgroups/cpusets.txt24162417F: include/linux/cpuset.h···33263323S: Maintained33273324F: include/linux/netfilter_bridge/33283325F: net/bridge/33263326+33273327+ETHERNET PHY LIBRARY33283328+M: Florian Fainelli <f.fainelli@gmail.com>33293329+L: netdev@vger.kernel.org33303330+S: Maintained33313331+F: include/linux/phy.h33323332+F: include/linux/phy_fixed.h33333333+F: drivers/net/phy/33343334+F: Documentation/networking/phy.txt33353335+F: drivers/of/of_mdio.c33363336+F: drivers/of/of_net.c3329333733303338EXT2 FILE SYSTEM33313339M: Jan Kara <jack@suse.cz>···97299715XFS FILESYSTEM97309716P: Silicon Graphics Inc97319717M: Dave Chinner <david@fromorbit.com>97329732-M: Ben Myers <bpm@sgi.com>97339718M: xfs@oss.sgi.com97349719L: xfs@oss.sgi.com97359720W: http://oss.sgi.com/projects/xfs
···11/*22 * Copyright (C) 2013 Pavel Machek <pavel@ucw.cz>33- * Copyright 2013 Aaro Koskinen <aaro.koskinen@iki.fi>33+ * Copyright (C) 2013-2014 Aaro Koskinen <aaro.koskinen@iki.fi>44 *55 * This program is free software; you can redistribute it and/or modify66 * it under the terms of the GNU General Public License version 2 (or later) as···13131414/ {1515 model = "Nokia N900";1616- compatible = "nokia,omap3-n900", "ti,omap3";1616+ compatible = "nokia,omap3-n900", "ti,omap3430", "ti,omap3";17171818 cpus {1919 cpu@0 {
···11+/*22+ * Copyright (C) 2012 Florian Vaussard, EPFL Mobots group33+ *44+ * This program is free software; you can redistribute it and/or modify55+ * it under the terms of the GNU General Public License version 2 as66+ * published by the Free Software Foundation.77+ */88+99+/*1010+ * Tobi expansion board is manufactured by Gumstix Inc.1111+ */1212+1313+/dts-v1/;1414+1515+#include "omap36xx.dtsi"1616+#include "omap3-overo-tobi-common.dtsi"1717+1818+/ {1919+ model = "OMAP36xx/AM37xx/DM37xx Gumstix Overo on Tobi";2020+ compatible = "gumstix,omap3-overo-tobi", "gumstix,omap3-overo", "ti,omap36xx", "ti,omap3";2121+};2222+
+22
arch/arm/boot/dts/omap3-overo-tobi.dts
···11+/*22+ * Copyright (C) 2012 Florian Vaussard, EPFL Mobots group33+ *44+ * This program is free software; you can redistribute it and/or modify55+ * it under the terms of the GNU General Public License version 2 as66+ * published by the Free Software Foundation.77+ */88+99+/*1010+ * Tobi expansion board is manufactured by Gumstix Inc.1111+ */1212+1313+/dts-v1/;1414+1515+#include "omap34xx.dtsi"1616+#include "omap3-overo-tobi-common.dtsi"1717+1818+/ {1919+ model = "OMAP35xx Gumstix Overo on Tobi";2020+ compatible = "gumstix,omap3-overo-tobi", "gumstix,omap3-overo", "ti,omap3430", "ti,omap3";2121+};2222+
-3
arch/arm/boot/dts/omap3-overo.dtsi
···99/*1010 * The Gumstix Overo must be combined with an expansion board.1111 */1212-/dts-v1/;1313-1414-#include "omap34xx.dtsi"15121613/ {1714 pwmleds {
···172172};173173174174extern struct eeh_ops *eeh_ops;175175-extern int eeh_subsystem_enabled;175175+extern bool eeh_subsystem_enabled;176176extern raw_spinlock_t confirm_error_lock;177177extern int eeh_probe_mode;178178+179179+static inline bool eeh_enabled(void)180180+{181181+ return eeh_subsystem_enabled;182182+}183183+184184+static inline void eeh_set_enable(bool mode)185185+{186186+ eeh_subsystem_enabled = mode;187187+}178188179189#define EEH_PROBE_MODE_DEV (1<<0) /* From PCI device */180190#define EEH_PROBE_MODE_DEVTREE (1<<1) /* From device tree */···256246 * If this macro yields TRUE, the caller relays to eeh_check_failure()257247 * which does further tests out of line.258248 */259259-#define EEH_POSSIBLE_ERROR(val, type) ((val) == (type)~0 && eeh_subsystem_enabled)249249+#define EEH_POSSIBLE_ERROR(val, type) ((val) == (type)~0 && eeh_enabled())260250261251/*262252 * Reads from a device which has been isolated by EEH will return···266256#define EEH_IO_ERROR_VALUE(size) (~0U >> ((4 - (size)) * 8))267257268258#else /* !CONFIG_EEH */259259+260260+static inline bool eeh_enabled(void)261261+{262262+ return false;263263+}264264+265265+static inline void eeh_set_enable(bool mode) { }269266270267static inline int eeh_init(void)271268{
···44444545 /* We simply send special EEH event */4646 if ((changed_evts & OPAL_EVENT_PCI_ERROR) &&4747- (events & OPAL_EVENT_PCI_ERROR))4747+ (events & OPAL_EVENT_PCI_ERROR) &&4848+ eeh_enabled())4849 eeh_send_failure_event(NULL);49505051 return 0;···490489static int ioda_eeh_reset(struct eeh_pe *pe, int option)491490{492491 struct pci_controller *hose = pe->phb;493493- struct eeh_dev *edev;494494- struct pci_dev *dev;492492+ struct pci_bus *bus;495493 int ret;496494497495 /*···519519 if (pe->type & EEH_PE_PHB) {520520 ret = ioda_eeh_phb_reset(hose, option);521521 } else {522522- if (pe->type & EEH_PE_DEVICE) {523523- /*524524- * If it's device PE, we didn't refer to the parent525525- * PCI bus yet. So we have to figure it out indirectly.526526- */527527- edev = list_first_entry(&pe->edevs,528528- struct eeh_dev, list);529529- dev = eeh_dev_to_pci_dev(edev);530530- dev = dev->bus->self;531531- } else {532532- /*533533- * If it's bus PE, the parent PCI bus is already there534534- * and just pick it up.535535- */536536- dev = pe->bus->self;537537- }538538-539539- /*540540- * Do reset based on the fact that the direct upstream bridge541541- * is root bridge (port) or not.542542- */543543- if (dev->bus->number == 0)522522+ bus = eeh_pe_bus_get(pe);523523+ if (pci_is_root_bus(bus))544524 ret = ioda_eeh_root_reset(hose, option);545525 else546546- ret = ioda_eeh_bridge_reset(hose, dev, option);526526+ ret = ioda_eeh_bridge_reset(hose, bus->self, option);547527 }548528549529 return ret;
+1-1
arch/powerpc/platforms/powernv/eeh-powernv.c
···145145 * Enable EEH explicitly so that we will do EEH check146146 * while accessing I/O stuff147147 */148148- eeh_subsystem_enabled = 1;148148+ eeh_set_enable(true);149149150150 /* Save memory bars */151151 eeh_save_bars(edev);
+1-1
arch/powerpc/platforms/pseries/eeh_pseries.c
···265265 enable = 1;266266267267 if (enable) {268268- eeh_subsystem_enabled = 1;268268+ eeh_set_enable(true);269269 eeh_add_to_parent_pe(edev);270270271271 pr_debug("%s: EEH enabled on %s PHB#%d-PE#%x, config addr#%x\n",
+15-7
arch/powerpc/platforms/pseries/pci.c
···113113{114114 struct device_node *dn, *pdn;115115 struct pci_bus *bus;116116- const __be32 *pcie_link_speed_stats;116116+ u32 pcie_link_speed_stats[2];117117+ int rc;117118118119 bus = bridge->bus;119120···123122 return 0;124123125124 for (pdn = dn; pdn != NULL; pdn = of_get_next_parent(pdn)) {126126- pcie_link_speed_stats = of_get_property(pdn,127127- "ibm,pcie-link-speed-stats", NULL);128128- if (pcie_link_speed_stats)125125+ rc = of_property_read_u32_array(pdn,126126+ "ibm,pcie-link-speed-stats",127127+ &pcie_link_speed_stats[0], 2);128128+ if (!rc)129129 break;130130 }131131132132 of_node_put(pdn);133133134134- if (!pcie_link_speed_stats) {134134+ if (rc) {135135 pr_err("no ibm,pcie-link-speed-stats property\n");136136 return 0;137137 }138138139139- switch (be32_to_cpup(pcie_link_speed_stats)) {139139+ switch (pcie_link_speed_stats[0]) {140140 case 0x01:141141 bus->max_bus_speed = PCIE_SPEED_2_5GT;142142 break;143143 case 0x02:144144 bus->max_bus_speed = PCIE_SPEED_5_0GT;145145 break;146146+ case 0x04:147147+ bus->max_bus_speed = PCIE_SPEED_8_0GT;148148+ break;146149 default:147150 bus->max_bus_speed = PCI_SPEED_UNKNOWN;148151 break;149152 }150153151151- switch (be32_to_cpup(pcie_link_speed_stats)) {154154+ switch (pcie_link_speed_stats[1]) {152155 case 0x01:153156 bus->cur_bus_speed = PCIE_SPEED_2_5GT;154157 break;155158 case 0x02:156159 bus->cur_bus_speed = PCIE_SPEED_5_0GT;160160+ break;161161+ case 0x04:162162+ bus->cur_bus_speed = PCIE_SPEED_8_0GT;157163 break;158164 default:159165 bus->cur_bus_speed = PCI_SPEED_UNKNOWN;
···6666extern void tsc_restore_sched_clock_state(void);67676868/* MSR based TSC calibration for Intel Atom SoC platforms */6969-int try_msr_calibrate_tsc(unsigned long *fast_calibrate);6969+unsigned long try_msr_calibrate_tsc(void);70707171#endif /* _ASM_X86_TSC_H */
···231231232232};233233234234+static __init void p6_pmu_rdpmc_quirk(void)235235+{236236+ if (boot_cpu_data.x86_mask < 9) {237237+ /*238238+ * PPro erratum 26; fixed in stepping 9 and above.239239+ */240240+ pr_warn("Userspace RDPMC support disabled due to a CPU erratum\n");241241+ x86_pmu.attr_rdpmc_broken = 1;242242+ x86_pmu.attr_rdpmc = 0;243243+ }244244+}245245+234246__init int p6_pmu_init(void)235247{248248+ x86_pmu = p6_pmu;249249+236250 switch (boot_cpu_data.x86_model) {237237- case 1:238238- case 3: /* Pentium Pro */239239- case 5:240240- case 6: /* Pentium II */241241- case 7:242242- case 8:243243- case 11: /* Pentium III */244244- case 9:245245- case 13:246246- /* Pentium M */251251+ case 1: /* Pentium Pro */252252+ x86_add_quirk(p6_pmu_rdpmc_quirk);247253 break;254254+255255+ case 3: /* Pentium II - Klamath */256256+ case 5: /* Pentium II - Deschutes */257257+ case 6: /* Pentium II - Mendocino */258258+ break;259259+260260+ case 7: /* Pentium III - Katmai */261261+ case 8: /* Pentium III - Coppermine */262262+ case 10: /* Pentium III Xeon */263263+ case 11: /* Pentium III - Tualatin */264264+ break;265265+266266+ case 9: /* Pentium M - Banias */267267+ case 13: /* Pentium M - Dothan */268268+ break;269269+248270 default:249249- pr_cont("unsupported p6 CPU model %d ",250250- boot_cpu_data.x86_model);271271+ pr_cont("unsupported p6 CPU model %d ", boot_cpu_data.x86_model);251272 return -ENODEV;252273 }253274254254- x86_pmu = p6_pmu;255255-256275 memcpy(hw_cache_event_ids, p6_hw_cache_event_ids,257276 sizeof(hw_cache_event_ids));258258-259277260278 return 0;261279}
+3-1
arch/x86/kernel/pci-dma.c
···100100 flag |= __GFP_ZERO;101101again:102102 page = NULL;103103- if (!(flag & GFP_ATOMIC))103103+ /* CMA can be used only in the context which permits sleeping */104104+ if (flag & __GFP_WAIT)104105 page = dma_alloc_from_contiguous(dev, count, get_order(size));106106+ /* fallback */105107 if (!page)106108 page = alloc_pages_node(dev_to_node(dev), flag, get_order(size));107109 if (!page)
+2-5
arch/x86/kernel/tsc.c
···653653654654 /* Calibrate TSC using MSR for Intel Atom SoCs */655655 local_irq_save(flags);656656- i = try_msr_calibrate_tsc(&fast_calibrate);656656+ fast_calibrate = try_msr_calibrate_tsc();657657 local_irq_restore(flags);658658- if (i >= 0) {659659- if (i == 0)660660- pr_warn("Fast TSC calibration using MSR failed\n");658658+ if (fast_calibrate)661659 return fast_calibrate;662662- }663660664661 local_irq_save(flags);665662 fast_calibrate = quick_pit_calibrate();
+15-15
arch/x86/kernel/tsc_msr.c
···5353 /* TNG */5454 { 6, 0x4a, 1, { 0, FREQ_100, FREQ_133, 0, 0, 0, 0, 0 } },5555 /* VLV2 */5656- { 6, 0x37, 1, { 0, FREQ_100, FREQ_133, FREQ_166, 0, 0, 0, 0 } },5656+ { 6, 0x37, 1, { FREQ_83, FREQ_100, FREQ_133, FREQ_166, 0, 0, 0, 0 } },5757 /* ANN */5858 { 6, 0x5a, 1, { FREQ_83, FREQ_100, FREQ_133, FREQ_100, 0, 0, 0, 0 } },5959};···77777878/*7979 * Do MSR calibration only for known/supported CPUs.8080- * Return values:8181- * -1: CPU is unknown/unsupported for MSR based calibration8282- * 0: CPU is known/supported, but calibration failed8383- * 1: CPU is known/supported, and calibration succeeded8080+ *8181+ * Returns the calibration value or 0 if MSR calibration failed.8482 */8585-int try_msr_calibrate_tsc(unsigned long *fast_calibrate)8383+unsigned long try_msr_calibrate_tsc(void)8684{8787- int cpu_index;8885 u32 lo, hi, ratio, freq_id, freq;8686+ unsigned long res;8787+ int cpu_index;89889089 cpu_index = match_cpu(boot_cpu_data.x86, boot_cpu_data.x86_model);9190 if (cpu_index < 0)9292- return -1;9393-9494- *fast_calibrate = 0;9191+ return 0;95929693 if (freq_desc_tables[cpu_index].msr_plat) {9794 rdmsr(MSR_PLATFORM_INFO, lo, hi);···100103 pr_info("Maximum core-clock to bus-clock ratio: 0x%x\n", ratio);101104102105 if (!ratio)103103- return 0;106106+ goto fail;104107105108 /* Get FSB FREQ ID */106109 rdmsr(MSR_FSB_FREQ, lo, hi);···109112 pr_info("Resolved frequency ID: %u, frequency: %u KHz\n",110113 freq_id, freq);111114 if (!freq)112112- return 0;115115+ goto fail;113116114117 /* TSC frequency = maximum resolved freq * maximum resolved bus ratio */115115- *fast_calibrate = freq * ratio;116116- pr_info("TSC runs at %lu KHz\n", *fast_calibrate);118118+ res = freq * ratio;119119+ pr_info("TSC runs at %lu KHz\n", res);117120118121#ifdef CONFIG_X86_LOCAL_APIC119122 lapic_timer_frequency = (freq * 1000) / HZ;120123 pr_info("lapic_timer_frequency = %d\n", lapic_timer_frequency);121124#endif125125+ return res;122126123123- return 1;127127+fail:128128+ pr_warn("Fast TSC calibration using MSR failed\n");129129+ return 0;124130}
···247247248248config SATA_MV249249 tristate "Marvell SATA support"250250+ select GENERIC_PHY250251 help251252 This option enables support for the Marvell Serial ATA family.252253 Currently supports 88SX[56]0[48][01] PCI(-X) chips,
···10761076{10771077 struct powernow_k8_data *data;10781078 struct init_on_cpu init_on_cpu;10791079- int rc;10791079+ int rc, cpu;1080108010811081 smp_call_function_single(pol->cpu, check_supported_cpu, &rc, 1);10821082 if (rc)···11401140 pr_debug("cpu_init done, current fid 0x%x, vid 0x%x\n",11411141 data->currfid, data->currvid);1142114211431143- per_cpu(powernow_data, pol->cpu) = data;11431143+ /* Point all the CPUs in this policy to the same data */11441144+ for_each_cpu(cpu, pol->cpus)11451145+ per_cpu(powernow_data, cpu) = data;1144114611451147 return 0;11461148···11571155static int powernowk8_cpu_exit(struct cpufreq_policy *pol)11581156{11591157 struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu);11581158+ int cpu;1160115911611160 if (!data)11621161 return -EINVAL;···1168116511691166 kfree(data->powernow_table);11701167 kfree(data);11711171- per_cpu(powernow_data, pol->cpu) = NULL;11681168+ for_each_cpu(cpu, pol->cpus)11691169+ per_cpu(powernow_data, cpu) = NULL;1172117011731171 return 0;11741172}
+12
drivers/gpu/drm/drm_ioctl.c
···296296 case DRM_CAP_ASYNC_PAGE_FLIP:297297 req->value = dev->mode_config.async_page_flip;298298 break;299299+ case DRM_CAP_CURSOR_WIDTH:300300+ if (dev->mode_config.cursor_width)301301+ req->value = dev->mode_config.cursor_width;302302+ else303303+ req->value = 64;304304+ break;305305+ case DRM_CAP_CURSOR_HEIGHT:306306+ if (dev->mode_config.cursor_height)307307+ req->value = dev->mode_config.cursor_height;308308+ else309309+ req->value = 64;310310+ break;299311 default:300312 return -EINVAL;301313 }
···85868586 if (ring->id == RCS)85878587 len += 6;8588858885898589+ /*85908590+ * BSpec MI_DISPLAY_FLIP for IVB:85918591+ * "The full packet must be contained within the same cache line."85928592+ *85938593+ * Currently the LRI+SRM+MI_DISPLAY_FLIP all fit within the same85948594+ * cacheline, if we ever start emitting more commands before85958595+ * the MI_DISPLAY_FLIP we may need to first emit everything else,85968596+ * then do the cacheline alignment, and finally emit the85978597+ * MI_DISPLAY_FLIP.85988598+ */85998599+ ret = intel_ring_cacheline_align(ring);86008600+ if (ret)86018601+ goto err_unpin;86028602+85898603 ret = intel_ring_begin(ring, len);85908604 if (ret)85918605 goto err_unpin;
+13-6
drivers/gpu/drm/i915/intel_dp.c
···537537 uint8_t msg[20];538538 int msg_bytes;539539 uint8_t ack;540540+ int retry;540541541542 if (WARN_ON(send_bytes > 16))542543 return -E2BIG;···549548 msg[3] = send_bytes - 1;550549 memcpy(&msg[4], send, send_bytes);551550 msg_bytes = send_bytes + 4;552552- for (;;) {551551+ for (retry = 0; retry < 7; retry++) {553552 ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes, &ack, 1);554553 if (ret < 0)555554 return ret;556555 ack >>= 4;557556 if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_ACK)558558- break;557557+ return send_bytes;559558 else if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_DEFER)560560- udelay(100);559559+ usleep_range(400, 500);561560 else562561 return -EIO;563562 }564564- return send_bytes;563563+564564+ DRM_ERROR("too many retries, giving up\n");565565+ return -EIO;565566}566567567568/* Write a single byte to the aux channel in native mode */···585582 int reply_bytes;586583 uint8_t ack;587584 int ret;585585+ int retry;588586589587 if (WARN_ON(recv_bytes > 19))590588 return -E2BIG;···599595 msg_bytes = 4;600596 reply_bytes = recv_bytes + 1;601597602602- for (;;) {598598+ for (retry = 0; retry < 7; retry++) {603599 ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes,604600 reply, reply_bytes);605601 if (ret == 0)···612608 return ret - 1;613609 }614610 else if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_DEFER)615615- udelay(100);611611+ usleep_range(400, 500);616612 else617613 return -EIO;618614 }615615+616616+ DRM_ERROR("too many retries, giving up\n");617617+ return -EIO;619618}620619621620static int
+21
drivers/gpu/drm/i915/intel_ringbuffer.c
···16531653 return 0;16541654}1655165516561656+/* Align the ring tail to a cacheline boundary */16571657+int intel_ring_cacheline_align(struct intel_ring_buffer *ring)16581658+{16591659+ int num_dwords = (64 - (ring->tail & 63)) / sizeof(uint32_t);16601660+ int ret;16611661+16621662+ if (num_dwords == 0)16631663+ return 0;16641664+16651665+ ret = intel_ring_begin(ring, num_dwords);16661666+ if (ret)16671667+ return ret;16681668+16691669+ while (num_dwords--)16701670+ intel_ring_emit(ring, MI_NOOP);16711671+16721672+ intel_ring_advance(ring);16731673+16741674+ return 0;16751675+}16761676+16561677void intel_ring_init_seqno(struct intel_ring_buffer *ring, u32 seqno)16571678{16581679 struct drm_i915_private *dev_priv = ring->dev->dev_private;
···130130 u16 pcir;131131 int i;132132133133+ /* there is no prom on nv4x IGP's */134134+ if (device->card_type == NV_40 && device->chipset >= 0x4c)135135+ return;136136+133137 /* enable access to rom */134138 if (device->card_type >= NV_50)135139 pcireg = 0x088050;
···11+/*22+ * Copyright 2014 Ilia Mirkin33+ *44+ * Permission is hereby granted, free of charge, to any person obtaining a55+ * copy of this software and associated documentation files (the "Software"),66+ * to deal in the Software without restriction, including without limitation77+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,88+ * and/or sell copies of the Software, and to permit persons to whom the99+ * Software is furnished to do so, subject to the following conditions:1010+ *1111+ * The above copyright notice and this permission notice shall be included in1212+ * all copies or substantial portions of the Software.1313+ *1414+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR1515+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,1616+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL1717+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR1818+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,1919+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR2020+ * OTHER DEALINGS IN THE SOFTWARE.2121+ *2222+ * Authors: Ilia Mirkin2323+ */2424+2525+#include "nv04.h"2626+2727+static void2828+nv4c_mc_msi_rearm(struct nouveau_mc *pmc)2929+{3030+ struct nv04_mc_priv *priv = (void *)pmc;3131+ nv_wr08(priv, 0x088050, 0xff);3232+}3333+3434+struct nouveau_oclass *3535+nv4c_mc_oclass = &(struct nouveau_mc_oclass) {3636+ .base.handle = NV_SUBDEV(MC, 0x4c),3737+ .base.ofuncs = &(struct nouveau_ofuncs) {3838+ .ctor = nv04_mc_ctor,3939+ .dtor = _nouveau_mc_dtor,4040+ .init = nv44_mc_init,4141+ .fini = _nouveau_mc_fini,4242+ },4343+ .intr = nv04_mc_intr,4444+ .msi_rearm = nv4c_mc_msi_rearm,4545+}.base;
+24-2
drivers/gpu/drm/nouveau/nouveau_acpi.c
···106106 return 0;107107}108108109109+/*110110+ * On some platforms, _DSM(nouveau_op_dsm_muid, func0) has special111111+ * requirements on the fourth parameter, so a private implementation112112+ * instead of using acpi_check_dsm().113113+ */114114+static int nouveau_check_optimus_dsm(acpi_handle handle)115115+{116116+ int result;117117+118118+ /*119119+ * Function 0 returns a Buffer containing available functions.120120+ * The args parameter is ignored for function 0, so just put 0 in it121121+ */122122+ if (nouveau_optimus_dsm(handle, 0, 0, &result))123123+ return 0;124124+125125+ /*126126+ * ACPI Spec v4 9.14.1: if bit 0 is zero, no function is supported.127127+ * If the n-th bit is enabled, function n is supported128128+ */129129+ return result & 1 && result & (1 << NOUVEAU_DSM_OPTIMUS_CAPS);130130+}131131+109132static int nouveau_dsm(acpi_handle handle, int func, int arg)110133{111134 int ret = 0;···230207 1 << NOUVEAU_DSM_POWER))231208 retval |= NOUVEAU_DSM_HAS_MUX;232209233233- if (acpi_check_dsm(dhandle, nouveau_op_dsm_muid, 0x00000100,234234- 1 << NOUVEAU_DSM_OPTIMUS_CAPS))210210+ if (nouveau_check_optimus_dsm(dhandle))235211 retval |= NOUVEAU_DSM_HAS_OPT;236212237213 if (retval & NOUVEAU_DSM_HAS_OPT) {
···376376 if (ret)377377 goto fail_device;378378379379+ dev->irq_enabled = true;380380+379381 /* workaround an odd issue on nvc1 by disabling the device's380382 * nosnoop capability. hopefully won't cause issues until a381383 * better fix is found - assuming there is one...···477475 struct nouveau_drm *drm = nouveau_drm(dev);478476 struct nouveau_object *device;479477478478+ dev->irq_enabled = false;480479 device = drm->client.base.device;481480 drm_put_dev(dev);482481
···25882588 if (NISLANDS_DPM2_SQ_RAMP_STI_SIZE > (STI_SIZE_MASK >> STI_SIZE_SHIFT))25892589 enable_sq_ramping = false;2590259025912591- if (NISLANDS_DPM2_SQ_RAMP_LTI_RATIO <= (LTI_RATIO_MASK >> LTI_RATIO_SHIFT))25912591+ if (NISLANDS_DPM2_SQ_RAMP_LTI_RATIO > (LTI_RATIO_MASK >> LTI_RATIO_SHIFT))25922592 enable_sq_ramping = false;2593259325942594 for (i = 0; i < state->performance_level_count; i++) {
+3-1
drivers/gpu/drm/radeon/radeon.h
···135135/* R600+ */136136#define R600_RING_TYPE_UVD_INDEX 5137137138138+/* number of hw syncs before falling back on blocking */139139+#define RADEON_NUM_SYNCS 4140140+138141/* hardcode those limit for now */139142#define RADEON_VA_IB_OFFSET (1 << 20)140143#define RADEON_VA_RESERVED_SIZE (8 << 20)···557554/*558555 * Semaphores.559556 */560560-/* everything here is constant */561557struct radeon_semaphore {562558 struct radeon_sa_bo *sa_bo;563559 signed waiters;
···169169 SVGA_REG_TRACES = 45, /* Enable trace-based updates even when FIFO is on */170170 SVGA_REG_GMRS_MAX_PAGES = 46, /* Maximum number of 4KB pages for all GMRs */171171 SVGA_REG_MEMORY_SIZE = 47, /* Total dedicated device memory excluding FIFO */172172+ SVGA_REG_COMMAND_LOW = 48, /* Lower 32 bits and submits commands */173173+ SVGA_REG_COMMAND_HIGH = 49, /* Upper 32 bits of command buffer PA */172174 SVGA_REG_MAX_PRIMARY_BOUNDING_BOX_MEM = 50, /* Max primary memory */173175 SVGA_REG_SUGGESTED_GBOBJECT_MEM_SIZE_KB = 51, /* Suggested limit on mob mem */174176 SVGA_REG_DEV_CAP = 52, /* Write dev cap index, read value */175175- SVGA_REG_TOP = 53, /* Must be 1 more than the last register */177177+ SVGA_REG_CMD_PREPEND_LOW = 53,178178+ SVGA_REG_CMD_PREPEND_HIGH = 54,179179+ SVGA_REG_SCREENTARGET_MAX_WIDTH = 55,180180+ SVGA_REG_SCREENTARGET_MAX_HEIGHT = 56,181181+ SVGA_REG_MOB_MAX_SIZE = 57,182182+ SVGA_REG_TOP = 58, /* Must be 1 more than the last register */176183177184 SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */178185 /* Next 768 (== 256*3) registers exist for colormap */
···582582 int ret;583583 int len = i2c_hid_get_report_length(rep) - 2;584584585585- buf = kzalloc(len, GFP_KERNEL);585585+ buf = hid_alloc_report_buf(rep, GFP_KERNEL);586586 if (!buf)587587 return;588588
···79798080#define ARM_SMMU_PTE_CONT_SIZE (PAGE_SIZE * ARM_SMMU_PTE_CONT_ENTRIES)8181#define ARM_SMMU_PTE_CONT_MASK (~(ARM_SMMU_PTE_CONT_SIZE - 1))8282-#define ARM_SMMU_PTE_HWTABLE_SIZE (PTRS_PER_PTE * sizeof(pte_t))83828483/* Stage-1 PTE */8584#define ARM_SMMU_PTE_AP_UNPRIV (((pteval_t)1) << 6)···190191#define ARM_SMMU_GR1_CBAR(n) (0x0 + ((n) << 2))191192#define CBAR_VMID_SHIFT 0192193#define CBAR_VMID_MASK 0xff194194+#define CBAR_S1_BPSHCFG_SHIFT 8195195+#define CBAR_S1_BPSHCFG_MASK 3196196+#define CBAR_S1_BPSHCFG_NSH 3193197#define CBAR_S1_MEMATTR_SHIFT 12194198#define CBAR_S1_MEMATTR_MASK 0xf195199#define CBAR_S1_MEMATTR_WB 0xf···395393 struct arm_smmu_cfg root_cfg;396394 phys_addr_t output_mask;397395398398- struct mutex lock;396396+ spinlock_t lock;399397};400398401399static DEFINE_SPINLOCK(arm_smmu_devices_lock);···634632 return IRQ_HANDLED;635633}636634635635+static void arm_smmu_flush_pgtable(struct arm_smmu_device *smmu, void *addr,636636+ size_t size)637637+{638638+ unsigned long offset = (unsigned long)addr & ~PAGE_MASK;639639+640640+641641+ /* Ensure new page tables are visible to the hardware walker */642642+ if (smmu->features & ARM_SMMU_FEAT_COHERENT_WALK) {643643+ dsb();644644+ } else {645645+ /*646646+ * If the SMMU can't walk tables in the CPU caches, treat them647647+ * like non-coherent DMA since we need to flush the new entries648648+ * all the way out to memory. There's no possibility of649649+ * recursion here as the SMMU table walker will not be wired650650+ * through another SMMU.651651+ */652652+ dma_map_page(smmu->dev, virt_to_page(addr), offset, size,653653+ DMA_TO_DEVICE);654654+ }655655+}656656+637657static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain)638658{639659 u32 reg;···674650 if (smmu->version == 1)675651 reg |= root_cfg->irptndx << CBAR_IRPTNDX_SHIFT;676652677677- /* Use the weakest memory type, so it is overridden by the pte */678678- if (stage1)679679- reg |= (CBAR_S1_MEMATTR_WB << CBAR_S1_MEMATTR_SHIFT);680680- else653653+ /*654654+ * Use the weakest shareability/memory types, so they are655655+ * overridden by the ttbcr/pte.656656+ */657657+ if (stage1) {658658+ reg |= (CBAR_S1_BPSHCFG_NSH << CBAR_S1_BPSHCFG_SHIFT) |659659+ (CBAR_S1_MEMATTR_WB << CBAR_S1_MEMATTR_SHIFT);660660+ } else {681661 reg |= ARM_SMMU_CB_VMID(root_cfg) << CBAR_VMID_SHIFT;662662+ }682663 writel_relaxed(reg, gr1_base + ARM_SMMU_GR1_CBAR(root_cfg->cbndx));683664684665 if (smmu->version > 1) {···744715 }745716746717 /* TTBR0 */718718+ arm_smmu_flush_pgtable(smmu, root_cfg->pgd,719719+ PTRS_PER_PGD * sizeof(pgd_t));747720 reg = __pa(root_cfg->pgd);748721 writel_relaxed(reg, cb_base + ARM_SMMU_CB_TTBR0_LO);749722 reg = (phys_addr_t)__pa(root_cfg->pgd) >> 32;···932901 goto out_free_domain;933902 smmu_domain->root_cfg.pgd = pgd;934903935935- mutex_init(&smmu_domain->lock);904904+ spin_lock_init(&smmu_domain->lock);936905 domain->priv = smmu_domain;937906 return 0;938907···11591128 struct arm_smmu_domain *smmu_domain = domain->priv;11601129 struct arm_smmu_device *device_smmu = dev->archdata.iommu;11611130 struct arm_smmu_master *master;11311131+ unsigned long flags;1162113211631133 if (!device_smmu) {11641134 dev_err(dev, "cannot attach to SMMU, is it on the same bus?\n");···11701138 * Sanity check the domain. We don't currently support domains11711139 * that cross between different SMMU chains.11721140 */11731173- mutex_lock(&smmu_domain->lock);11411141+ spin_lock_irqsave(&smmu_domain->lock, flags);11741142 if (!smmu_domain->leaf_smmu) {11751143 /* Now that we have a master, we can finalise the domain */11761144 ret = arm_smmu_init_domain_context(domain, dev);···11851153 dev_name(device_smmu->dev));11861154 goto err_unlock;11871155 }11881188- mutex_unlock(&smmu_domain->lock);11561156+ spin_unlock_irqrestore(&smmu_domain->lock, flags);1189115711901158 /* Looks ok, so add the device to the domain */11911159 master = find_smmu_master(smmu_domain->leaf_smmu, dev->of_node);···11951163 return arm_smmu_domain_add_master(smmu_domain, master);1196116411971165err_unlock:11981198- mutex_unlock(&smmu_domain->lock);11661166+ spin_unlock_irqrestore(&smmu_domain->lock, flags);11991167 return ret;12001168}12011169···12071175 master = find_smmu_master(smmu_domain->leaf_smmu, dev->of_node);12081176 if (master)12091177 arm_smmu_domain_remove_master(smmu_domain, master);12101210-}12111211-12121212-static void arm_smmu_flush_pgtable(struct arm_smmu_device *smmu, void *addr,12131213- size_t size)12141214-{12151215- unsigned long offset = (unsigned long)addr & ~PAGE_MASK;12161216-12171217- /*12181218- * If the SMMU can't walk tables in the CPU caches, treat them12191219- * like non-coherent DMA since we need to flush the new entries12201220- * all the way out to memory. There's no possibility of recursion12211221- * here as the SMMU table walker will not be wired through another12221222- * SMMU.12231223- */12241224- if (!(smmu->features & ARM_SMMU_FEAT_COHERENT_WALK))12251225- dma_map_page(smmu->dev, virt_to_page(addr), offset, size,12261226- DMA_TO_DEVICE);12271178}1228117912291180static bool arm_smmu_pte_is_contiguous_range(unsigned long addr,···1225121012261211 if (pmd_none(*pmd)) {12271212 /* Allocate a new set of tables */12281228- pgtable_t table = alloc_page(PGALLOC_GFP);12131213+ pgtable_t table = alloc_page(GFP_ATOMIC|__GFP_ZERO);12291214 if (!table)12301215 return -ENOMEM;1231121612321232- arm_smmu_flush_pgtable(smmu, page_address(table),12331233- ARM_SMMU_PTE_HWTABLE_SIZE);12171217+ arm_smmu_flush_pgtable(smmu, page_address(table), PAGE_SIZE);12341218 if (!pgtable_page_ctor(table)) {12351219 __free_page(table);12361220 return -ENOMEM;···1331131713321318#ifndef __PAGETABLE_PMD_FOLDED13331319 if (pud_none(*pud)) {13341334- pmd = pmd_alloc_one(NULL, addr);13201320+ pmd = (pmd_t *)get_zeroed_page(GFP_ATOMIC);13351321 if (!pmd)13361322 return -ENOMEM;13231323+13241324+ arm_smmu_flush_pgtable(smmu, pmd, PAGE_SIZE);13251325+ pud_populate(NULL, pud, pmd);13261326+ arm_smmu_flush_pgtable(smmu, pud, sizeof(*pud));13271327+13281328+ pmd += pmd_index(addr);13371329 } else13381330#endif13391331 pmd = pmd_offset(pud, addr);···13481328 next = pmd_addr_end(addr, end);13491329 ret = arm_smmu_alloc_init_pte(smmu, pmd, addr, end, pfn,13501330 flags, stage);13511351- pud_populate(NULL, pud, pmd);13521352- arm_smmu_flush_pgtable(smmu, pud, sizeof(*pud));13531331 phys += next - addr;13541332 } while (pmd++, addr = next, addr < end);13551333···1364134613651347#ifndef __PAGETABLE_PUD_FOLDED13661348 if (pgd_none(*pgd)) {13671367- pud = pud_alloc_one(NULL, addr);13491349+ pud = (pud_t *)get_zeroed_page(GFP_ATOMIC);13681350 if (!pud)13691351 return -ENOMEM;13521352+13531353+ arm_smmu_flush_pgtable(smmu, pud, PAGE_SIZE);13541354+ pgd_populate(NULL, pgd, pud);13551355+ arm_smmu_flush_pgtable(smmu, pgd, sizeof(*pgd));13561356+13571357+ pud += pud_index(addr);13701358 } else13711359#endif13721360 pud = pud_offset(pgd, addr);···13811357 next = pud_addr_end(addr, end);13821358 ret = arm_smmu_alloc_init_pmd(smmu, pud, addr, next, phys,13831359 flags, stage);13841384- pgd_populate(NULL, pud, pgd);13851385- arm_smmu_flush_pgtable(smmu, pgd, sizeof(*pgd));13861360 phys += next - addr;13871361 } while (pud++, addr = next, addr < end);13881362···13971375 struct arm_smmu_cfg *root_cfg = &smmu_domain->root_cfg;13981376 pgd_t *pgd = root_cfg->pgd;13991377 struct arm_smmu_device *smmu = root_cfg->smmu;13781378+ unsigned long irqflags;1400137914011380 if (root_cfg->cbar == CBAR_TYPE_S2_TRANS) {14021381 stage = 2;···14201397 if (paddr & ~output_mask)14211398 return -ERANGE;1422139914231423- mutex_lock(&smmu_domain->lock);14001400+ spin_lock_irqsave(&smmu_domain->lock, irqflags);14241401 pgd += pgd_index(iova);14251402 end = iova + size;14261403 do {···14361413 } while (pgd++, iova != end);1437141414381415out_unlock:14391439- mutex_unlock(&smmu_domain->lock);14401440-14411441- /* Ensure new page tables are visible to the hardware walker */14421442- if (smmu->features & ARM_SMMU_FEAT_COHERENT_WALK)14431443- dsb();14161416+ spin_unlock_irqrestore(&smmu_domain->lock, irqflags);1444141714451418 return ret;14461419}···20061987 if (!iommu_present(&platform_bus_type))20071988 bus_set_iommu(&platform_bus_type, &arm_smmu_ops);2008198919901990+#ifdef CONFIG_ARM_AMBA20091991 if (!iommu_present(&amba_bustype))20101992 bus_set_iommu(&amba_bustype, &arm_smmu_ops);19931993+#endif2011199420121995 return 0;20131996}
+19-3
drivers/irqchip/irq-orion.c
···111111static void orion_bridge_irq_handler(unsigned int irq, struct irq_desc *desc)112112{113113 struct irq_domain *d = irq_get_handler_data(irq);114114- struct irq_chip_generic *gc = irq_get_domain_generic_chip(d, irq);114114+115115+ struct irq_chip_generic *gc = irq_get_domain_generic_chip(d, 0);115116 u32 stat = readl_relaxed(gc->reg_base + ORION_BRIDGE_IRQ_CAUSE) &116117 gc->mask_cache;117118···122121 generic_handle_irq(irq_find_mapping(d, gc->irq_base + hwirq));123122 stat &= ~(1 << hwirq);124123 }124124+}125125+126126+/*127127+ * Bridge IRQ_CAUSE is asserted regardless of IRQ_MASK register.128128+ * To avoid interrupt events on stale irqs, we clear them before unmask.129129+ */130130+static unsigned int orion_bridge_irq_startup(struct irq_data *d)131131+{132132+ struct irq_chip_type *ct = irq_data_get_chip_type(d);133133+134134+ ct->chip.irq_ack(d);135135+ ct->chip.irq_unmask(d);136136+ return 0;125137}126138127139static int __init orion_bridge_irq_init(struct device_node *np,···157143 }158144159145 ret = irq_alloc_domain_generic_chips(domain, nrirqs, 1, np->name,160160- handle_level_irq, clr, 0, IRQ_GC_INIT_MASK_CACHE);146146+ handle_edge_irq, clr, 0, IRQ_GC_INIT_MASK_CACHE);161147 if (ret) {162148 pr_err("%s: unable to alloc irq domain gc\n", np->name);163149 return ret;···190176191177 gc->chip_types[0].regs.ack = ORION_BRIDGE_IRQ_CAUSE;192178 gc->chip_types[0].regs.mask = ORION_BRIDGE_IRQ_MASK;179179+ gc->chip_types[0].chip.irq_startup = orion_bridge_irq_startup;193180 gc->chip_types[0].chip.irq_ack = irq_gc_ack_clr_bit;194181 gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit;195182 gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit;196183197197- /* mask all interrupts */184184+ /* mask and clear all interrupts */198185 writel(0, gc->reg_base + ORION_BRIDGE_IRQ_MASK);186186+ writel(0, gc->reg_base + ORION_BRIDGE_IRQ_CAUSE);199187200188 irq_set_handler_data(irq, domain);201189 irq_set_chained_handler(irq, orion_bridge_irq_handler);
+10-2
drivers/mfd/da9055-i2c.c
···5353 return 0;5454}55555656+/*5757+ * DO NOT change the device Ids. The naming is intentionally specific as both5858+ * the PMIC and CODEC parts of this chip are instantiated separately as I2C5959+ * devices (both have configurable I2C addresses, and are to all intents and6060+ * purposes separate). As a result there are specific DA9055 ids for PMIC6161+ * and CODEC, which must be different to operate together.6262+ */5663static struct i2c_device_id da9055_i2c_id[] = {5757- {"da9055", 0},6464+ {"da9055-pmic", 0},5865 { }5966};6767+MODULE_DEVICE_TABLE(i2c, da9055_i2c_id);60686169static struct i2c_driver da9055_i2c_driver = {6270 .probe = da9055_i2c_probe,6371 .remove = da9055_i2c_remove,6472 .id_table = da9055_i2c_id,6573 .driver = {6666- .name = "da9055",7474+ .name = "da9055-pmic",6775 .owner = THIS_MODULE,6876 },6977};
···139139 This adds a specialized tap character device driver that is based140140 on the MAC-VLAN network interface, called macvtap. A macvtap device141141 can be added in the same way as a macvlan device, using 'type142142- macvlan', and then be accessed through the tap user space interface.142142+ macvtap', and then be accessed through the tap user space interface.143143144144 To compile this driver as a module, choose M here: the module145145 will be called macvtap.
···17781778 struct fec_enet_private *fep = netdev_priv(ndev);17791779 int ret;1780178017811781- napi_enable(&fep->napi);17821782-17831781 /* I should reset the ring buffers here, but I don't yet know17841782 * a simple way to do that.17851783 */···17921794 fec_enet_free_buffers(ndev);17931795 return ret;17941796 }17971797+17981798+ napi_enable(&fep->napi);17951799 phy_start(fep->phy_dev);17961800 netif_start_queue(ndev);17971801 fep->opened = 1;
···619619620620static u16621621ltq_etop_select_queue(struct net_device *dev, struct sk_buff *skb,622622- void *accel_priv)622622+ void *accel_priv, select_queue_fallback_t fallback)623623{624624 /* we are currently only using the first queue */625625 return 0;
+3-3
drivers/net/ethernet/marvell/Kconfig
···4343 This driver is used by the MV643XX_ETH and MVNETA drivers.44444545config MVNETA4646- tristate "Marvell Armada 370/XP network interface support"4747- depends on MACH_ARMADA_370_XP4646+ tristate "Marvell Armada 370/38x/XP network interface support"4747+ depends on PLAT_ORION4848 select MVMDIO4949 ---help---5050 This driver supports the network interface units in the5151- Marvell ARMADA XP and ARMADA 370 SoC family.5151+ Marvell ARMADA XP, ARMADA 370 and ARMADA 38x SoC family.52525353 Note that this driver is distinct from the mv643xx_eth5454 driver, which should be used for the older Marvell SoCs
···3737 stmmac device driver. This driver is used for A20/A313838 GMAC ethernet controller.39394040+config DWMAC_STI4141+ bool "STi GMAC support"4242+ depends on STMMAC_PLATFORM && ARCH_STI4343+ default y4444+ ---help---4545+ Support for ethernet controller on STi SOCs.4646+4747+ This selects STi SoC glue layer support for the stmmac4848+ device driver. This driver is used on for the STi series4949+ SOCs GMAC ethernet controller.5050+4051config STMMAC_PCI4152 bool "STMMAC PCI bus support"4253 depends on STMMAC_ETH && PCI
···554554 * common for both the interface as the interface shares555555 * the same hardware resource.556556 */557557- for (i = 0; i <= priv->data.slaves; i++)557557+ for (i = 0; i < priv->data.slaves; i++)558558 if (priv->slaves[i].ndev->flags & IFF_PROMISC)559559 flag = true;560560···578578 unsigned long timeout = jiffies + HZ;579579580580 /* Disable Learn for all ports */581581- for (i = 0; i <= priv->data.slaves; i++) {581581+ for (i = 0; i < priv->data.slaves; i++) {582582 cpsw_ale_control_set(ale, i,583583 ALE_PORT_NOLEARN, 1);584584 cpsw_ale_control_set(ale, i,···606606 cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 0);607607608608 /* Enable Learn for all ports */609609- for (i = 0; i <= priv->data.slaves; i++) {609609+ for (i = 0; i < priv->data.slaves; i++) {610610 cpsw_ale_control_set(ale, i,611611 ALE_PORT_NOLEARN, 0);612612 cpsw_ale_control_set(ale, i,···18961896 memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN);1897189718981898 slave_data->phy_if = of_get_phy_mode(slave_node);18991899+ if (slave_data->phy_if < 0) {19001900+ pr_err("Missing or malformed slave[%d] phy-mode property\n",19011901+ i);19021902+ return slave_data->phy_if;19031903+ }1899190419001905 if (data->dual_emac) {19011906 if (of_property_read_u32(slave_node, "dual_emac_res_vlan",
+1-1
drivers/net/ethernet/tile/tilegx.c
···2071207120722072/* Return subqueue id on this core (one per core). */20732073static u16 tile_net_select_queue(struct net_device *dev, struct sk_buff *skb,20742074- void *accel_priv)20742074+ void *accel_priv, select_queue_fallback_t fallback)20752075{20762076 return smp_processor_id();20772077}
···16481648}1649164916501650static u16 team_select_queue(struct net_device *dev, struct sk_buff *skb,16511651- void *accel_priv)16511651+ void *accel_priv, select_queue_fallback_t fallback)16521652{16531653 /*16541654 * This helper function exists to help dev_pick_tx get the correct
···296296 tristate "CoreChip-sz SR9800 based USB 2.0 10/100 ethernet devices"297297 depends on USB_USBNET298298 select CRC32299299- default y300299 ---help---301300 Say Y if you want to use one of the following 100Mbps USB Ethernet302301 device based on the CoreChip-sz SR9800 chip.
···11181118 u16 hdr_off;11191119 u32 *pkt_hdr;1120112011211121+ /* This check is no longer done by usbnet */11221122+ if (skb->len < dev->net->hard_header_len)11231123+ return 0;11241124+11211125 skb_trim(skb, skb->len - 4);11221126 memcpy(&rx_hdr, skb_tail_pointer(skb), 4);11231127 le32_to_cpus(&rx_hdr);
+4
drivers/net/usb/gl620a.c
···8484 u32 size;8585 u32 count;86868787+ /* This check is no longer done by usbnet */8888+ if (skb->len < dev->net->hard_header_len)8989+ return 0;9090+8791 header = (struct gl_header *) skb->data;88928993 // get the packet count of the received skb
+3-2
drivers/net/usb/mcs7830.c
···526526{527527 u8 status;528528529529- if (skb->len == 0) {530530- dev_err(&dev->udev->dev, "unexpected empty rx frame\n");529529+ /* This check is no longer done by usbnet */530530+ if (skb->len < dev->net->hard_header_len) {531531+ dev_err(&dev->udev->dev, "unexpected tiny rx frame\n");531532 return 0;532533 }533534
+4
drivers/net/usb/net1080.c
···364364 struct nc_trailer *trailer;365365 u16 hdr_len, packet_len;366366367367+ /* This check is no longer done by usbnet */368368+ if (skb->len < dev->net->hard_header_len)369369+ return 0;370370+367371 if (!(skb->len & 0x01)) {368372 netdev_dbg(dev->net, "rx framesize %d range %d..%d mtu %d\n",369373 skb->len, dev->net->hard_header_len, dev->hard_mtu,
+5-4
drivers/net/usb/qmi_wwan.c
···8080{8181 __be16 proto;82828383- /* usbnet rx_complete guarantees that skb->len is at least8484- * hard_header_len, so we can inspect the dest address without8585- * checking skb->len8686- */8383+ /* This check is no longer done by usbnet */8484+ if (skb->len < dev->net->hard_header_len)8585+ return 0;8686+8787 switch (skb->data[0] & 0xf0) {8888 case 0x40:8989 proto = htons(ETH_P_IP);···732732 {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */733733 {QMI_FIXED_INTF(0x0b3c, 0xc005, 6)}, /* Olivetti Olicard 200 */734734 {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */735735+ {QMI_FIXED_INTF(0x1e2d, 0x0053, 4)}, /* Cinterion PHxx,PXxx */735736736737 /* 4. Gobi 1000 devices */737738 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
+4
drivers/net/usb/rndis_host.c
···492492 */493493int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb)494494{495495+ /* This check is no longer done by usbnet */496496+ if (skb->len < dev->net->hard_header_len)497497+ return 0;498498+495499 /* peripheral may have batched packets to us... */496500 while (likely(skb->len)) {497501 struct rndis_data_hdr *hdr = (void *)skb->data;
+4
drivers/net/usb/smsc75xx.c
···2106210621072107static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)21082108{21092109+ /* This check is no longer done by usbnet */21102110+ if (skb->len < dev->net->hard_header_len)21112111+ return 0;21122112+21092113 while (skb->len > 0) {21102114 u32 rx_cmd_a, rx_cmd_b, align_count, size;21112115 struct sk_buff *ax_skb;
+4
drivers/net/usb/smsc95xx.c
···1723172317241724static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)17251725{17261726+ /* This check is no longer done by usbnet */17271727+ if (skb->len < dev->net->hard_header_len)17281728+ return 0;17291729+17261730 while (skb->len > 0) {17271731 u32 header, align_count;17281732 struct sk_buff *ax_skb;
+5-1
drivers/net/usb/sr9800.c
···6363{6464 int offset = 0;65656666+ /* This check is no longer done by usbnet */6767+ if (skb->len < dev->net->hard_header_len)6868+ return 0;6969+6670 while (offset + sizeof(u32) < skb->len) {6771 struct sk_buff *sr_skb;6872 u16 size;···827823 dev->rx_urb_size =828824 SR9800_BULKIN_SIZE[SR9800_MAX_BULKIN_2K].size;829825 }830830- netdev_dbg(dev->net, "%s : setting rx_urb_size with : %ld\n", __func__,826826+ netdev_dbg(dev->net, "%s : setting rx_urb_size with : %zu\n", __func__,831827 dev->rx_urb_size);832828 return 0;833829
+10-15
drivers/net/usb/usbnet.c
···542542 }543543 // else network stack removes extra byte if we forced a short packet544544545545- if (skb->len) {546546- /* all data was already cloned from skb inside the driver */547547- if (dev->driver_info->flags & FLAG_MULTI_PACKET)548548- dev_kfree_skb_any(skb);549549- else550550- usbnet_skb_return(dev, skb);545545+ /* all data was already cloned from skb inside the driver */546546+ if (dev->driver_info->flags & FLAG_MULTI_PACKET)547547+ goto done;548548+549549+ if (skb->len < ETH_HLEN) {550550+ dev->net->stats.rx_errors++;551551+ dev->net->stats.rx_length_errors++;552552+ netif_dbg(dev, rx_err, dev->net, "rx length %d\n", skb->len);553553+ } else {554554+ usbnet_skb_return(dev, skb);551555 return;552556 }553557554554- netif_dbg(dev, rx_err, dev->net, "drop\n");555555- dev->net->stats.rx_errors++;556558done:557559 skb_queue_tail(&dev->done, skb);558560}···576574 switch (urb_status) {577575 /* success */578576 case 0:579579- if (skb->len < dev->net->hard_header_len) {580580- state = rx_cleanup;581581- dev->net->stats.rx_errors++;582582- dev->net->stats.rx_length_errors++;583583- netif_dbg(dev, rx_err, dev->net,584584- "rx length %d\n", skb->len);585585- }586577 break;587578588579 /* stalls need manual reset. this is rare ... except that
···937937 bool is92c;938938 int err;939939 u8 tmp_u1b;940940+ unsigned long flags;940941941942 rtlpci->being_init_adapter = true;943943+944944+ /* Since this function can take a very long time (up to 350 ms)945945+ * and can be called with irqs disabled, reenable the irqs946946+ * to let the other devices continue being serviced.947947+ *948948+ * It is safe doing so since our own interrupts will only be enabled949949+ * in a subsequent step.950950+ */951951+ local_save_flags(flags);952952+ local_irq_enable();953953+942954 rtlpriv->intf_ops->disable_aspm(hw);943955 rtstatus = _rtl92ce_init_mac(hw);944956 if (!rtstatus) {945957 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Init MAC failed\n");946958 err = 1;947947- return err;959959+ goto exit;948960 }949961950962 err = rtl92c_download_fw(hw);···964952 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,965953 "Failed to download FW. Init HW without FW now..\n");966954 err = 1;967967- return err;955955+ goto exit;968956 }969957970958 rtlhal->last_hmeboxnum = 0;···10441032 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "under 1.5V\n");10451033 }10461034 rtl92c_dm_init(hw);10351035+exit:10361036+ local_irq_restore(flags);10471037 rtlpci->being_init_adapter = false;10481038 return err;10491039}
+74-76
drivers/of/base.c
···342342}343343EXPORT_SYMBOL(of_get_cpu_node);344344345345-/** Checks if the given "compat" string matches one of the strings in346346- * the device's "compatible" property345345+/**346346+ * __of_device_is_compatible() - Check if the node matches given constraints347347+ * @device: pointer to node348348+ * @compat: required compatible string, NULL or "" for any match349349+ * @type: required device_type value, NULL or "" for any match350350+ * @name: required node name, NULL or "" for any match351351+ *352352+ * Checks if the given @compat, @type and @name strings match the353353+ * properties of the given @device. A constraints can be skipped by354354+ * passing NULL or an empty string as the constraint.355355+ *356356+ * Returns 0 for no match, and a positive integer on match. The return357357+ * value is a relative score with larger values indicating better358358+ * matches. The score is weighted for the most specific compatible value359359+ * to get the highest score. Matching type is next, followed by matching360360+ * name. Practically speaking, this results in the following priority361361+ * order for matches:362362+ *363363+ * 1. specific compatible && type && name364364+ * 2. specific compatible && type365365+ * 3. specific compatible && name366366+ * 4. specific compatible367367+ * 5. general compatible && type && name368368+ * 6. general compatible && type369369+ * 7. general compatible && name370370+ * 8. general compatible371371+ * 9. type && name372372+ * 10. type373373+ * 11. name347374 */348375static int __of_device_is_compatible(const struct device_node *device,349349- const char *compat)376376+ const char *compat, const char *type, const char *name)350377{351351- const char* cp;352352- int cplen, l;378378+ struct property *prop;379379+ const char *cp;380380+ int index = 0, score = 0;353381354354- cp = __of_get_property(device, "compatible", &cplen);355355- if (cp == NULL)356356- return 0;357357- while (cplen > 0) {358358- if (of_compat_cmp(cp, compat, strlen(compat)) == 0)359359- return 1;360360- l = strlen(cp) + 1;361361- cp += l;362362- cplen -= l;382382+ /* Compatible match has highest priority */383383+ if (compat && compat[0]) {384384+ prop = __of_find_property(device, "compatible", NULL);385385+ for (cp = of_prop_next_string(prop, NULL); cp;386386+ cp = of_prop_next_string(prop, cp), index++) {387387+ if (of_compat_cmp(cp, compat, strlen(compat)) == 0) {388388+ score = INT_MAX/2 - (index << 2);389389+ break;390390+ }391391+ }392392+ if (!score)393393+ return 0;363394 }364395365365- return 0;396396+ /* Matching type is better than matching name */397397+ if (type && type[0]) {398398+ if (!device->type || of_node_cmp(type, device->type))399399+ return 0;400400+ score += 2;401401+ }402402+403403+ /* Matching name is a bit better than not */404404+ if (name && name[0]) {405405+ if (!device->name || of_node_cmp(name, device->name))406406+ return 0;407407+ score++;408408+ }409409+410410+ return score;366411}367412368413/** Checks if the given "compat" string matches one of the strings in···420375 int res;421376422377 raw_spin_lock_irqsave(&devtree_lock, flags);423423- res = __of_device_is_compatible(device, compat);378378+ res = __of_device_is_compatible(device, compat, NULL, NULL);424379 raw_spin_unlock_irqrestore(&devtree_lock, flags);425380 return res;426381}···726681 raw_spin_lock_irqsave(&devtree_lock, flags);727682 np = from ? from->allnext : of_allnodes;728683 for (; np; np = np->allnext) {729729- if (type730730- && !(np->type && (of_node_cmp(np->type, type) == 0)))731731- continue;732732- if (__of_device_is_compatible(np, compatible) &&684684+ if (__of_device_is_compatible(np, compatible, type, NULL) &&733685 of_node_get(np))734686 break;735687 }···772730}773731EXPORT_SYMBOL(of_find_node_with_property);774732775775-static const struct of_device_id *776776-of_match_compatible(const struct of_device_id *matches,777777- const struct device_node *node)778778-{779779- const char *cp;780780- int cplen, l;781781- const struct of_device_id *m;782782-783783- cp = __of_get_property(node, "compatible", &cplen);784784- while (cp && (cplen > 0)) {785785- m = matches;786786- while (m->name[0] || m->type[0] || m->compatible[0]) {787787- /* Only match for the entries without type and name */788788- if (m->name[0] || m->type[0] ||789789- of_compat_cmp(m->compatible, cp,790790- strlen(m->compatible)))791791- m++;792792- else793793- return m;794794- }795795-796796- /* Get node's next compatible string */797797- l = strlen(cp) + 1;798798- cp += l;799799- cplen -= l;800800- }801801-802802- return NULL;803803-}804804-805733static806734const struct of_device_id *__of_match_node(const struct of_device_id *matches,807735 const struct device_node *node)808736{809809- const struct of_device_id *m;737737+ const struct of_device_id *best_match = NULL;738738+ int score, best_score = 0;810739811740 if (!matches)812741 return NULL;813742814814- m = of_match_compatible(matches, node);815815- if (m)816816- return m;817817-818818- while (matches->name[0] || matches->type[0] || matches->compatible[0]) {819819- int match = 1;820820- if (matches->name[0])821821- match &= node->name822822- && !strcmp(matches->name, node->name);823823- if (matches->type[0])824824- match &= node->type825825- && !strcmp(matches->type, node->type);826826- if (matches->compatible[0])827827- match &= __of_device_is_compatible(node,828828- matches->compatible);829829- if (match)830830- return matches;831831- matches++;743743+ for (; matches->name[0] || matches->type[0] || matches->compatible[0]; matches++) {744744+ score = __of_device_is_compatible(node, matches->compatible,745745+ matches->type, matches->name);746746+ if (score > best_score) {747747+ best_match = matches;748748+ best_score = score;749749+ }832750 }833833- return NULL;751751+752752+ return best_match;834753}835754836755/**···799796 * @matches: array of of device match structures to search in800797 * @node: the of device structure to match against801798 *802802- * Low level utility function used by device matching. We have two ways803803- * of matching:804804- * - Try to find the best compatible match by comparing each compatible805805- * string of device node with all the given matches respectively.806806- * - If the above method failed, then try to match the compatible by using807807- * __of_device_is_compatible() besides the match in type and name.799799+ * Low level utility function used by device matching.808800 */809801const struct of_device_id *of_match_node(const struct of_device_id *matches,810802 const struct device_node *node)
+14-8
drivers/of/of_mdio.c
···24242525static void of_set_phy_supported(struct phy_device *phydev, u32 max_speed)2626{2727- phydev->supported |= PHY_DEFAULT_FEATURES;2727+ /* The default values for phydev->supported are provided by the PHY2828+ * driver "features" member, we want to reset to sane defaults fist2929+ * before supporting higher speeds.3030+ */3131+ phydev->supported &= PHY_DEFAULT_FEATURES;28322933 switch (max_speed) {3034 default:···4844{4945 struct phy_device *phy;5046 bool is_c45;5151- int rc, prev_irq;4747+ int rc;5248 u32 max_speed = 0;53495450 is_c45 = of_device_is_compatible(child,···5854 if (!phy || IS_ERR(phy))5955 return 1;60566161- if (mdio->irq) {6262- prev_irq = mdio->irq[addr];6363- mdio->irq[addr] =6464- irq_of_parse_and_map(child, 0);6565- if (!mdio->irq[addr])6666- mdio->irq[addr] = prev_irq;5757+ rc = irq_of_parse_and_map(child, 0);5858+ if (rc > 0) {5959+ phy->irq = rc;6060+ if (mdio->irq)6161+ mdio->irq[addr] = rc;6262+ } else {6363+ if (mdio->irq)6464+ phy->irq = mdio->irq[addr];6765 }68666967 /* Associate the OF node with the device structure so it
···6060#define PCIE_DEBUG_CTRL 0x1a606161#define PCIE_DEBUG_SOFT_RESET BIT(20)62626363-/*6464- * This product ID is registered by Marvell, and used when the Marvell6565- * SoC is not the root complex, but an endpoint on the PCIe bus. It is6666- * therefore safe to re-use this PCI ID for our emulated PCI-to-PCI6767- * bridge.6868- */6969-#define MARVELL_EMULATED_PCI_PCI_BRIDGE_ID 0x78467070-7163/* PCI configuration space of a PCI-to-PCI bridge */7264struct mvebu_sw_pci_bridge {7365 u16 vendor;···380388381389 bridge->class = PCI_CLASS_BRIDGE_PCI;382390 bridge->vendor = PCI_VENDOR_ID_MARVELL;383383- bridge->device = MARVELL_EMULATED_PCI_PCI_BRIDGE_ID;391391+ bridge->device = mvebu_readl(port, PCIE_DEV_ID_OFF) >> 16;392392+ bridge->revision = mvebu_readl(port, PCIE_DEV_REV_OFF) & 0xff;384393 bridge->header_type = PCI_HEADER_TYPE_BRIDGE;385394 bridge->cache_line_size = 0x10;386395
+9-3
drivers/pci/msi.c
···545545 return -ENOMEM;546546 list_for_each_entry(entry, &pdev->msi_list, list) {547547 char *name = kmalloc(20, GFP_KERNEL);548548- msi_dev_attr = kzalloc(sizeof(*msi_dev_attr), GFP_KERNEL);549549- if (!msi_dev_attr)548548+ if (!name)550549 goto error_attrs;550550+551551+ msi_dev_attr = kzalloc(sizeof(*msi_dev_attr), GFP_KERNEL);552552+ if (!msi_dev_attr) {553553+ kfree(name);554554+ goto error_attrs;555555+ }556556+551557 sprintf(name, "%d", entry->irq);552558 sysfs_attr_init(&msi_dev_attr->attr);553559 msi_dev_attr->attr.name = name;···595589 ++count;596590 msi_attr = msi_attrs[count];597591 }592592+ kfree(msi_attrs);598593 return ret;599594}600595···966959/**967960 * pci_msix_vec_count - return the number of device's MSI-X table entries968961 * @dev: pointer to the pci_dev data structure of MSI-X device function969969-970962 * This function returns the number of device's MSI-X table entries and971963 * therefore the number of MSI-X vectors device is capable of sending.972964 * It returns a negative errno if the device is not capable of sending MSI-X
+10
drivers/pci/pci.c
···11811181static int do_pci_enable_device(struct pci_dev *dev, int bars)11821182{11831183 int err;11841184+ u16 cmd;11851185+ u8 pin;1184118611851187 err = pci_set_power_state(dev, PCI_D0);11861188 if (err < 0 && err != -EIO)···11911189 if (err < 0)11921190 return err;11931191 pci_fixup_device(pci_fixup_enable, dev);11921192+11931193+ pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);11941194+ if (pin) {11951195+ pci_read_config_word(dev, PCI_COMMAND, &cmd);11961196+ if (cmd & PCI_COMMAND_INTX_DISABLE)11971197+ pci_write_config_word(dev, PCI_COMMAND,11981198+ cmd & ~PCI_COMMAND_INTX_DISABLE);11991199+ }1194120011951201 return 0;11961202}
+1
drivers/phy/Kconfig
···6161config BCM_KONA_USB2_PHY6262 tristate "Broadcom Kona USB2 PHY Driver"6363 depends on GENERIC_PHY6464+ depends on HAS_IOMEM6465 help6566 Enable this to support the Broadcom Kona USB 2.0 PHY.6667
+6-8
drivers/phy/phy-core.c
···176176 dev_err(&phy->dev, "phy init failed --> %d\n", ret);177177 goto out;178178 }179179+ } else {180180+ ret = 0; /* Override possible ret == -ENOTSUPP */179181 }180182 ++phy->init_count;181183···234232 dev_err(&phy->dev, "phy poweron failed --> %d\n", ret);235233 goto out;236234 }235235+ } else {236236+ ret = 0; /* Override possible ret == -ENOTSUPP */237237 }238238 ++phy->power_count;239239 mutex_unlock(&phy->mutex);···408404 index = of_property_match_string(dev->of_node, "phy-names",409405 string);410406 phy = of_phy_get(dev, index);411411- if (IS_ERR(phy)) {412412- dev_err(dev, "unable to find phy\n");413413- return phy;414414- }415407 } else {416408 phy = phy_lookup(dev, string);417417- if (IS_ERR(phy)) {418418- dev_err(dev, "unable to find phy\n");419419- return phy;420420- }421409 }410410+ if (IS_ERR(phy))411411+ return phy;422412423413 if (!try_module_get(phy->ops->owner))424414 return ERR_PTR(-EPROBE_DEFER);
+4-4
drivers/phy/phy-exynos-dp-video.c
···7676 if (IS_ERR(state->regs))7777 return PTR_ERR(state->regs);78787979- phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);8080- if (IS_ERR(phy_provider))8181- return PTR_ERR(phy_provider);8282-8379 phy = devm_phy_create(dev, &exynos_dp_video_phy_ops, NULL);8480 if (IS_ERR(phy)) {8581 dev_err(dev, "failed to create Display Port PHY\n");8682 return PTR_ERR(phy);8783 }8884 phy_set_drvdata(phy, state);8585+8686+ phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);8787+ if (IS_ERR(phy_provider))8888+ return PTR_ERR(phy_provider);89899090 return 0;9191}
+5-5
drivers/phy/phy-exynos-mipi-video.c
···134134 dev_set_drvdata(dev, state);135135 spin_lock_init(&state->slock);136136137137- phy_provider = devm_of_phy_provider_register(dev,138138- exynos_mipi_video_phy_xlate);139139- if (IS_ERR(phy_provider))140140- return PTR_ERR(phy_provider);141141-142137 for (i = 0; i < EXYNOS_MIPI_PHYS_NUM; i++) {143138 struct phy *phy = devm_phy_create(dev,144139 &exynos_mipi_video_phy_ops, NULL);···146151 state->phys[i].index = i;147152 phy_set_drvdata(phy, &state->phys[i]);148153 }154154+155155+ phy_provider = devm_of_phy_provider_register(dev,156156+ exynos_mipi_video_phy_xlate);157157+ if (IS_ERR(phy_provider))158158+ return PTR_ERR(phy_provider);149159150160 return 0;151161}
+5-5
drivers/phy/phy-mvebu-sata.c
···9999 if (IS_ERR(priv->clk))100100 return PTR_ERR(priv->clk);101101102102- phy_provider = devm_of_phy_provider_register(&pdev->dev,103103- of_phy_simple_xlate);104104- if (IS_ERR(phy_provider))105105- return PTR_ERR(phy_provider);106106-107102 phy = devm_phy_create(&pdev->dev, &phy_mvebu_sata_ops, NULL);108103 if (IS_ERR(phy))109104 return PTR_ERR(phy);110105111106 phy_set_drvdata(phy, priv);107107+108108+ phy_provider = devm_of_phy_provider_register(&pdev->dev,109109+ of_phy_simple_xlate);110110+ if (IS_ERR(phy_provider))111111+ return PTR_ERR(phy_provider);112112113113 /* The boot loader may of left it on. Turn it off. */114114 phy_mvebu_sata_power_off(phy);
+5-5
drivers/phy/phy-omap-usb2.c
···177177 phy->phy.otg = otg;178178 phy->phy.type = USB_PHY_TYPE_USB2;179179180180- phy_provider = devm_of_phy_provider_register(phy->dev,181181- of_phy_simple_xlate);182182- if (IS_ERR(phy_provider))183183- return PTR_ERR(phy_provider);184184-185180 control_node = of_parse_phandle(node, "ctrl-module", 0);186181 if (!control_node) {187182 dev_err(&pdev->dev, "Failed to get control device phandle\n");···208213 return PTR_ERR(generic_phy);209214210215 phy_set_drvdata(generic_phy, phy);216216+217217+ phy_provider = devm_of_phy_provider_register(phy->dev,218218+ of_phy_simple_xlate);219219+ if (IS_ERR(phy_provider))220220+ return PTR_ERR(phy_provider);211221212222 phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k");213223 if (IS_ERR(phy->wkupclk)) {
+5-5
drivers/phy/phy-twl4030-usb.c
···695695 otg->set_host = twl4030_set_host;696696 otg->set_peripheral = twl4030_set_peripheral;697697698698- phy_provider = devm_of_phy_provider_register(twl->dev,699699- of_phy_simple_xlate);700700- if (IS_ERR(phy_provider))701701- return PTR_ERR(phy_provider);702702-703698 phy = devm_phy_create(twl->dev, &ops, init_data);704699 if (IS_ERR(phy)) {705700 dev_dbg(&pdev->dev, "Failed to create PHY\n");···702707 }703708704709 phy_set_drvdata(phy, twl);710710+711711+ phy_provider = devm_of_phy_provider_register(twl->dev,712712+ of_phy_simple_xlate);713713+ if (IS_ERR(phy_provider))714714+ return PTR_ERR(phy_provider);705715706716 /* init spinlock for workqueue */707717 spin_lock_init(&twl->lock);
+1-1
drivers/regulator/core.c
···13591359 goto found;13601360 /* Don't log an error when called from regulator_get_optional() */13611361 } else if (!have_full_constraints() || exclusive) {13621362- dev_err(dev, "dummy supplies not allowed\n");13621362+ dev_warn(dev, "dummy supplies not allowed\n");13631363 }1364136413651365 mutex_unlock(®ulator_list_mutex);
···507507 }508508509509 /* Let us be really paranoid for modifications to probing code. */510510- /* extern enum sparc_cpu sparc_cpu_model; */ /* in <asm/system.h> */511510 if (sparc_cpu_model != sun4m) {512511 /* We must be on sun4m because we use MMU Bypass ASI. */513512 return -ENXIO;
···585585 char __user *buf, size_t len, int read)586586{587587 struct ffs_epfile *epfile = file->private_data;588588- struct usb_gadget *gadget = epfile->ffs->gadget;589588 struct ffs_ep *ep;590589 char *data = NULL;591590 ssize_t ret, data_len;···620621621622 /* Allocate & copy */622623 if (!halt) {624624+ /*625625+ * if we _do_ wait above, the epfile->ffs->gadget might be NULL626626+ * before the waiting completes, so do not assign to 'gadget' earlier627627+ */628628+ struct usb_gadget *gadget = epfile->ffs->gadget;629629+623630 /*624631 * Controller may require buffer size to be aligned to625632 * maxpacketsize of an out endpoint.
+1-1
drivers/usb/gadget/printer.c
···1157115711581158 usb_gadget_set_selfpowered(gadget);1159115911601160- if (gadget->is_otg) {11601160+ if (gadget_is_otg(gadget)) {11611161 otg_descriptor.bmAttributes |= USB_OTG_HNP;11621162 printer_cfg_driver.descriptors = otg_desc;11631163 printer_cfg_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
···238238 int port;239239 int mask;240240 int changed;241241+ bool fs_idle_delay;241242242243 ehci_dbg(ehci, "suspend root hub\n");243244···273272 ehci->bus_suspended = 0;274273 ehci->owned_ports = 0;275274 changed = 0;275275+ fs_idle_delay = false;276276 port = HCS_N_PORTS(ehci->hcs_params);277277 while (port--) {278278 u32 __iomem *reg = &ehci->regs->port_status [port];···302300 }303301304302 if (t1 != t2) {303303+ /*304304+ * On some controllers, Wake-On-Disconnect will305305+ * generate false wakeup signals until the bus306306+ * switches over to full-speed idle. For their307307+ * sake, add a delay if we need one.308308+ */309309+ if ((t2 & PORT_WKDISC_E) &&310310+ ehci_port_speed(ehci, t2) ==311311+ USB_PORT_STAT_HIGH_SPEED)312312+ fs_idle_delay = true;305313 ehci_writel(ehci, t2, reg);306314 changed = 1;307315 }308316 }317317+ spin_unlock_irq(&ehci->lock);318318+319319+ if ((changed && ehci->has_tdi_phy_lpm) || fs_idle_delay) {320320+ /*321321+ * Wait for HCD to enter low-power mode or for the bus322322+ * to switch to full-speed idle.323323+ */324324+ usleep_range(5000, 5500);325325+ }309326310327 if (changed && ehci->has_tdi_phy_lpm) {311311- spin_unlock_irq(&ehci->lock);312312- msleep(5); /* 5 ms for HCD to enter low-power mode */313328 spin_lock_irq(&ehci->lock);314314-315329 port = HCS_N_PORTS(ehci->hcs_params);316330 while (port--) {317331 u32 __iomem *hostpc_reg = &ehci->regs->hostpc[port];···340322 port, (t3 & HOSTPC_PHCD) ?341323 "succeeded" : "failed");342324 }325325+ spin_unlock_irq(&ehci->lock);343326 }344344- spin_unlock_irq(&ehci->lock);345327346328 /* Apparently some devices need a >= 1-uframe delay here */347329 if (ehci->bus_suspended)
···11831183 csr = MUSB_CSR0_H_STATUSPKT11841184 | MUSB_CSR0_TXPKTRDY;1185118511861186+ /* disable ping token in status phase */11871187+ csr |= MUSB_CSR0_H_DIS_PING;11881188+11861189 /* flag status stage */11871190 musb->ep0_stage = MUSB_EP0_STATUS;11881191
+19-7
drivers/usb/musb/musb_virthub.c
···135135136136 /* later, GetPortStatus will stop RESUME signaling */137137 musb->port1_status |= MUSB_PORT_STAT_RESUME;138138- schedule_delayed_work(&musb->finish_resume_work, 20);138138+ schedule_delayed_work(&musb->finish_resume_work,139139+ msecs_to_jiffies(20));139140 }140141}141142···159158 */160159 power = musb_readb(mbase, MUSB_POWER);161160 if (do_reset) {162162-163161 /*164162 * If RESUME is set, we must make sure it stays minimum 20 ms.165163 * Then we must clear RESUME and wait a bit to let musb start···167167 * detected".168168 */169169 if (power & MUSB_POWER_RESUME) {170170- while (time_before(jiffies, musb->rh_timer))171171- msleep(1);170170+ long remain = (unsigned long) musb->rh_timer - jiffies;171171+172172+ if (musb->rh_timer > 0 && remain > 0) {173173+ /* take into account the minimum delay after resume */174174+ schedule_delayed_work(175175+ &musb->deassert_reset_work, remain);176176+ return;177177+ }178178+172179 musb_writeb(mbase, MUSB_POWER,173173- power & ~MUSB_POWER_RESUME);174174- msleep(1);180180+ power & ~MUSB_POWER_RESUME);181181+182182+ /* Give the core 1 ms to clear MUSB_POWER_RESUME */183183+ schedule_delayed_work(&musb->deassert_reset_work,184184+ msecs_to_jiffies(1));185185+ return;175186 }176187177188 power &= 0xf0;···191180192181 musb->port1_status |= USB_PORT_STAT_RESET;193182 musb->port1_status &= ~USB_PORT_STAT_ENABLE;194194- schedule_delayed_work(&musb->deassert_reset_work, 50);183183+ schedule_delayed_work(&musb->deassert_reset_work,184184+ msecs_to_jiffies(50));195185 } else {196186 dev_dbg(musb->controller, "root port reset stopped\n");197187 musb_writeb(mbase, MUSB_POWER,
···7070};71717272struct vhost_net_ubuf_ref {7373- struct kref kref;7373+ /* refcount follows semantics similar to kref:7474+ * 0: object is released7575+ * 1: no outstanding ubufs7676+ * >1: outstanding ubufs7777+ */7878+ atomic_t refcount;7479 wait_queue_head_t wait;7580 struct vhost_virtqueue *vq;7681};···121116 vhost_net_zcopy_mask |= 0x1 << vq;122117}123118124124-static void vhost_net_zerocopy_done_signal(struct kref *kref)125125-{126126- struct vhost_net_ubuf_ref *ubufs;127127-128128- ubufs = container_of(kref, struct vhost_net_ubuf_ref, kref);129129- wake_up(&ubufs->wait);130130-}131131-132119static struct vhost_net_ubuf_ref *133120vhost_net_ubuf_alloc(struct vhost_virtqueue *vq, bool zcopy)134121{···131134 ubufs = kmalloc(sizeof(*ubufs), GFP_KERNEL);132135 if (!ubufs)133136 return ERR_PTR(-ENOMEM);134134- kref_init(&ubufs->kref);137137+ atomic_set(&ubufs->refcount, 1);135138 init_waitqueue_head(&ubufs->wait);136139 ubufs->vq = vq;137140 return ubufs;138141}139142140140-static void vhost_net_ubuf_put(struct vhost_net_ubuf_ref *ubufs)143143+static int vhost_net_ubuf_put(struct vhost_net_ubuf_ref *ubufs)141144{142142- kref_put(&ubufs->kref, vhost_net_zerocopy_done_signal);145145+ int r = atomic_sub_return(1, &ubufs->refcount);146146+ if (unlikely(!r))147147+ wake_up(&ubufs->wait);148148+ return r;143149}144150145151static void vhost_net_ubuf_put_and_wait(struct vhost_net_ubuf_ref *ubufs)146152{147147- kref_put(&ubufs->kref, vhost_net_zerocopy_done_signal);148148- wait_event(ubufs->wait, !atomic_read(&ubufs->kref.refcount));153153+ vhost_net_ubuf_put(ubufs);154154+ wait_event(ubufs->wait, !atomic_read(&ubufs->refcount));149155}150156151157static void vhost_net_ubuf_put_wait_and_free(struct vhost_net_ubuf_ref *ubufs)···306306{307307 struct vhost_net_ubuf_ref *ubufs = ubuf->ctx;308308 struct vhost_virtqueue *vq = ubufs->vq;309309- int cnt = atomic_read(&ubufs->kref.refcount);309309+ int cnt;310310+311311+ rcu_read_lock_bh();310312311313 /* set len to mark this desc buffers done DMA */312314 vq->heads[ubuf->desc].len = success ?313315 VHOST_DMA_DONE_LEN : VHOST_DMA_FAILED_LEN;314314- vhost_net_ubuf_put(ubufs);316316+ cnt = vhost_net_ubuf_put(ubufs);315317316318 /*317319 * Trigger polling thread if guest stopped submitting new buffers:318318- * in this case, the refcount after decrement will eventually reach 1319319- * so here it is 2.320320+ * in this case, the refcount after decrement will eventually reach 1.320321 * We also trigger polling periodically after each 16 packets321322 * (the value 16 here is more or less arbitrary, it's tuned to trigger322323 * less than 10% of times).323324 */324324- if (cnt <= 2 || !(cnt % 16))325325+ if (cnt <= 1 || !(cnt % 16))325326 vhost_poll_queue(&vq->poll);327327+328328+ rcu_read_unlock_bh();326329}327330328331/* Expects to be always run from workqueue - which acts as···423420 msg.msg_control = ubuf;424421 msg.msg_controllen = sizeof(ubuf);425422 ubufs = nvq->ubufs;426426- kref_get(&ubufs->kref);423423+ atomic_inc(&ubufs->refcount);427424 nvq->upend_idx = (nvq->upend_idx + 1) % UIO_MAXIOV;428425 } else {429426 msg.msg_control = NULL;···783780 vhost_net_ubuf_put_and_wait(n->vqs[VHOST_NET_VQ_TX].ubufs);784781 mutex_lock(&n->vqs[VHOST_NET_VQ_TX].vq.mutex);785782 n->tx_flush = false;786786- kref_init(&n->vqs[VHOST_NET_VQ_TX].ubufs->kref);783783+ atomic_set(&n->vqs[VHOST_NET_VQ_TX].ubufs->refcount, 1);787784 mutex_unlock(&n->vqs[VHOST_NET_VQ_TX].vq.mutex);788785 }789786}···803800 fput(tx_sock->file);804801 if (rx_sock)805802 fput(rx_sock->file);803803+ /* Make sure no callbacks are outstanding */804804+ synchronize_rcu_bh();806805 /* We do an extra flush before freeing memory,807806 * since jobs can re-queue themselves. */808807 vhost_net_flush(n);
···244244 xid);245245 else246246 rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb,247247- xid, &fid->netfid);247247+ xid, fid);248248249249out:250250 kfree(buf);···23892389 unsigned long nr_segs, loff_t *poffset)23902390{23912391 unsigned long nr_pages, i;23922392- size_t copied, len, cur_len;23922392+ size_t bytes, copied, len, cur_len;23932393 ssize_t total_written = 0;23942394 loff_t offset;23952395 struct iov_iter it;···2444244424452445 save_len = cur_len;24462446 for (i = 0; i < nr_pages; i++) {24472447- copied = min_t(const size_t, cur_len, PAGE_SIZE);24472447+ bytes = min_t(const size_t, cur_len, PAGE_SIZE);24482448 copied = iov_iter_copy_from_user(wdata->pages[i], &it,24492449- 0, copied);24492449+ 0, bytes);24502450 cur_len -= copied;24512451 iov_iter_advance(&it, copied);24522452+ /*24532453+ * If we didn't copy as much as we expected, then that24542454+ * may mean we trod into an unmapped area. Stop copying24552455+ * at that point. On the next pass through the big24562456+ * loop, we'll likely end up getting a zero-length24572457+ * write and bailing out of it.24582458+ */24592459+ if (copied < bytes)24602460+ break;24522461 }24532462 cur_len = save_len - cur_len;24632463+24642464+ /*24652465+ * If we have no data to send, then that probably means that24662466+ * the copy above failed altogether. That's most likely because24672467+ * the address in the iovec was bogus. Set the rc to -EFAULT,24682468+ * free anything we allocated and bail out.24692469+ */24702470+ if (!cur_len) {24712471+ for (i = 0; i < nr_pages; i++)24722472+ put_page(wdata->pages[i]);24732473+ kfree(wdata);24742474+ rc = -EFAULT;24752475+ break;24762476+ }24772477+24782478+ /*24792479+ * i + 1 now represents the number of pages we actually used in24802480+ * the copy phase above. Bring nr_pages down to that, and free24812481+ * any pages that we didn't use.24822482+ */24832483+ for ( ; nr_pages > i + 1; nr_pages--)24842484+ put_page(wdata->pages[nr_pages - 1]);2454248524552486 wdata->sync_mode = WB_SYNC_ALL;24562487 wdata->nr_pages = nr_pages;
···5757#define SMB2_CMACAES_SIZE (16)5858#define SMB3_SIGNKEY_SIZE (16)59596060+/* Maximum buffer size value we can send with 1 credit */6161+#define SMB2_MAX_BUFFER_SIZE 655366262+6063#endif /* _SMB2_GLOB_H */
+4-10
fs/cifs/smb2ops.c
···182182 /* start with specified wsize, or default */183183 wsize = volume_info->wsize ? volume_info->wsize : CIFS_DEFAULT_IOSIZE;184184 wsize = min_t(unsigned int, wsize, server->max_write);185185- /*186186- * limit write size to 2 ** 16, because we don't support multicredit187187- * requests now.188188- */189189- wsize = min_t(unsigned int, wsize, 2 << 15);185185+ /* set it to the maximum buffer size value we can send with 1 credit */186186+ wsize = min_t(unsigned int, wsize, SMB2_MAX_BUFFER_SIZE);190187191188 return wsize;192189}···197200 /* start with specified rsize, or default */198201 rsize = volume_info->rsize ? volume_info->rsize : CIFS_DEFAULT_IOSIZE;199202 rsize = min_t(unsigned int, rsize, server->max_read);200200- /*201201- * limit write size to 2 ** 16, because we don't support multicredit202202- * requests now.203203- */204204- rsize = min_t(unsigned int, rsize, 2 << 15);203203+ /* set it to the maximum buffer size value we can send with 1 credit */204204+ rsize = min_t(unsigned int, rsize, SMB2_MAX_BUFFER_SIZE);205205206206 return rsize;207207}
+3-1
fs/cifs/smb2pdu.c
···413413414414 /* SMB2 only has an extended negflavor */415415 server->negflavor = CIFS_NEGFLAVOR_EXTENDED;416416- server->maxBuf = le32_to_cpu(rsp->MaxTransactSize);416416+ /* set it to the maximum buffer size value we can send with 1 credit */417417+ server->maxBuf = min_t(unsigned int, le32_to_cpu(rsp->MaxTransactSize),418418+ SMB2_MAX_BUFFER_SIZE);417419 server->max_read = le32_to_cpu(rsp->MaxReadSize);418420 server->max_write = le32_to_cpu(rsp->MaxWriteSize);419421 /* BB Do we need to validate the SecurityMode? */
···10151015 if (ret == -EIO)10161016 /* A lost lock - don't even consider delegations */10171017 goto out;10181018- if (nfs4_copy_delegation_stateid(dst, state->inode, fmode))10181018+ /* returns true if delegation stateid found and copied */10191019+ if (nfs4_copy_delegation_stateid(dst, state->inode, fmode)) {10201020+ ret = 0;10191021 goto out;10221022+ }10201023 if (ret != -ENOENT)10211024 /* nfs4_copy_delegation_stateid() didn't over-write10221025 * dst, so it still has the lock stateid which we now
+190-695
fs/reiserfs/do_balan.c
···324324 switch (flag) {325325 case M_INSERT: /* insert item into L[0] */326326327327- if (item_pos == tb->lnum[0] - 1328328- && tb->lbytes != -1) {327327+ if (item_pos == tb->lnum[0] - 1 && tb->lbytes != -1) {329328 /* part of new item falls into L[0] */330329 int new_item_len;331330 int version;332331333333- ret_val =334334- leaf_shift_left(tb, tb->lnum[0] - 1,335335- -1);332332+ ret_val = leaf_shift_left(tb, tb->lnum[0] - 1, -1);336333337334 /* Calculate item length to insert to S[0] */338338- new_item_len =339339- ih_item_len(ih) - tb->lbytes;335335+ new_item_len = ih_item_len(ih) - tb->lbytes;340336 /* Calculate and check item length to insert to L[0] */341341- put_ih_item_len(ih,342342- ih_item_len(ih) -343343- new_item_len);337337+ put_ih_item_len(ih, ih_item_len(ih) - new_item_len);344338345339 RFALSE(ih_item_len(ih) <= 0,346340 "PAP-12080: there is nothing to insert into L[0]: ih_item_len=%d",···343349 /* Insert new item into L[0] */344350 buffer_info_init_left(tb, &bi);345351 leaf_insert_into_buf(&bi,346346- n + item_pos -347347- ret_val, ih, body,348348- zeros_num >349349- ih_item_len(ih) ?350350- ih_item_len(ih) :351351- zeros_num);352352+ n + item_pos - ret_val, ih, body,353353+ zeros_num > ih_item_len(ih) ? ih_item_len(ih) : zeros_num);352354353355 version = ih_version(ih);354356355357 /* Calculate key component, item length and body to insert into S[0] */356356- set_le_ih_k_offset(ih,357357- le_ih_k_offset(ih) +358358- (tb->359359- lbytes <<360360- (is_indirect_le_ih361361- (ih) ? tb->tb_sb->362362- s_blocksize_bits -363363- UNFM_P_SHIFT :364364- 0)));358358+ set_le_ih_k_offset(ih, le_ih_k_offset(ih) +359359+ (tb-> lbytes << (is_indirect_le_ih(ih) ? tb->tb_sb-> s_blocksize_bits - UNFM_P_SHIFT : 0)));365360366361 put_ih_item_len(ih, new_item_len);367362 if (tb->lbytes > zeros_num) {368368- body +=369369- (tb->lbytes - zeros_num);363363+ body += (tb->lbytes - zeros_num);370364 zeros_num = 0;371365 } else372366 zeros_num -= tb->lbytes;···365383 } else {366384 /* new item in whole falls into L[0] */367385 /* Shift lnum[0]-1 items to L[0] */368368- ret_val =369369- leaf_shift_left(tb, tb->lnum[0] - 1,370370- tb->lbytes);386386+ ret_val = leaf_shift_left(tb, tb->lnum[0] - 1, tb->lbytes);371387 /* Insert new item into L[0] */372388 buffer_info_init_left(tb, &bi);373373- leaf_insert_into_buf(&bi,374374- n + item_pos -375375- ret_val, ih, body,376376- zeros_num);389389+ leaf_insert_into_buf(&bi, n + item_pos - ret_val, ih, body, zeros_num);377390 tb->insert_size[0] = 0;378391 zeros_num = 0;379392 }···376399377400 case M_PASTE: /* append item in L[0] */378401379379- if (item_pos == tb->lnum[0] - 1380380- && tb->lbytes != -1) {402402+ if (item_pos == tb->lnum[0] - 1 && tb->lbytes != -1) {381403 /* we must shift the part of the appended item */382382- if (is_direntry_le_ih383383- (B_N_PITEM_HEAD(tbS0, item_pos))) {404404+ if (is_direntry_le_ih(B_N_PITEM_HEAD(tbS0, item_pos))) {384405385406 RFALSE(zeros_num,386407 "PAP-12090: invalid parameter in case of a directory");387408 /* directory item */388409 if (tb->lbytes > pos_in_item) {389410 /* new directory entry falls into L[0] */390390- struct item_head391391- *pasted;392392- int l_pos_in_item =393393- pos_in_item;411411+ struct item_head *pasted;412412+ int l_pos_in_item = pos_in_item;394413395414 /* Shift lnum[0] - 1 items in whole. Shift lbytes - 1 entries from given directory item */396396- ret_val =397397- leaf_shift_left(tb,398398- tb->399399- lnum400400- [0],401401- tb->402402- lbytes403403- -404404- 1);405405- if (ret_val406406- && !item_pos) {407407- pasted =408408- B_N_PITEM_HEAD409409- (tb->L[0],410410- B_NR_ITEMS411411- (tb->412412- L[0]) -413413- 1);414414- l_pos_in_item +=415415- I_ENTRY_COUNT416416- (pasted) -417417- (tb->418418- lbytes -419419- 1);415415+ ret_val = leaf_shift_left(tb, tb->lnum[0], tb->lbytes-1);416416+ if (ret_val && !item_pos) {417417+ pasted = B_N_PITEM_HEAD(tb->L[0], B_NR_ITEMS(tb->L[0]) - 1);418418+ l_pos_in_item += I_ENTRY_COUNT(pasted) - (tb->lbytes -1);420419 }421420422421 /* Append given directory entry to directory item */423422 buffer_info_init_left(tb, &bi);424424- leaf_paste_in_buffer425425- (&bi,426426- n + item_pos -427427- ret_val,428428- l_pos_in_item,429429- tb->insert_size[0],430430- body, zeros_num);423423+ leaf_paste_in_buffer(&bi, n + item_pos - ret_val, l_pos_in_item, tb->insert_size[0], body, zeros_num);431424432425 /* previous string prepared space for pasting new entry, following string pastes this entry */433426434427 /* when we have merge directory item, pos_in_item has been changed too */435428436429 /* paste new directory entry. 1 is entry number */437437- leaf_paste_entries(&bi,438438- n +439439- item_pos440440- -441441- ret_val,442442- l_pos_in_item,443443- 1,444444- (struct445445- reiserfs_de_head446446- *)447447- body,448448- body449449- +450450- DEH_SIZE,451451- tb->452452- insert_size453453- [0]454454- );430430+ leaf_paste_entries(&bi, n + item_pos - ret_val, l_pos_in_item,431431+ 1, (struct reiserfs_de_head *) body,432432+ body + DEH_SIZE, tb->insert_size[0]);455433 tb->insert_size[0] = 0;456434 } else {457435 /* new directory item doesn't fall into L[0] */458436 /* Shift lnum[0]-1 items in whole. Shift lbytes directory entries from directory item number lnum[0] */459459- leaf_shift_left(tb,460460- tb->461461- lnum[0],462462- tb->463463- lbytes);437437+ leaf_shift_left(tb, tb->lnum[0], tb->lbytes);464438 }465439 /* Calculate new position to append in item body */466440 pos_in_item -= tb->lbytes;467441 } else {468442 /* regular object */469469- RFALSE(tb->lbytes <= 0,470470- "PAP-12095: there is nothing to shift to L[0]. lbytes=%d",471471- tb->lbytes);472472- RFALSE(pos_in_item !=473473- ih_item_len474474- (B_N_PITEM_HEAD475475- (tbS0, item_pos)),443443+ RFALSE(tb->lbytes <= 0, "PAP-12095: there is nothing to shift to L[0]. lbytes=%d", tb->lbytes);444444+ RFALSE(pos_in_item != ih_item_len(B_N_PITEM_HEAD(tbS0, item_pos)),476445 "PAP-12100: incorrect position to paste: item_len=%d, pos_in_item=%d",477477- ih_item_len478478- (B_N_PITEM_HEAD479479- (tbS0, item_pos)),480480- pos_in_item);446446+ ih_item_len(B_N_PITEM_HEAD(tbS0, item_pos)),pos_in_item);481447482448 if (tb->lbytes >= pos_in_item) {483449 /* appended item will be in L[0] in whole */484450 int l_n;485451486452 /* this bytes number must be appended to the last item of L[h] */487487- l_n =488488- tb->lbytes -489489- pos_in_item;453453+ l_n = tb->lbytes - pos_in_item;490454491455 /* Calculate new insert_size[0] */492492- tb->insert_size[0] -=493493- l_n;456456+ tb->insert_size[0] -= l_n;494457495495- RFALSE(tb->496496- insert_size[0] <=497497- 0,458458+ RFALSE(tb->insert_size[0] <= 0,498459 "PAP-12105: there is nothing to paste into L[0]. insert_size=%d",499499- tb->500500- insert_size[0]);501501- ret_val =502502- leaf_shift_left(tb,503503- tb->504504- lnum505505- [0],506506- ih_item_len507507- (B_N_PITEM_HEAD508508- (tbS0,509509- item_pos)));460460+ tb->insert_size[0]);461461+ ret_val = leaf_shift_left(tb, tb->lnum[0], ih_item_len462462+ (B_N_PITEM_HEAD(tbS0, item_pos)));510463 /* Append to body of item in L[0] */511464 buffer_info_init_left(tb, &bi);512465 leaf_paste_in_buffer513513- (&bi,514514- n + item_pos -515515- ret_val,516516- ih_item_len517517- (B_N_PITEM_HEAD518518- (tb->L[0],519519- n + item_pos -520520- ret_val)), l_n,521521- body,522522- zeros_num >523523- l_n ? l_n :524524- zeros_num);466466+ (&bi, n + item_pos - ret_val, ih_item_len467467+ (B_N_PITEM_HEAD(tb->L[0], n + item_pos - ret_val)),468468+ l_n, body,469469+ zeros_num > l_n ? l_n : zeros_num);525470 /* 0-th item in S0 can be only of DIRECT type when l_n != 0 */526471 {527472 int version;528528- int temp_l =529529- l_n;473473+ int temp_l = l_n;530474531531- RFALSE532532- (ih_item_len533533- (B_N_PITEM_HEAD534534- (tbS0,535535- 0)),475475+ RFALSE(ih_item_len(B_N_PITEM_HEAD(tbS0, 0)),536476 "PAP-12106: item length must be 0");537537- RFALSE538538- (comp_short_le_keys539539- (B_N_PKEY540540- (tbS0, 0),541541- B_N_PKEY542542- (tb->L[0],543543- n +544544- item_pos545545- -546546- ret_val)),477477+ RFALSE(comp_short_le_keys(B_N_PKEY(tbS0, 0), B_N_PKEY478478+ (tb->L[0], n + item_pos - ret_val)),547479 "PAP-12107: items must be of the same file");548480 if (is_indirect_le_ih(B_N_PITEM_HEAD(tb->L[0], n + item_pos - ret_val))) {549549- temp_l =550550- l_n551551- <<552552- (tb->553553- tb_sb->554554- s_blocksize_bits555555- -556556- UNFM_P_SHIFT);481481+ temp_l = l_n << (tb->tb_sb-> s_blocksize_bits - UNFM_P_SHIFT);557482 }558483 /* update key of first item in S0 */559559- version =560560- ih_version561561- (B_N_PITEM_HEAD562562- (tbS0, 0));563563- set_le_key_k_offset564564- (version,565565- B_N_PKEY566566- (tbS0, 0),567567- le_key_k_offset568568- (version,569569- B_N_PKEY570570- (tbS0,571571- 0)) +572572- temp_l);484484+ version = ih_version(B_N_PITEM_HEAD(tbS0, 0));485485+ set_le_key_k_offset(version, B_N_PKEY(tbS0, 0),486486+ le_key_k_offset(version,B_N_PKEY(tbS0, 0)) + temp_l);573487 /* update left delimiting key */574574- set_le_key_k_offset575575- (version,576576- B_N_PDELIM_KEY577577- (tb->578578- CFL[0],579579- tb->580580- lkey[0]),581581- le_key_k_offset582582- (version,583583- B_N_PDELIM_KEY584584- (tb->585585- CFL[0],586586- tb->587587- lkey[0]))588588- + temp_l);488488+ set_le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]),489489+ le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0])) + temp_l);589490 }590491591492 /* Calculate new body, position in item and insert_size[0] */592493 if (l_n > zeros_num) {593593- body +=594594- (l_n -595595- zeros_num);494494+ body += (l_n - zeros_num);596495 zeros_num = 0;597496 } else598598- zeros_num -=599599- l_n;497497+ zeros_num -= l_n;600498 pos_in_item = 0;601499602602- RFALSE603603- (comp_short_le_keys604604- (B_N_PKEY(tbS0, 0),605605- B_N_PKEY(tb->L[0],606606- B_NR_ITEMS607607- (tb->608608- L[0]) -609609- 1))610610- ||611611- !op_is_left_mergeable612612- (B_N_PKEY(tbS0, 0),613613- tbS0->b_size)614614- ||615615- !op_is_left_mergeable616616- (B_N_PDELIM_KEY617617- (tb->CFL[0],618618- tb->lkey[0]),619619- tbS0->b_size),500500+ RFALSE(comp_short_le_keys(B_N_PKEY(tbS0, 0), B_N_PKEY(tb->L[0], B_NR_ITEMS(tb->L[0]) - 1))501501+ || !op_is_left_mergeable(B_N_PKEY(tbS0, 0), tbS0->b_size)502502+ || !op_is_left_mergeable(B_N_PDELIM_KEY(tb->CFL[0], tb->lkey[0]), tbS0->b_size),620503 "PAP-12120: item must be merge-able with left neighboring item");621504 } else { /* only part of the appended item will be in L[0] */622505623506 /* Calculate position in item for append in S[0] */624624- pos_in_item -=625625- tb->lbytes;507507+ pos_in_item -= tb->lbytes;626508627627- RFALSE(pos_in_item <= 0,628628- "PAP-12125: no place for paste. pos_in_item=%d",629629- pos_in_item);509509+ RFALSE(pos_in_item <= 0, "PAP-12125: no place for paste. pos_in_item=%d", pos_in_item);630510631511 /* Shift lnum[0] - 1 items in whole. Shift lbytes - 1 byte from item number lnum[0] */632632- leaf_shift_left(tb,633633- tb->634634- lnum[0],635635- tb->636636- lbytes);512512+ leaf_shift_left(tb, tb->lnum[0], tb->lbytes);637513 }638514 }639515 } else { /* appended item will be in L[0] in whole */···495665496666 if (!item_pos && op_is_left_mergeable(B_N_PKEY(tbS0, 0), tbS0->b_size)) { /* if we paste into first item of S[0] and it is left mergable */497667 /* then increment pos_in_item by the size of the last item in L[0] */498498- pasted =499499- B_N_PITEM_HEAD(tb->L[0],500500- n - 1);668668+ pasted = B_N_PITEM_HEAD(tb->L[0], n - 1);501669 if (is_direntry_le_ih(pasted))502502- pos_in_item +=503503- ih_entry_count504504- (pasted);670670+ pos_in_item += ih_entry_count(pasted);505671 else506506- pos_in_item +=507507- ih_item_len(pasted);672672+ pos_in_item += ih_item_len(pasted);508673 }509674510675 /* Shift lnum[0] - 1 items in whole. Shift lbytes - 1 byte from item number lnum[0] */511511- ret_val =512512- leaf_shift_left(tb, tb->lnum[0],513513- tb->lbytes);676676+ ret_val = leaf_shift_left(tb, tb->lnum[0], tb->lbytes);514677 /* Append to body of item in L[0] */515678 buffer_info_init_left(tb, &bi);516516- leaf_paste_in_buffer(&bi,517517- n + item_pos -518518- ret_val,679679+ leaf_paste_in_buffer(&bi, n + item_pos - ret_val,519680 pos_in_item,520681 tb->insert_size[0],521682 body, zeros_num);522683523684 /* if appended item is directory, paste entry */524524- pasted =525525- B_N_PITEM_HEAD(tb->L[0],526526- n + item_pos -527527- ret_val);685685+ pasted = B_N_PITEM_HEAD(tb->L[0], n + item_pos - ret_val);528686 if (is_direntry_le_ih(pasted))529529- leaf_paste_entries(&bi,530530- n +531531- item_pos -532532- ret_val,533533- pos_in_item,534534- 1,535535- (struct536536- reiserfs_de_head537537- *)body,538538- body +539539- DEH_SIZE,540540- tb->541541- insert_size542542- [0]543543- );687687+ leaf_paste_entries(&bi, n + item_pos - ret_val,688688+ pos_in_item, 1,689689+ (struct reiserfs_de_head *) body,690690+ body + DEH_SIZE,691691+ tb->insert_size[0]);544692 /* if appended item is indirect item, put unformatted node into un list */545693 if (is_indirect_le_ih(pasted))546694 set_ih_free_space(pasted, 0);···530722 reiserfs_panic(tb->tb_sb, "PAP-12130",531723 "lnum > 0: unexpected mode: "532724 " %s(%d)",533533- (flag ==534534- M_DELETE) ? "DELETE" : ((flag ==535535- M_CUT)536536- ? "CUT"537537- :538538- "UNKNOWN"),539539- flag);725725+ (flag == M_DELETE) ? "DELETE" : ((flag == M_CUT) ? "CUT" : "UNKNOWN"), flag);540726 }541727 } else {542728 /* new item doesn't fall into L[0] */···550748 case M_INSERT: /* insert item */551749 if (n - tb->rnum[0] < item_pos) { /* new item or its part falls to R[0] */552750 if (item_pos == n - tb->rnum[0] + 1 && tb->rbytes != -1) { /* part of new item falls into R[0] */553553- loff_t old_key_comp, old_len,554554- r_zeros_number;751751+ loff_t old_key_comp, old_len, r_zeros_number;555752 const char *r_body;556753 int version;557754 loff_t offset;558755559559- leaf_shift_right(tb, tb->rnum[0] - 1,560560- -1);756756+ leaf_shift_right(tb, tb->rnum[0] - 1, -1);561757562758 version = ih_version(ih);563759 /* Remember key component and item length */···563763 old_len = ih_item_len(ih);564764565765 /* Calculate key component and item length to insert into R[0] */566566- offset =567567- le_ih_k_offset(ih) +568568- ((old_len -569569- tb->570570- rbytes) << (is_indirect_le_ih(ih)571571- ? tb->tb_sb->572572- s_blocksize_bits -573573- UNFM_P_SHIFT : 0));766766+ offset = le_ih_k_offset(ih) + ((old_len - tb->rbytes) << (is_indirect_le_ih(ih) ? tb->tb_sb->s_blocksize_bits - UNFM_P_SHIFT : 0));574767 set_le_ih_k_offset(ih, offset);575768 put_ih_item_len(ih, tb->rbytes);576769 /* Insert part of the item into R[0] */577770 buffer_info_init_right(tb, &bi);578771 if ((old_len - tb->rbytes) > zeros_num) {579772 r_zeros_number = 0;580580- r_body =581581- body + (old_len -582582- tb->rbytes) -583583- zeros_num;773773+ r_body = body + (old_len - tb->rbytes) - zeros_num;584774 } else {585775 r_body = body;586586- r_zeros_number =587587- zeros_num - (old_len -588588- tb->rbytes);776776+ r_zeros_number = zeros_num - (old_len - tb->rbytes);589777 zeros_num -= r_zeros_number;590778 }591779···586798587799 /* Calculate key component and item length to insert into S[0] */588800 set_le_ih_k_offset(ih, old_key_comp);589589- put_ih_item_len(ih,590590- old_len - tb->rbytes);801801+ put_ih_item_len(ih, old_len - tb->rbytes);591802592803 tb->insert_size[0] -= tb->rbytes;593804594805 } else { /* whole new item falls into R[0] */595806596807 /* Shift rnum[0]-1 items to R[0] */597597- ret_val =598598- leaf_shift_right(tb,599599- tb->rnum[0] - 1,600600- tb->rbytes);808808+ ret_val = leaf_shift_right(tb, tb->rnum[0] - 1, tb->rbytes);601809 /* Insert new item into R[0] */602810 buffer_info_init_right(tb, &bi);603603- leaf_insert_into_buf(&bi,604604- item_pos - n +605605- tb->rnum[0] - 1,606606- ih, body,607607- zeros_num);811811+ leaf_insert_into_buf(&bi, item_pos - n + tb->rnum[0] - 1,812812+ ih, body, zeros_num);608813609814 if (item_pos - n + tb->rnum[0] - 1 == 0) {610815 replace_key(tb, tb->CFR[0],···622841623842 RFALSE(zeros_num,624843 "PAP-12145: invalid parameter in case of a directory");625625- entry_count =626626- I_ENTRY_COUNT(B_N_PITEM_HEAD627627- (tbS0,628628- item_pos));844844+ entry_count = I_ENTRY_COUNT(B_N_PITEM_HEAD845845+ (tbS0, item_pos));629846 if (entry_count - tb->rbytes <630847 pos_in_item)631848 /* new directory entry falls into R[0] */632849 {633850 int paste_entry_position;634851635635- RFALSE(tb->rbytes - 1 >=636636- entry_count637637- || !tb->638638- insert_size[0],852852+ RFALSE(tb->rbytes - 1 >= entry_count || !tb-> insert_size[0],639853 "PAP-12150: no enough of entries to shift to R[0]: rbytes=%d, entry_count=%d",640640- tb->rbytes,641641- entry_count);854854+ tb->rbytes, entry_count);642855 /* Shift rnum[0]-1 items in whole. Shift rbytes-1 directory entries from directory item number rnum[0] */643643- leaf_shift_right(tb,644644- tb->645645- rnum646646- [0],647647- tb->648648- rbytes649649- - 1);856856+ leaf_shift_right(tb, tb->rnum[0], tb->rbytes - 1);650857 /* Paste given directory entry to directory item */651651- paste_entry_position =652652- pos_in_item -653653- entry_count +654654- tb->rbytes - 1;858858+ paste_entry_position = pos_in_item - entry_count + tb->rbytes - 1;655859 buffer_info_init_right(tb, &bi);656656- leaf_paste_in_buffer657657- (&bi, 0,658658- paste_entry_position,659659- tb->insert_size[0],660660- body, zeros_num);860860+ leaf_paste_in_buffer(&bi, 0, paste_entry_position, tb->insert_size[0], body, zeros_num);661861 /* paste entry */662662- leaf_paste_entries(&bi,663663- 0,664664- paste_entry_position,665665- 1,666666- (struct667667- reiserfs_de_head668668- *)669669- body,670670- body671671- +672672- DEH_SIZE,673673- tb->674674- insert_size675675- [0]676676- );862862+ leaf_paste_entries(&bi, 0, paste_entry_position, 1,863863+ (struct reiserfs_de_head *) body,864864+ body + DEH_SIZE, tb->insert_size[0]);677865678678- if (paste_entry_position679679- == 0) {866866+ if (paste_entry_position == 0) {680867 /* change delimiting keys */681681- replace_key(tb,682682- tb->683683- CFR684684- [0],685685- tb->686686- rkey687687- [0],688688- tb->689689- R690690- [0],691691- 0);868868+ replace_key(tb, tb->CFR[0], tb->rkey[0], tb->R[0],0);692869 }693870694871 tb->insert_size[0] = 0;695872 pos_in_item++;696873 } else { /* new directory entry doesn't fall into R[0] */697874698698- leaf_shift_right(tb,699699- tb->700700- rnum701701- [0],702702- tb->703703- rbytes);875875+ leaf_shift_right(tb, tb->rnum[0], tb->rbytes);704876 }705877 } else { /* regular object */706878707707- int n_shift, n_rem,708708- r_zeros_number;879879+ int n_shift, n_rem, r_zeros_number;709880 const char *r_body;710881711882 /* Calculate number of bytes which must be shifted from appended item */712712- if ((n_shift =713713- tb->rbytes -714714- tb->insert_size[0]) < 0)883883+ if ((n_shift = tb->rbytes - tb->insert_size[0]) < 0)715884 n_shift = 0;716885717717- RFALSE(pos_in_item !=718718- ih_item_len719719- (B_N_PITEM_HEAD720720- (tbS0, item_pos)),886886+ RFALSE(pos_in_item != ih_item_len887887+ (B_N_PITEM_HEAD(tbS0, item_pos)),721888 "PAP-12155: invalid position to paste. ih_item_len=%d, pos_in_item=%d",722722- pos_in_item,723723- ih_item_len724724- (B_N_PITEM_HEAD725725- (tbS0, item_pos)));889889+ pos_in_item, ih_item_len890890+ (B_N_PITEM_HEAD(tbS0, item_pos)));726891727727- leaf_shift_right(tb,728728- tb->rnum[0],729729- n_shift);892892+ leaf_shift_right(tb, tb->rnum[0], n_shift);730893 /* Calculate number of bytes which must remain in body after appending to R[0] */731731- if ((n_rem =732732- tb->insert_size[0] -733733- tb->rbytes) < 0)894894+ if ((n_rem = tb->insert_size[0] - tb->rbytes) < 0)734895 n_rem = 0;735896736897 {737898 int version;738738- unsigned long temp_rem =739739- n_rem;899899+ unsigned long temp_rem = n_rem;740900741741- version =742742- ih_version743743- (B_N_PITEM_HEAD744744- (tb->R[0], 0));745745- if (is_indirect_le_key746746- (version,747747- B_N_PKEY(tb->R[0],748748- 0))) {749749- temp_rem =750750- n_rem <<751751- (tb->tb_sb->752752- s_blocksize_bits753753- -754754- UNFM_P_SHIFT);901901+ version = ih_version(B_N_PITEM_HEAD(tb->R[0], 0));902902+ if (is_indirect_le_key(version, B_N_PKEY(tb->R[0], 0))) {903903+ temp_rem = n_rem << (tb->tb_sb->s_blocksize_bits - UNFM_P_SHIFT);755904 }756756- set_le_key_k_offset757757- (version,758758- B_N_PKEY(tb->R[0],759759- 0),760760- le_key_k_offset761761- (version,762762- B_N_PKEY(tb->R[0],763763- 0)) +764764- temp_rem);765765- set_le_key_k_offset766766- (version,767767- B_N_PDELIM_KEY(tb->768768- CFR769769- [0],770770- tb->771771- rkey772772- [0]),773773- le_key_k_offset774774- (version,775775- B_N_PDELIM_KEY776776- (tb->CFR[0],777777- tb->rkey[0])) +778778- temp_rem);905905+ set_le_key_k_offset(version, B_N_PKEY(tb->R[0], 0),906906+ le_key_k_offset(version, B_N_PKEY(tb->R[0], 0)) + temp_rem);907907+ set_le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0]),908908+ le_key_k_offset(version, B_N_PDELIM_KEY(tb->CFR[0], tb->rkey[0])) + temp_rem);779909 }780910/* k_offset (B_N_PKEY(tb->R[0],0)) += n_rem;781911 k_offset (B_N_PDELIM_KEY(tb->CFR[0],tb->rkey[0])) += n_rem;*/782782- do_balance_mark_internal_dirty783783- (tb, tb->CFR[0], 0);912912+ do_balance_mark_internal_dirty(tb, tb->CFR[0], 0);784913785914 /* Append part of body into R[0] */786915 buffer_info_init_right(tb, &bi);787916 if (n_rem > zeros_num) {788917 r_zeros_number = 0;789789- r_body =790790- body + n_rem -791791- zeros_num;918918+ r_body = body + n_rem - zeros_num;792919 } else {793920 r_body = body;794794- r_zeros_number =795795- zeros_num - n_rem;796796- zeros_num -=797797- r_zeros_number;921921+ r_zeros_number = zeros_num - n_rem;922922+ zeros_num -= r_zeros_number;798923 }799924800800- leaf_paste_in_buffer(&bi, 0,801801- n_shift,802802- tb->803803- insert_size804804- [0] -805805- n_rem,806806- r_body,807807- r_zeros_number);925925+ leaf_paste_in_buffer(&bi, 0, n_shift,926926+ tb->insert_size[0] - n_rem,927927+ r_body, r_zeros_number);808928809809- if (is_indirect_le_ih810810- (B_N_PITEM_HEAD811811- (tb->R[0], 0))) {929929+ if (is_indirect_le_ih(B_N_PITEM_HEAD(tb->R[0], 0))) {812930#if 0813931 RFALSE(n_rem,814932 "PAP-12160: paste more than one unformatted node pointer");815933#endif816816- set_ih_free_space817817- (B_N_PITEM_HEAD818818- (tb->R[0], 0), 0);934934+ set_ih_free_space(B_N_PITEM_HEAD(tb->R[0], 0), 0);819935 }820936 tb->insert_size[0] = n_rem;821937 if (!n_rem)···72210447231045 struct item_head *pasted;7241046725725- ret_val =726726- leaf_shift_right(tb, tb->rnum[0],727727- tb->rbytes);10471047+ ret_val = leaf_shift_right(tb, tb->rnum[0], tb->rbytes);7281048 /* append item in R[0] */7291049 if (pos_in_item >= 0) {7301050 buffer_info_init_right(tb, &bi);731731- leaf_paste_in_buffer(&bi,732732- item_pos -733733- n +734734- tb->735735- rnum[0],736736- pos_in_item,737737- tb->738738- insert_size739739- [0], body,740740- zeros_num);10511051+ leaf_paste_in_buffer(&bi, item_pos - n + tb->rnum[0], pos_in_item,10521052+ tb->insert_size[0], body, zeros_num);7411053 }74210547431055 /* paste new entry, if item is directory item */744744- pasted =745745- B_N_PITEM_HEAD(tb->R[0],746746- item_pos - n +747747- tb->rnum[0]);748748- if (is_direntry_le_ih(pasted)749749- && pos_in_item >= 0) {750750- leaf_paste_entries(&bi,751751- item_pos -752752- n +753753- tb->rnum[0],754754- pos_in_item,755755- 1,756756- (struct757757- reiserfs_de_head758758- *)body,759759- body +760760- DEH_SIZE,761761- tb->762762- insert_size763763- [0]764764- );10561056+ pasted = B_N_PITEM_HEAD(tb->R[0], item_pos - n + tb->rnum[0]);10571057+ if (is_direntry_le_ih(pasted) && pos_in_item >= 0) {10581058+ leaf_paste_entries(&bi, item_pos - n + tb->rnum[0],10591059+ pos_in_item, 1,10601060+ (struct reiserfs_de_head *) body,10611061+ body + DEH_SIZE, tb->insert_size[0]);7651062 if (!pos_in_item) {7661063767767- RFALSE(item_pos - n +768768- tb->rnum[0],10641064+ RFALSE(item_pos - n + tb->rnum[0],7691065 "PAP-12165: directory item must be first item of node when pasting is in 0th position");77010667711067 /* update delimiting keys */772772- replace_key(tb,773773- tb->CFR[0],774774- tb->rkey[0],775775- tb->R[0],776776- 0);10681068+ replace_key(tb, tb->CFR[0], tb->rkey[0], tb->R[0], 0);7771069 }7781070 }7791071···7591111 default: /* cases d and t */7601112 reiserfs_panic(tb->tb_sb, "PAP-12175",7611113 "rnum > 0: unexpected mode: %s(%d)",762762- (flag ==763763- M_DELETE) ? "DELETE" : ((flag ==764764- M_CUT) ? "CUT"765765- : "UNKNOWN"),766766- flag);11141114+ (flag == M_DELETE) ? "DELETE" : ((flag == M_CUT) ? "CUT" : "UNKNOWN"), flag);7671115 }76811167691117 }77011187711119 /* tb->rnum[0] > 0 */7721120 RFALSE(tb->blknum[0] > 3,773773- "PAP-12180: blknum can not be %d. It must be <= 3",774774- tb->blknum[0]);11211121+ "PAP-12180: blknum can not be %d. It must be <= 3", tb->blknum[0]);7751122 RFALSE(tb->blknum[0] < 0,776776- "PAP-12185: blknum can not be %d. It must be >= 0",777777- tb->blknum[0]);11231123+ "PAP-12185: blknum can not be %d. It must be >= 0", tb->blknum[0]);77811247791125 /* if while adding to a node we discover that it is possible to split7801126 it in two, and merge the left part into the left neighbor and the···81911778201178 if (n - snum[i] < item_pos) { /* new item or it's part falls to first new node S_new[i] */8211179 if (item_pos == n - snum[i] + 1 && sbytes[i] != -1) { /* part of new item falls into S_new[i] */822822- int old_key_comp, old_len,823823- r_zeros_number;11801180+ int old_key_comp, old_len, r_zeros_number;8241181 const char *r_body;8251182 int version;8261183···8331192 old_len = ih_item_len(ih);83411938351194 /* Calculate key component and item length to insert into S_new[i] */836836- set_le_ih_k_offset(ih,837837- le_ih_k_offset(ih) +838838- ((old_len -839839- sbytes[i]) <<840840- (is_indirect_le_ih841841- (ih) ? tb->tb_sb->842842- s_blocksize_bits -843843- UNFM_P_SHIFT :844844- 0)));11951195+ set_le_ih_k_offset(ih, le_ih_k_offset(ih) +11961196+ ((old_len - sbytes[i]) << (is_indirect_le_ih(ih) ? tb->tb_sb-> s_blocksize_bits - UNFM_P_SHIFT : 0)));84511978461198 put_ih_item_len(ih, sbytes[i]);8471199···84312098441210 if ((old_len - sbytes[i]) > zeros_num) {8451211 r_zeros_number = 0;846846- r_body =847847- body + (old_len -848848- sbytes[i]) -849849- zeros_num;12121212+ r_body = body + (old_len - sbytes[i]) - zeros_num;8501213 } else {8511214 r_body = body;852852- r_zeros_number =853853- zeros_num - (old_len -854854- sbytes[i]);12151215+ r_zeros_number = zeros_num - (old_len - sbytes[i]);8551216 zeros_num -= r_zeros_number;8561217 }8571218858858- leaf_insert_into_buf(&bi, 0, ih, r_body,859859- r_zeros_number);12191219+ leaf_insert_into_buf(&bi, 0, ih, r_body, r_zeros_number);86012208611221 /* Calculate key component and item length to insert into S[i] */8621222 set_le_ih_k_offset(ih, old_key_comp);863863- put_ih_item_len(ih,864864- old_len - sbytes[i]);12231223+ put_ih_item_len(ih, old_len - sbytes[i]);8651224 tb->insert_size[0] -= sbytes[i];8661225 } else { /* whole new item falls into S_new[i] */86712268681227 /* Shift snum[0] - 1 items to S_new[i] (sbytes[i] of split item) */8691228 leaf_move_items(LEAF_FROM_S_TO_SNEW, tb,870870- snum[i] - 1, sbytes[i],871871- S_new[i]);12291229+ snum[i] - 1, sbytes[i], S_new[i]);87212308731231 /* Insert new item into S_new[i] */8741232 buffer_info_init_bh(tb, &bi, S_new[i]);875875- leaf_insert_into_buf(&bi,876876- item_pos - n +877877- snum[i] - 1, ih,878878- body, zeros_num);12331233+ leaf_insert_into_buf(&bi, item_pos - n + snum[i] - 1,12341234+ ih, body, zeros_num);87912358801236 zeros_num = tb->insert_size[0] = 0;8811237 }···89212688931269 int entry_count;8941270895895- entry_count =896896- ih_entry_count(aux_ih);12711271+ entry_count = ih_entry_count(aux_ih);8971272898898- if (entry_count - sbytes[i] <899899- pos_in_item900900- && pos_in_item <=901901- entry_count) {12731273+ if (entry_count - sbytes[i] < pos_in_item && pos_in_item <= entry_count) {9021274 /* new directory entry falls into S_new[i] */9031275904904- RFALSE(!tb->905905- insert_size[0],906906- "PAP-12215: insert_size is already 0");907907- RFALSE(sbytes[i] - 1 >=908908- entry_count,12761276+ RFALSE(!tb->insert_size[0], "PAP-12215: insert_size is already 0");12771277+ RFALSE(sbytes[i] - 1 >= entry_count,9091278 "PAP-12220: there are no so much entries (%d), only %d",910910- sbytes[i] - 1,911911- entry_count);12791279+ sbytes[i] - 1, entry_count);91212809131281 /* Shift snum[i]-1 items in whole. Shift sbytes[i] directory entries from directory item number snum[i] */914914- leaf_move_items915915- (LEAF_FROM_S_TO_SNEW,916916- tb, snum[i],917917- sbytes[i] - 1,918918- S_new[i]);12821282+ leaf_move_items(LEAF_FROM_S_TO_SNEW, tb, snum[i], sbytes[i] - 1, S_new[i]);9191283 /* Paste given directory entry to directory item */9201284 buffer_info_init_bh(tb, &bi, S_new[i]);921921- leaf_paste_in_buffer922922- (&bi, 0,923923- pos_in_item -924924- entry_count +925925- sbytes[i] - 1,926926- tb->insert_size[0],927927- body, zeros_num);12851285+ leaf_paste_in_buffer(&bi, 0, pos_in_item - entry_count + sbytes[i] - 1,12861286+ tb->insert_size[0], body, zeros_num);9281287 /* paste new directory entry */929929- leaf_paste_entries(&bi,930930- 0,931931- pos_in_item932932- -933933- entry_count934934- +935935- sbytes936936- [i] -937937- 1, 1,938938- (struct939939- reiserfs_de_head940940- *)941941- body,942942- body943943- +944944- DEH_SIZE,945945- tb->946946- insert_size947947- [0]948948- );12881288+ leaf_paste_entries(&bi, 0, pos_in_item - entry_count + sbytes[i] - 1, 1,12891289+ (struct reiserfs_de_head *) body,12901290+ body + DEH_SIZE, tb->insert_size[0]);9491291 tb->insert_size[0] = 0;9501292 pos_in_item++;9511293 } else { /* new directory entry doesn't fall into S_new[i] */952952- leaf_move_items953953- (LEAF_FROM_S_TO_SNEW,954954- tb, snum[i],955955- sbytes[i],956956- S_new[i]);12941294+ leaf_move_items(LEAF_FROM_S_TO_SNEW,tb, snum[i], sbytes[i], S_new[i]);9571295 }9581296 } else { /* regular object */9591297960960- int n_shift, n_rem,961961- r_zeros_number;12981298+ int n_shift, n_rem, r_zeros_number;9621299 const char *r_body;9631300964964- RFALSE(pos_in_item !=965965- ih_item_len966966- (B_N_PITEM_HEAD967967- (tbS0, item_pos))968968- || tb->insert_size[0] <=969969- 0,13011301+ RFALSE(pos_in_item != ih_item_len(B_N_PITEM_HEAD(tbS0, item_pos)) || tb->insert_size[0] <= 0,9701302 "PAP-12225: item too short or insert_size <= 0");97113039721304 /* Calculate number of bytes which must be shifted from appended item */973973- n_shift =974974- sbytes[i] -975975- tb->insert_size[0];13051305+ n_shift = sbytes[i] - tb->insert_size[0];9761306 if (n_shift < 0)9771307 n_shift = 0;978978- leaf_move_items979979- (LEAF_FROM_S_TO_SNEW, tb,980980- snum[i], n_shift,981981- S_new[i]);13081308+ leaf_move_items(LEAF_FROM_S_TO_SNEW, tb, snum[i], n_shift, S_new[i]);98213099831310 /* Calculate number of bytes which must remain in body after append to S_new[i] */984984- n_rem =985985- tb->insert_size[0] -986986- sbytes[i];13111311+ n_rem = tb->insert_size[0] - sbytes[i];9871312 if (n_rem < 0)9881313 n_rem = 0;9891314 /* Append part of body into S_new[0] */9901315 buffer_info_init_bh(tb, &bi, S_new[i]);9911316 if (n_rem > zeros_num) {9921317 r_zeros_number = 0;993993- r_body =994994- body + n_rem -995995- zeros_num;13181318+ r_body = body + n_rem - zeros_num;9961319 } else {9971320 r_body = body;998998- r_zeros_number =999999- zeros_num - n_rem;10001000- zeros_num -=10011001- r_zeros_number;13211321+ r_zeros_number = zeros_num - n_rem;13221322+ zeros_num -= r_zeros_number;10021323 }1003132410041004- leaf_paste_in_buffer(&bi, 0,10051005- n_shift,10061006- tb->10071007- insert_size10081008- [0] -10091009- n_rem,10101010- r_body,10111011- r_zeros_number);13251325+ leaf_paste_in_buffer(&bi, 0, n_shift,13261326+ tb->insert_size[0] - n_rem,13271327+ r_body, r_zeros_number);10121328 {10131329 struct item_head *tmp;1014133010151015- tmp =10161016- B_N_PITEM_HEAD(S_new10171017- [i],10181018- 0);13311331+ tmp = B_N_PITEM_HEAD(S_new[i], 0);10191332 if (is_indirect_le_ih10201333 (tmp)) {10211021- set_ih_free_space10221022- (tmp, 0);10231023- set_le_ih_k_offset10241024- (tmp,10251025- le_ih_k_offset10261026- (tmp) +10271027- (n_rem <<10281028- (tb->10291029- tb_sb->10301030- s_blocksize_bits10311031- -10321032- UNFM_P_SHIFT)));13341334+ set_ih_free_space(tmp, 0);13351335+ set_le_ih_k_offset(tmp, le_ih_k_offset(tmp) + (n_rem << (tb->tb_sb->s_blocksize_bits - UNFM_P_SHIFT)));10331336 } else {10341034- set_le_ih_k_offset10351035- (tmp,10361036- le_ih_k_offset10371037- (tmp) +10381038- n_rem);13371337+ set_le_ih_k_offset(tmp, le_ih_k_offset(tmp) + n_rem);10391338 }10401339 }10411340···9731426 struct item_head *pasted;97414279751428#ifdef CONFIG_REISERFS_CHECK976976- struct item_head *ih_check =977977- B_N_PITEM_HEAD(tbS0, item_pos);14291429+ struct item_head *ih_check = B_N_PITEM_HEAD(tbS0, item_pos);97814309791431 if (!is_direntry_le_ih(ih_check)9801432 && (pos_in_item != ih_item_len(ih_check)···9851439 "to ih_item_len");9861440#endif /* CONFIG_REISERFS_CHECK */9871441988988- leaf_mi =989989- leaf_move_items(LEAF_FROM_S_TO_SNEW,14421442+ leaf_mi = leaf_move_items(LEAF_FROM_S_TO_SNEW,9901443 tb, snum[i],9911444 sbytes[i],9921445 S_new[i]);···9971452 /* paste into item */9981453 buffer_info_init_bh(tb, &bi, S_new[i]);9991454 leaf_paste_in_buffer(&bi,10001000- item_pos - n +10011001- snum[i],14551455+ item_pos - n + snum[i],10021456 pos_in_item,10031457 tb->insert_size[0],10041458 body, zeros_num);1005145910061006- pasted =10071007- B_N_PITEM_HEAD(S_new[i],10081008- item_pos - n +10091009- snum[i]);14601460+ pasted = B_N_PITEM_HEAD(S_new[i], item_pos - n + snum[i]);10101461 if (is_direntry_le_ih(pasted)) {10111462 leaf_paste_entries(&bi,10121012- item_pos -10131013- n + snum[i],10141014- pos_in_item,10151015- 1,10161016- (struct10171017- reiserfs_de_head10181018- *)body,10191019- body +10201020- DEH_SIZE,10211021- tb->10221022- insert_size10231023- [0]14631463+ item_pos - n + snum[i],14641464+ pos_in_item, 1,14651465+ (struct reiserfs_de_head *)body,14661466+ body + DEH_SIZE,14671467+ tb->insert_size[0]10241468 );10251469 }10261470···10291495 default: /* cases d and t */10301496 reiserfs_panic(tb->tb_sb, "PAP-12245",10311497 "blknum > 2: unexpected mode: %s(%d)",10321032- (flag ==10331033- M_DELETE) ? "DELETE" : ((flag ==10341034- M_CUT) ? "CUT"10351035- : "UNKNOWN"),10361036- flag);14981498+ (flag == M_DELETE) ? "DELETE" : ((flag == M_CUT) ? "CUT" : "UNKNOWN"), flag);10371499 }1038150010391501 memcpy(insert_key + i, B_N_PKEY(S_new[i], 0), KEY_SIZE);···10541524 /* If we insert the first key change the delimiting key */10551525 if (item_pos == 0) {10561526 if (tb->CFL[0]) /* can be 0 in reiserfsck */10571057- replace_key(tb, tb->CFL[0], tb->lkey[0],10581058- tbS0, 0);10591059-15271527+ replace_key(tb, tb->CFL[0], tb->lkey[0], tbS0, 0);10601528 }10611529 break;10621530···10641536 pasted = B_N_PITEM_HEAD(tbS0, item_pos);10651537 /* when directory, may be new entry already pasted */10661538 if (is_direntry_le_ih(pasted)) {10671067- if (pos_in_item >= 0 &&10681068- pos_in_item <=10691069- ih_entry_count(pasted)) {15391539+ if (pos_in_item >= 0 && pos_in_item <= ih_entry_count(pasted)) {1070154010711541 RFALSE(!tb->insert_size[0],10721542 "PAP-12260: insert_size is 0 already");1073154310741544 /* prepare space */10751545 buffer_info_init_tbS0(tb, &bi);10761076- leaf_paste_in_buffer(&bi,10771077- item_pos,10781078- pos_in_item,10791079- tb->10801080- insert_size10811081- [0], body,15461546+ leaf_paste_in_buffer(&bi, item_pos, pos_in_item,15471547+ tb->insert_size[0], body,10821548 zeros_num);1083154910841550 /* paste entry */10851085- leaf_paste_entries(&bi,10861086- item_pos,10871087- pos_in_item,10881088- 1,10891089- (struct10901090- reiserfs_de_head10911091- *)body,10921092- body +10931093- DEH_SIZE,10941094- tb->10951095- insert_size10961096- [0]10971097- );15511551+ leaf_paste_entries(&bi, item_pos, pos_in_item, 1,15521552+ (struct reiserfs_de_head *)body,15531553+ body + DEH_SIZE,15541554+ tb->insert_size[0]);10981555 if (!item_pos && !pos_in_item) {10991099- RFALSE(!tb->CFL[0]11001100- || !tb->L[0],15561556+ RFALSE(!tb->CFL[0] || !tb->L[0],11011557 "PAP-12270: CFL[0]/L[0] must be specified");11021102- if (tb->CFL[0]) {11031103- replace_key(tb,11041104- tb->11051105- CFL11061106- [0],11071107- tb->11081108- lkey11091109- [0],11101110- tbS0,11111111- 0);11121112-11131113- }15581558+ if (tb->CFL[0])15591559+ replace_key(tb, tb->CFL[0], tb->lkey[0], tbS0, 0);11141560 }11151561 tb->insert_size[0] = 0;11161562 }···10951593 "PAP-12275: insert size must not be %d",10961594 tb->insert_size[0]);10971595 buffer_info_init_tbS0(tb, &bi);10981098- leaf_paste_in_buffer(&bi,10991099- item_pos,11001100- pos_in_item,11011101- tb->11021102- insert_size11031103- [0], body,11041104- zeros_num);15961596+ leaf_paste_in_buffer(&bi, item_pos, pos_in_item,15971597+ tb->insert_size[0], body, zeros_num);1105159811061599 if (is_indirect_le_ih(pasted)) {11071600#if 0···11081611 tb->11091612 insert_size[0]);11101613#endif11111111- set_ih_free_space11121112- (pasted, 0);16141614+ set_ih_free_space(pasted, 0);11131615 }11141616 tb->insert_size[0] = 0;11151617 }···11161620 else {11171621 if (tb->insert_size[0]) {11181622 print_cur_tb("12285");11191119- reiserfs_panic(tb->11201120- tb_sb,16231623+ reiserfs_panic(tb->tb_sb,11211624 "PAP-12285",11221625 "insert_size "11231626 "must be 0 "
+8-8
fs/xfs/xfs_iops.c
···705705{706706 struct xfs_mount *mp = ip->i_mount;707707 struct inode *inode = VFS_I(ip);708708- int mask = iattr->ia_valid;709708 xfs_off_t oldsize, newsize;710709 struct xfs_trans *tp;711710 int error;···725726726727 ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL));727728 ASSERT(S_ISREG(ip->i_d.di_mode));728728- ASSERT((mask & (ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_ATIME_SET|729729- ATTR_MTIME_SET|ATTR_KILL_PRIV|ATTR_TIMES_SET)) == 0);729729+ ASSERT((iattr->ia_valid & (ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_ATIME_SET|730730+ ATTR_MTIME_SET|ATTR_KILL_PRIV|ATTR_TIMES_SET)) == 0);730731731732 oldsize = inode->i_size;732733 newsize = iattr->ia_size;···735736 * Short circuit the truncate case for zero length files.736737 */737738 if (newsize == 0 && oldsize == 0 && ip->i_d.di_nextents == 0) {738738- if (!(mask & (ATTR_CTIME|ATTR_MTIME)))739739+ if (!(iattr->ia_valid & (ATTR_CTIME|ATTR_MTIME)))739740 return 0;740741741742 /*···823824 * these flags set. For all other operations the VFS set these flags824825 * explicitly if it wants a timestamp update.825826 */826826- if (newsize != oldsize && (!(mask & (ATTR_CTIME | ATTR_MTIME)))) {827827+ if (newsize != oldsize &&828828+ !(iattr->ia_valid & (ATTR_CTIME | ATTR_MTIME))) {827829 iattr->ia_ctime = iattr->ia_mtime =828830 current_fs_time(inode->i_sb);829829- mask |= ATTR_CTIME | ATTR_MTIME;831831+ iattr->ia_valid |= ATTR_CTIME | ATTR_MTIME;830832 }831833832834 /*···863863 xfs_inode_clear_eofblocks_tag(ip);864864 }865865866866- if (mask & ATTR_MODE)866866+ if (iattr->ia_valid & ATTR_MODE)867867 xfs_setattr_mode(ip, iattr);868868- if (mask & (ATTR_ATIME|ATTR_CTIME|ATTR_MTIME))868868+ if (iattr->ia_valid & (ATTR_ATIME|ATTR_CTIME|ATTR_MTIME))869869 xfs_setattr_time(ip, iattr);870870871871 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
+15-4
fs/xfs/xfs_log_cil.c
···205205 /*206206 * We 64-bit align the length of each iovec so that the start207207 * of the next one is naturally aligned. We'll need to208208- * account for that slack space here.208208+ * account for that slack space here. Then round nbytes up209209+ * to 64-bit alignment so that the initial buffer alignment is210210+ * easy to calculate and verify.209211 */210212 nbytes += niovecs * sizeof(uint64_t);213213+ nbytes = round_up(nbytes, sizeof(uint64_t));211214212215 /* grab the old item if it exists for reservation accounting */213216 old_lv = lip->li_lv;214217215215- /* calc buffer size */216216- buf_size = sizeof(struct xfs_log_vec) + nbytes +217217- niovecs * sizeof(struct xfs_log_iovec);218218+ /*219219+ * The data buffer needs to start 64-bit aligned, so round up220220+ * that space to ensure we can align it appropriately and not221221+ * overrun the buffer.222222+ */223223+ buf_size = nbytes +224224+ round_up((sizeof(struct xfs_log_vec) +225225+ niovecs * sizeof(struct xfs_log_iovec)),226226+ sizeof(uint64_t));218227219228 /* compare to existing item size */220229 if (lip->li_lv && buf_size <= lip->li_lv->lv_size) {···260251 /* The allocated data region lies beyond the iovec region */261252 lv->lv_buf_len = 0;262253 lv->lv_buf = (char *)lv + buf_size - nbytes;254254+ ASSERT(IS_ALIGNED((unsigned long)lv->lv_buf, sizeof(uint64_t)));255255+263256 lip->li_ops->iop_format(lip, lv);264257insert:265258 ASSERT(lv->lv_buf_len <= nbytes);
+16-8
fs/xfs/xfs_mount.c
···282282 struct xfs_sb *sbp = &mp->m_sb;283283 int error;284284 int loud = !(flags & XFS_MFSI_QUIET);285285+ const struct xfs_buf_ops *buf_ops;285286286287 ASSERT(mp->m_sb_bp == NULL);287288 ASSERT(mp->m_ddev_targp != NULL);289289+290290+ /*291291+ * For the initial read, we must guess at the sector292292+ * size based on the block device. It's enough to293293+ * get the sb_sectsize out of the superblock and294294+ * then reread with the proper length.295295+ * We don't verify it yet, because it may not be complete.296296+ */297297+ sector_size = xfs_getsize_buftarg(mp->m_ddev_targp);298298+ buf_ops = NULL;288299289300 /*290301 * Allocate a (locked) buffer to hold the superblock.291302 * This will be kept around at all times to optimize292303 * access to the superblock.293304 */294294- sector_size = xfs_getsize_buftarg(mp->m_ddev_targp);295295-296305reread:297306 bp = xfs_buf_read_uncached(mp->m_ddev_targp, XFS_SB_DADDR,298298- BTOBB(sector_size), 0,299299- loud ? &xfs_sb_buf_ops300300- : &xfs_sb_quiet_buf_ops);307307+ BTOBB(sector_size), 0, buf_ops);301308 if (!bp) {302309 if (loud)303310 xfs_warn(mp, "SB buffer read failed");···335328 }336329337330 /*338338- * If device sector size is smaller than the superblock size,339339- * re-read the superblock so the buffer is correctly sized.331331+ * Re-read the superblock so the buffer is correctly sized,332332+ * and properly verified.340333 */341341- if (sector_size < sbp->sb_sectsize) {334334+ if (buf_ops == NULL) {342335 xfs_buf_relse(bp);343336 sector_size = sbp->sb_sectsize;337337+ buf_ops = loud ? &xfs_sb_buf_ops : &xfs_sb_quiet_buf_ops;344338 goto reread;345339 }346340
+4-6
fs/xfs/xfs_sb.c
···295295 sbp->sb_dblocks == 0 ||296296 sbp->sb_dblocks > XFS_MAX_DBLOCKS(sbp) ||297297 sbp->sb_dblocks < XFS_MIN_DBLOCKS(sbp))) {298298- XFS_CORRUPTION_ERROR("SB sanity check failed",299299- XFS_ERRLEVEL_LOW, mp, sbp);298298+ xfs_notice(mp, "SB sanity check failed");300299 return XFS_ERROR(EFSCORRUPTED);301300 }302301···610611 XFS_SB_VERSION_5) ||611612 dsb->sb_crc != 0)) {612613613613- if (!xfs_verify_cksum(bp->b_addr, be16_to_cpu(dsb->sb_sectsize),614614+ if (!xfs_verify_cksum(bp->b_addr, BBTOB(bp->b_length),614615 offsetof(struct xfs_sb, sb_crc))) {615616 /* Only fail bad secondaries on a known V5 filesystem */616616- if (bp->b_bn != XFS_SB_DADDR &&617617+ if (bp->b_bn == XFS_SB_DADDR ||617618 xfs_sb_version_hascrc(&mp->m_sb)) {618619 error = EFSCORRUPTED;619620 goto out_error;···624625625626out_error:626627 if (error) {627627- if (error != EWRONGFS)628628+ if (error == EFSCORRUPTED)628629 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW,629630 mp, bp->b_addr);630631 xfs_buf_ioerror(bp, error);···642643 struct xfs_buf *bp)643644{644645 struct xfs_dsb *dsb = XFS_BUF_TO_SBP(bp);645645-646646647647 if (dsb->sb_magicnum == cpu_to_be32(XFS_SB_MAGIC)) {648648 /* XFS filesystem, verify noisily! */
···166166 *167167 * The ID of the root cgroup is always 0, and a new cgroup168168 * will be assigned with a smallest available ID.169169+ *170170+ * Allocating/Removing ID must be protected by cgroup_mutex.169171 */170172 int id;171173
···387387 struct i2c_client *muic; /* slave addr 0x4a */388388 struct mutex iolock;389389390390- int type;390390+ unsigned long type;391391 struct platform_device *battery; /* battery control (not fuel gauge) */392392393393 int irq;
+1-1
include/linux/mfd/max8998-private.h
···163163 int ono;164164 u8 irq_masks_cur[MAX8998_NUM_IRQ_REGS];165165 u8 irq_masks_cache[MAX8998_NUM_IRQ_REGS];166166- int type;166166+ unsigned long type;167167 bool wakeup;168168};169169
+2-2
include/linux/mfd/tps65217.h
···252252struct tps65217 {253253 struct device *dev;254254 struct tps65217_board *pdata;255255- unsigned int id;255255+ unsigned long id;256256 struct regulator_desc desc[TPS65217_NUM_REGULATOR];257257 struct regulator_dev *rdev[TPS65217_NUM_REGULATOR];258258 struct regmap *regmap;···263263 return dev_get_drvdata(dev);264264}265265266266-static inline int tps65217_chip_id(struct tps65217 *tps65217)266266+static inline unsigned long tps65217_chip_id(struct tps65217 *tps65217)267267{268268 return tps65217->id;269269}
+32-4
include/linux/netdevice.h
···752752 unsigned char id_len;753753};754754755755+typedef u16 (*select_queue_fallback_t)(struct net_device *dev,756756+ struct sk_buff *skb);757757+755758/*756759 * This structure defines the management hooks for network devices.757760 * The following hooks can be defined; unless noted otherwise, they are···786783 * Required can not be NULL.787784 *788785 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb,789789- * void *accel_priv);786786+ * void *accel_priv, select_queue_fallback_t fallback);790787 * Called to decide which queue to when device supports multiple791788 * transmit queues.792789 *···10081005 struct net_device *dev);10091006 u16 (*ndo_select_queue)(struct net_device *dev,10101007 struct sk_buff *skb,10111011- void *accel_priv);10081008+ void *accel_priv,10091009+ select_queue_fallback_t fallback);10121010 void (*ndo_change_rx_flags)(struct net_device *dev,10131011 int flags);10141012 void (*ndo_set_rx_mode)(struct net_device *dev);···15551551struct netdev_queue *netdev_pick_tx(struct net_device *dev,15561552 struct sk_buff *skb,15571553 void *accel_priv);15581558-u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb);1559155415601555/*15611556 * Net namespace inlines···22762273static inline void netdev_reset_queue(struct net_device *dev_queue)22772274{22782275 netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0));22762276+}22772277+22782278+/**22792279+ * netdev_cap_txqueue - check if selected tx queue exceeds device queues22802280+ * @dev: network device22812281+ * @queue_index: given tx queue index22822282+ *22832283+ * Returns 0 if given tx queue index >= number of device tx queues,22842284+ * otherwise returns the originally passed tx queue index.22852285+ */22862286+static inline u16 netdev_cap_txqueue(struct net_device *dev, u16 queue_index)22872287+{22882288+ if (unlikely(queue_index >= dev->real_num_tx_queues)) {22892289+ net_warn_ratelimited("%s selects TX queue %d, but real number of TX queues is %d\n",22902290+ dev->name, queue_index,22912291+ dev->real_num_tx_queues);22922292+ return 0;22932293+ }22942294+22952295+ return queue_index;22792296}2280229722812298/**···30913068void netif_stacked_transfer_operstate(const struct net_device *rootdev,30923069 struct net_device *dev);3093307030943094-netdev_features_t netif_skb_features(struct sk_buff *skb);30713071+netdev_features_t netif_skb_dev_features(struct sk_buff *skb,30723072+ const struct net_device *dev);30733073+static inline netdev_features_t netif_skb_features(struct sk_buff *skb)30743074+{30753075+ return netif_skb_dev_features(skb, skb->dev);30763076+}3095307730963078static inline bool net_gso_ok(netdev_features_t features, int gso_type)30973079{
+20
include/linux/pci.h
···11691169void pci_restore_msi_state(struct pci_dev *dev);11701170int pci_msi_enabled(void);11711171int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec);11721172+static inline int pci_enable_msi_exact(struct pci_dev *dev, int nvec)11731173+{11741174+ int rc = pci_enable_msi_range(dev, nvec, nvec);11751175+ if (rc < 0)11761176+ return rc;11771177+ return 0;11781178+}11721179int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries,11731180 int minvec, int maxvec);11811181+static inline int pci_enable_msix_exact(struct pci_dev *dev,11821182+ struct msix_entry *entries, int nvec)11831183+{11841184+ int rc = pci_enable_msix_range(dev, entries, nvec, nvec);11851185+ if (rc < 0)11861186+ return rc;11871187+ return 0;11881188+}11741189#else11751190static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; }11761191static inline int pci_enable_msi_block(struct pci_dev *dev, int nvec)···12041189static inline int pci_enable_msi_range(struct pci_dev *dev, int minvec,12051190 int maxvec)12061191{ return -ENOSYS; }11921192+static inline int pci_enable_msi_exact(struct pci_dev *dev, int nvec)11931193+{ return -ENOSYS; }12071194static inline int pci_enable_msix_range(struct pci_dev *dev,12081195 struct msix_entry *entries, int minvec, int maxvec)11961196+{ return -ENOSYS; }11971197+static inline int pci_enable_msix_exact(struct pci_dev *dev,11981198+ struct msix_entry *entries, int nvec)12091199{ return -ENOSYS; }12101200#endif12111201
+17
include/linux/skbuff.h
···29162916{29172917 return !skb->head_frag || skb_cloned(skb);29182918}29192919+29202920+/**29212921+ * skb_gso_network_seglen - Return length of individual segments of a gso packet29222922+ *29232923+ * @skb: GSO skb29242924+ *29252925+ * skb_gso_network_seglen is used to determine the real size of the29262926+ * individual segments, including Layer3 (IP, IPv6) and L4 headers (TCP/UDP).29272927+ *29282928+ * The MAC/L2 header is not accounted for.29292929+ */29302930+static inline unsigned int skb_gso_network_seglen(const struct sk_buff *skb)29312931+{29322932+ unsigned int hdr_len = skb_transport_header(skb) -29332933+ skb_network_header(skb);29342934+ return hdr_len + skb_gso_transport_seglen(skb);29352935+}29192936#endif /* __KERNEL__ */29202937#endif /* _LINUX_SKBUFF_H */
+4-2
include/linux/syscalls.h
···281281asmlinkage long sys_sched_setparam(pid_t pid,282282 struct sched_param __user *param);283283asmlinkage long sys_sched_setattr(pid_t pid,284284- struct sched_attr __user *attr);284284+ struct sched_attr __user *attr,285285+ unsigned int flags);285286asmlinkage long sys_sched_getscheduler(pid_t pid);286287asmlinkage long sys_sched_getparam(pid_t pid,287288 struct sched_param __user *param);288289asmlinkage long sys_sched_getattr(pid_t pid,289290 struct sched_attr __user *attr,290290- unsigned int size);291291+ unsigned int size,292292+ unsigned int flags);291293asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,292294 unsigned long __user *user_mask_ptr);293295asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
···16531653 /* This is the last advertised value of rwnd over a SACK chunk. */16541654 __u32 a_rwnd;1655165516561656- /* Number of bytes by which the rwnd has slopped. The rwnd is allowed16571657- * to slop over a maximum of the association's frag_point.16581658- */16591659- __u32 rwnd_over;16601660-16611661- /* Keeps treack of rwnd pressure. This happens when we have16621662- * a window, but not recevie buffer (i.e small packets). This one16631663- * is releases slowly (1 PMTU at a time ).16641664- */16651665- __u32 rwnd_press;16661666-16671656 /* This is the sndbuf size in use for the association.16681657 * This corresponds to the sndbuf size for the association,16691658 * as specified in the sk->sndbuf.···18811892__u32 sctp_association_get_next_tsn(struct sctp_association *);1882189318831894void sctp_assoc_sync_pmtu(struct sock *, struct sctp_association *);18841884-void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int);18851885-void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int);18951895+void sctp_assoc_rwnd_update(struct sctp_association *, bool);18861896void sctp_assoc_set_primary(struct sctp_association *,18871897 struct sctp_transport *);18881898void sctp_assoc_del_nonprimary_peers(struct sctp_association *,
···886886 * per-subsystem and moved to css->id so that lookups are887887 * successful until the target css is released.888888 */889889+ mutex_lock(&cgroup_mutex);889890 idr_remove(&cgrp->root->cgroup_idr, cgrp->id);891891+ mutex_unlock(&cgroup_mutex);890892 cgrp->id = -1;891893892894 call_rcu(&cgrp->rcu_head, cgroup_free_rcu);···15681566 mutex_lock(&cgroup_mutex);15691567 mutex_lock(&cgroup_root_mutex);1570156815711571- root_cgrp->id = idr_alloc(&root->cgroup_idr, root_cgrp,15721572- 0, 1, GFP_KERNEL);15731573- if (root_cgrp->id < 0)15691569+ ret = idr_alloc(&root->cgroup_idr, root_cgrp, 0, 1, GFP_KERNEL);15701570+ if (ret < 0)15741571 goto unlock_drop;15721572+ root_cgrp->id = ret;1575157315761574 /* Check for name clashes with existing mounts */15771575 ret = -EBUSY;···27652763 */27662764 update_before = cgroup_serial_nr_next;2767276527682768- mutex_unlock(&cgroup_mutex);27692769-27702766 /* add/rm files for all cgroups created before */27712771- rcu_read_lock();27722767 css_for_each_descendant_pre(css, cgroup_css(root, ss)) {27732768 struct cgroup *cgrp = css->cgroup;27742769···2774277527752776 inode = cgrp->dentry->d_inode;27762777 dget(cgrp->dentry);27772777- rcu_read_unlock();27782778-27792778 dput(prev);27802779 prev = cgrp->dentry;2781278027812781+ mutex_unlock(&cgroup_mutex);27822782 mutex_lock(&inode->i_mutex);27832783 mutex_lock(&cgroup_mutex);27842784 if (cgrp->serial_nr < update_before && !cgroup_is_dead(cgrp))27852785 ret = cgroup_addrm_files(cgrp, cfts, is_add);27862786- mutex_unlock(&cgroup_mutex);27872786 mutex_unlock(&inode->i_mutex);27882788-27892789- rcu_read_lock();27902787 if (ret)27912788 break;27922789 }27932793- rcu_read_unlock();27902790+ mutex_unlock(&cgroup_mutex);27942791 dput(prev);27952792 deactivate_super(sb);27962793 return ret;···29052910 * We should check if the process is exiting, otherwise29062911 * it will race with cgroup_exit() in that the list29072912 * entry won't be deleted though the process has exited.29132913+ * Do it while holding siglock so that we don't end up29142914+ * racing against cgroup_exit().29082915 */29162916+ spin_lock_irq(&p->sighand->siglock);29092917 if (!(p->flags & PF_EXITING) && list_empty(&p->cg_list))29102918 list_add(&p->cg_list, &task_css_set(p)->tasks);29192919+ spin_unlock_irq(&p->sighand->siglock);29202920+29112921 task_unlock(p);29122922 } while_each_thread(g, p);29132923 read_unlock(&tasklist_lock);···41584158 struct cgroup *cgrp;41594159 struct cgroup_name *name;41604160 struct cgroupfs_root *root = parent->root;41614161- int ssid, err = 0;41614161+ int ssid, err;41624162 struct cgroup_subsys *ss;41634163 struct super_block *sb = root->sb;41644164···41684168 return -ENOMEM;4169416941704170 name = cgroup_alloc_name(dentry);41714171- if (!name)41714171+ if (!name) {41724172+ err = -ENOMEM;41724173 goto err_free_cgrp;41744174+ }41734175 rcu_assign_pointer(cgrp->name, name);41744174-41754175- /*41764176- * Temporarily set the pointer to NULL, so idr_find() won't return41774177- * a half-baked cgroup.41784178- */41794179- cgrp->id = idr_alloc(&root->cgroup_idr, NULL, 1, 0, GFP_KERNEL);41804180- if (cgrp->id < 0)41814181- goto err_free_name;4182417641834177 /*41844178 * Only live parents can have children. Note that the liveliness···41834189 */41844190 if (!cgroup_lock_live_group(parent)) {41854191 err = -ENODEV;41864186- goto err_free_id;41924192+ goto err_free_name;41934193+ }41944194+41954195+ /*41964196+ * Temporarily set the pointer to NULL, so idr_find() won't return41974197+ * a half-baked cgroup.41984198+ */41994199+ cgrp->id = idr_alloc(&root->cgroup_idr, NULL, 1, 0, GFP_KERNEL);42004200+ if (cgrp->id < 0) {42014201+ err = -ENOMEM;42024202+ goto err_unlock;41874203 }4188420441894205 /* Grab a reference on the superblock so the hierarchy doesn't···42254221 */42264222 err = cgroup_create_file(dentry, S_IFDIR | mode, sb);42274223 if (err < 0)42284228- goto err_unlock;42244224+ goto err_free_id;42294225 lockdep_assert_held(&dentry->d_inode->i_mutex);4230422642314227 cgrp->serial_nr = cgroup_serial_nr_next++;···4261425742624258 return 0;4263425942644264-err_unlock:42654265- mutex_unlock(&cgroup_mutex);42664266- /* Release the reference count that we took on the superblock */42674267- deactivate_super(sb);42684260err_free_id:42694261 idr_remove(&root->cgroup_idr, cgrp->id);42624262+ /* Release the reference count that we took on the superblock */42634263+ deactivate_super(sb);42644264+err_unlock:42654265+ mutex_unlock(&cgroup_mutex);42704266err_free_name:42714267 kfree(rcu_dereference_raw(cgrp->name));42724268err_free_cgrp:
···116116void __init sched_clock_register(u64 (*read)(void), int bits,117117 unsigned long rate)118118{119119+ u64 res, wrap, new_mask, new_epoch, cyc, ns;120120+ u32 new_mult, new_shift;121121+ ktime_t new_wrap_kt;119122 unsigned long r;120120- u64 res, wrap;121123 char r_unit;122124123125 if (cd.rate > rate)124126 return;125127126128 WARN_ON(!irqs_disabled());127127- read_sched_clock = read;128128- sched_clock_mask = CLOCKSOURCE_MASK(bits);129129- cd.rate = rate;130129131130 /* calculate the mult/shift to convert counter ticks to ns. */132132- clocks_calc_mult_shift(&cd.mult, &cd.shift, rate, NSEC_PER_SEC, 3600);131131+ clocks_calc_mult_shift(&new_mult, &new_shift, rate, NSEC_PER_SEC, 3600);132132+133133+ new_mask = CLOCKSOURCE_MASK(bits);134134+135135+ /* calculate how many ns until we wrap */136136+ wrap = clocks_calc_max_nsecs(new_mult, new_shift, 0, new_mask);137137+ new_wrap_kt = ns_to_ktime(wrap - (wrap >> 3));138138+139139+ /* update epoch for new counter and update epoch_ns from old counter*/140140+ new_epoch = read();141141+ cyc = read_sched_clock();142142+ ns = cd.epoch_ns + cyc_to_ns((cyc - cd.epoch_cyc) & sched_clock_mask,143143+ cd.mult, cd.shift);144144+145145+ raw_write_seqcount_begin(&cd.seq);146146+ read_sched_clock = read;147147+ sched_clock_mask = new_mask;148148+ cd.rate = rate;149149+ cd.wrap_kt = new_wrap_kt;150150+ cd.mult = new_mult;151151+ cd.shift = new_shift;152152+ cd.epoch_cyc = new_epoch;153153+ cd.epoch_ns = ns;154154+ raw_write_seqcount_end(&cd.seq);133155134156 r = rate;135157 if (r >= 4000000) {···163141 } else164142 r_unit = ' ';165143166166- /* calculate how many ns until we wrap */167167- wrap = clocks_calc_max_nsecs(cd.mult, cd.shift, 0, sched_clock_mask);168168- cd.wrap_kt = ns_to_ktime(wrap - (wrap >> 3));169169-170144 /* calculate the ns resolution of this counter */171171- res = cyc_to_ns(1ULL, cd.mult, cd.shift);145145+ res = cyc_to_ns(1ULL, new_mult, new_shift);146146+172147 pr_info("sched_clock: %u bits at %lu%cHz, resolution %lluns, wraps every %lluns\n",173148 bits, r, r_unit, res, wrap);174174-175175- update_sched_clock();176176-177177- /*178178- * Ensure that sched_clock() starts off at 0ns179179- */180180- cd.epoch_ns = 0;181149182150 /* Enable IRQ time accounting if we have a fast enough sched_clock */183151 if (irqtime > 0 || (irqtime == -1 && rate >= 1000000))
+1-1
kernel/user_namespace.c
···225225 *226226 * When there is no mapping defined for the user-namespace uid227227 * pair INVALID_UID is returned. Callers are expected to test228228- * for and handle handle INVALID_UID being returned. INVALID_UID228228+ * for and handle INVALID_UID being returned. INVALID_UID229229 * may be tested for using uid_valid().230230 */231231kuid_t make_kuid(struct user_namespace *ns, uid_t uid)
+7
kernel/workqueue.c
···18511851 if (worker->flags & WORKER_IDLE)18521852 pool->nr_idle--;1853185318541854+ /*18551855+ * Once WORKER_DIE is set, the kworker may destroy itself at any18561856+ * point. Pin to ensure the task stays until we're done with it.18571857+ */18581858+ get_task_struct(worker->task);18591859+18541860 list_del_init(&worker->entry);18551861 worker->flags |= WORKER_DIE;18561862···18651859 spin_unlock_irq(&pool->lock);1866186018671861 kthread_stop(worker->task);18621862+ put_task_struct(worker->task);18681863 kfree(worker);1869186418701865 spin_lock_irq(&pool->lock);
···241241{242242 struct batadv_priv *bat_priv = netdev_priv(soft_iface);243243 const struct batadv_hard_iface *hard_iface;244244- int min_mtu = ETH_DATA_LEN;244244+ int min_mtu = INT_MAX;245245246246 rcu_read_lock();247247 list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {···256256 }257257 rcu_read_unlock();258258259259- atomic_set(&bat_priv->packet_size_max, min_mtu);260260-261259 if (atomic_read(&bat_priv->fragmentation) == 0)262260 goto out;263261···266268 min_mtu = min_t(int, min_mtu, BATADV_FRAG_MAX_FRAG_SIZE);267269 min_mtu -= sizeof(struct batadv_frag_packet);268270 min_mtu *= BATADV_FRAG_MAX_FRAGMENTS;269269- atomic_set(&bat_priv->packet_size_max, min_mtu);270270-271271- /* with fragmentation enabled we can fragment external packets easily */272272- min_mtu = min_t(int, min_mtu, ETH_DATA_LEN);273271274272out:275275- return min_mtu - batadv_max_header_len();273273+ /* report to the other components the maximum amount of bytes that274274+ * batman-adv can send over the wire (without considering the payload275275+ * overhead). For example, this value is used by TT to compute the276276+ * maximum local table table size277277+ */278278+ atomic_set(&bat_priv->packet_size_max, min_mtu);279279+280280+ /* the real soft-interface MTU is computed by removing the payload281281+ * overhead from the maximum amount of bytes that was just computed.282282+ *283283+ * However batman-adv does not support MTUs bigger than ETH_DATA_LEN284284+ */285285+ return min_t(int, min_mtu - batadv_max_header_len(), ETH_DATA_LEN);276286}277287278288/* adjusts the MTU if a new interface with a smaller MTU appeared. */
+36
net/batman-adv/originator.c
···458458}459459460460/**461461+ * batadv_neigh_node_get - retrieve a neighbour from the list462462+ * @orig_node: originator which the neighbour belongs to463463+ * @hard_iface: the interface where this neighbour is connected to464464+ * @addr: the address of the neighbour465465+ *466466+ * Looks for and possibly returns a neighbour belonging to this originator list467467+ * which is connected through the provided hard interface.468468+ * Returns NULL if the neighbour is not found.469469+ */470470+struct batadv_neigh_node *471471+batadv_neigh_node_get(const struct batadv_orig_node *orig_node,472472+ const struct batadv_hard_iface *hard_iface,473473+ const uint8_t *addr)474474+{475475+ struct batadv_neigh_node *tmp_neigh_node, *res = NULL;476476+477477+ rcu_read_lock();478478+ hlist_for_each_entry_rcu(tmp_neigh_node, &orig_node->neigh_list, list) {479479+ if (!batadv_compare_eth(tmp_neigh_node->addr, addr))480480+ continue;481481+482482+ if (tmp_neigh_node->if_incoming != hard_iface)483483+ continue;484484+485485+ if (!atomic_inc_not_zero(&tmp_neigh_node->refcount))486486+ continue;487487+488488+ res = tmp_neigh_node;489489+ break;490490+ }491491+ rcu_read_unlock();492492+493493+ return res;494494+}495495+496496+/**461497 * batadv_orig_ifinfo_free_rcu - free the orig_ifinfo object462498 * @rcu: rcu pointer of the orig_ifinfo object463499 */
···688688 int is_old_ttvn;689689690690 /* check if there is enough data before accessing it */691691- if (pskb_may_pull(skb, hdr_len + ETH_HLEN) < 0)691691+ if (!pskb_may_pull(skb, hdr_len + ETH_HLEN))692692 return 0;693693694694 /* create a copy of the skb (in case of for re-routing) to modify it. */···918918919919 if (ret != NET_RX_SUCCESS)920920 ret = batadv_route_unicast_packet(skb, recv_if);921921+ else922922+ consume_skb(skb);921923922924 return ret;923925}
+7-2
net/batman-adv/send.c
···254254 struct batadv_orig_node *orig_node,255255 unsigned short vid)256256{257257- struct ethhdr *ethhdr = (struct ethhdr *)skb->data;257257+ struct ethhdr *ethhdr;258258 struct batadv_unicast_packet *unicast_packet;259259- int ret = NET_XMIT_DROP;259259+ int ret = NET_XMIT_DROP, hdr_size;260260261261 if (!orig_node)262262 goto out;···265265 case BATADV_UNICAST:266266 if (!batadv_send_skb_prepare_unicast(skb, orig_node))267267 goto out;268268+269269+ hdr_size = sizeof(*unicast_packet);268270 break;269271 case BATADV_UNICAST_4ADDR:270272 if (!batadv_send_skb_prepare_unicast_4addr(bat_priv, skb,271273 orig_node,272274 packet_subtype))273275 goto out;276276+277277+ hdr_size = sizeof(struct batadv_unicast_4addr_packet);274278 break;275279 default:276280 /* this function supports UNICAST and UNICAST_4ADDR only. It···283279 goto out;284280 }285281282282+ ethhdr = (struct ethhdr *)(skb->data + hdr_size);286283 unicast_packet = (struct batadv_unicast_packet *)skb->data;287284288285 /* inform the destination node that we are still missing a correct route
+17-6
net/batman-adv/translation-table.c
···19751975 struct hlist_head *head;19761976 uint32_t i, crc_tmp, crc = 0;19771977 uint8_t flags;19781978+ __be16 tmp_vid;1978197919791980 for (i = 0; i < hash->size; i++) {19801981 head = &hash->table[i];···20122011 orig_node))20132012 continue;2014201320152015- crc_tmp = crc32c(0, &tt_common->vid,20162016- sizeof(tt_common->vid));20142014+ /* use network order to read the VID: this ensures that20152015+ * every node reads the bytes in the same order.20162016+ */20172017+ tmp_vid = htons(tt_common->vid);20182018+ crc_tmp = crc32c(0, &tmp_vid, sizeof(tmp_vid));2017201920182020 /* compute the CRC on flags that have to be kept in sync20192021 * among nodes···20502046 struct hlist_head *head;20512047 uint32_t i, crc_tmp, crc = 0;20522048 uint8_t flags;20492049+ __be16 tmp_vid;2053205020542051 for (i = 0; i < hash->size; i++) {20552052 head = &hash->table[i];···20692064 if (tt_common->flags & BATADV_TT_CLIENT_NEW)20702065 continue;2071206620722072- crc_tmp = crc32c(0, &tt_common->vid,20732073- sizeof(tt_common->vid));20672067+ /* use network order to read the VID: this ensures that20682068+ * every node reads the bytes in the same order.20692069+ */20702070+ tmp_vid = htons(tt_common->vid);20712071+ crc_tmp = crc32c(0, &tmp_vid, sizeof(tmp_vid));2074207220752073 /* compute the CRC on flags that have to be kept in sync20762074 * among nodes···22702262{22712263 struct batadv_tvlv_tt_vlan_data *tt_vlan_tmp;22722264 struct batadv_orig_node_vlan *vlan;22652265+ uint32_t crc;22732266 int i;2274226722752268 /* check if each received CRC matches the locally stored one */···22902281 if (!vlan)22912282 return false;2292228322932293- if (vlan->tt.crc != ntohl(tt_vlan_tmp->crc))22842284+ crc = vlan->tt.crc;22852285+ batadv_orig_node_vlan_free_ref(vlan);22862286+22872287+ if (crc != ntohl(tt_vlan_tmp->crc))22942288 return false;22952289 }22962290···3230321832313219 spin_lock_bh(&orig_node->tt_lock);3232322032333233- tt_change = (struct batadv_tvlv_tt_change *)tt_buff;32343221 batadv_tt_update_changes(bat_priv, orig_node, tt_num_changes,32353222 ttvn, tt_change);32363223
+14-2
net/bluetooth/hidp/core.c
···430430 del_timer(&session->timer);431431}432432433433+static void hidp_process_report(struct hidp_session *session,434434+ int type, const u8 *data, int len, int intr)435435+{436436+ if (len > HID_MAX_BUFFER_SIZE)437437+ len = HID_MAX_BUFFER_SIZE;438438+439439+ memcpy(session->input_buf, data, len);440440+ hid_input_report(session->hid, type, session->input_buf, len, intr);441441+}442442+433443static void hidp_process_handshake(struct hidp_session *session,434444 unsigned char param)435445{···512502 hidp_input_report(session, skb);513503514504 if (session->hid)515515- hid_input_report(session->hid, HID_INPUT_REPORT, skb->data, skb->len, 0);505505+ hidp_process_report(session, HID_INPUT_REPORT,506506+ skb->data, skb->len, 0);516507 break;517508518509 case HIDP_DATA_RTYPE_OTHER:···595584 hidp_input_report(session, skb);596585597586 if (session->hid) {598598- hid_input_report(session->hid, HID_INPUT_REPORT, skb->data, skb->len, 1);587587+ hidp_process_report(session, HID_INPUT_REPORT,588588+ skb->data, skb->len, 1);599589 BT_DBG("report len %d", skb->len);600590 }601591 } else {
+4
net/bluetooth/hidp/hidp.h
···2424#define __HIDP_H25252626#include <linux/types.h>2727+#include <linux/hid.h>2728#include <linux/kref.h>2829#include <net/bluetooth/bluetooth.h>2930#include <net/bluetooth/l2cap.h>···180179181180 /* Used in hidp_output_raw_report() */182181 int output_report_success; /* boolean */182182+183183+ /* temporary input buffer */184184+ u8 input_buf[HID_MAX_BUFFER_SIZE];183185};184186185187/* HIDP init defines */
+12-10
net/core/dev.c
···24202420 * 2. No high memory really exists on this machine.24212421 */2422242224232423-static int illegal_highdma(struct net_device *dev, struct sk_buff *skb)24232423+static int illegal_highdma(const struct net_device *dev, struct sk_buff *skb)24242424{24252425#ifdef CONFIG_HIGHMEM24262426 int i;···24952495}2496249624972497static netdev_features_t harmonize_features(struct sk_buff *skb,24982498- netdev_features_t features)24982498+ const struct net_device *dev,24992499+ netdev_features_t features)24992500{25002501 if (skb->ip_summed != CHECKSUM_NONE &&25012502 !can_checksum_protocol(features, skb_network_protocol(skb))) {25022503 features &= ~NETIF_F_ALL_CSUM;25032503- } else if (illegal_highdma(skb->dev, skb)) {25042504+ } else if (illegal_highdma(dev, skb)) {25042505 features &= ~NETIF_F_SG;25052506 }2506250725072508 return features;25082509}2509251025102510-netdev_features_t netif_skb_features(struct sk_buff *skb)25112511+netdev_features_t netif_skb_dev_features(struct sk_buff *skb,25122512+ const struct net_device *dev)25112513{25122514 __be16 protocol = skb->protocol;25132513- netdev_features_t features = skb->dev->features;25152515+ netdev_features_t features = dev->features;2514251625152515- if (skb_shinfo(skb)->gso_segs > skb->dev->gso_max_segs)25172517+ if (skb_shinfo(skb)->gso_segs > dev->gso_max_segs)25162518 features &= ~NETIF_F_GSO_MASK;2517251925182520 if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) {25192521 struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;25202522 protocol = veh->h_vlan_encapsulated_proto;25212523 } else if (!vlan_tx_tag_present(skb)) {25222522- return harmonize_features(skb, features);25242524+ return harmonize_features(skb, dev, features);25232525 }2524252625252525- features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_CTAG_TX |25272527+ features &= (dev->vlan_features | NETIF_F_HW_VLAN_CTAG_TX |25262528 NETIF_F_HW_VLAN_STAG_TX);2527252925282530 if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD))···25322530 NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_CTAG_TX |25332531 NETIF_F_HW_VLAN_STAG_TX;2534253225352535- return harmonize_features(skb, features);25332533+ return harmonize_features(skb, dev, features);25362534}25372537-EXPORT_SYMBOL(netif_skb_features);25352535+EXPORT_SYMBOL(netif_skb_dev_features);2538253625392537int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,25402538 struct netdev_queue *txq)
···1515 *1616 * ECN support is added by Naeem Khademi <naeemk@ifi.uio.no>1717 * University of Oslo, Norway.1818+ *1919+ * References:2020+ * IETF draft submission: http://tools.ietf.org/html/draft-pan-aqm-pie-002121+ * IEEE Conference on High Performance Switching and Routing 2013 :2222+ * "PIE: A * Lightweight Control Scheme to Address the Bufferbloat Problem"1823 */19242025#include <linux/module.h>···4136 psched_time_t target; /* user specified target delay in pschedtime */4237 u32 tupdate; /* timer frequency (in jiffies) */4338 u32 limit; /* number of packets that can be enqueued */4444- u32 alpha; /* alpha and beta are between -4 and 4 */3939+ u32 alpha; /* alpha and beta are between 0 and 32 */4540 u32 beta; /* and are used for shift relative to 1 */4641 bool ecn; /* true if ecn is enabled */4742 bool bytemode; /* to scale drop early prob based on pkt size */···331326 if (qdelay == 0 && qlen != 0)332327 update_prob = false;333328334334- /* Add ranges for alpha and beta, more aggressive for high dropping335335- * mode and gentle steps for light dropping mode336336- * In light dropping mode, take gentle steps; in medium dropping mode,337337- * take medium steps; in high dropping mode, take big steps.329329+ /* In the algorithm, alpha and beta are between 0 and 2 with typical330330+ * value for alpha as 0.125. In this implementation, we use values 0-32331331+ * passed from user space to represent this. Also, alpha and beta have332332+ * unit of HZ and need to be scaled before they can used to update333333+ * probability. alpha/beta are updated locally below by 1) scaling them334334+ * appropriately 2) scaling down by 16 to come to 0-2 range.335335+ * Please see paper for details.336336+ *337337+ * We scale alpha and beta differently depending on whether we are in338338+ * light, medium or high dropping mode.338339 */339340 if (q->vars.prob < MAX_PROB / 100) {340341 alpha =
+17-65
net/sctp/associola.c
···13671367 return false;13681368}1369136913701370-/* Increase asoc's rwnd by len and send any window update SACK if needed. */13711371-void sctp_assoc_rwnd_increase(struct sctp_association *asoc, unsigned int len)13701370+/* Update asoc's rwnd for the approximated state in the buffer,13711371+ * and check whether SACK needs to be sent.13721372+ */13731373+void sctp_assoc_rwnd_update(struct sctp_association *asoc, bool update_peer)13721374{13751375+ int rx_count;13731376 struct sctp_chunk *sack;13741377 struct timer_list *timer;1375137813761376- if (asoc->rwnd_over) {13771377- if (asoc->rwnd_over >= len) {13781378- asoc->rwnd_over -= len;13791379- } else {13801380- asoc->rwnd += (len - asoc->rwnd_over);13811381- asoc->rwnd_over = 0;13821382- }13831383- } else {13841384- asoc->rwnd += len;13851385- }13791379+ if (asoc->ep->rcvbuf_policy)13801380+ rx_count = atomic_read(&asoc->rmem_alloc);13811381+ else13821382+ rx_count = atomic_read(&asoc->base.sk->sk_rmem_alloc);1386138313871387- /* If we had window pressure, start recovering it13881388- * once our rwnd had reached the accumulated pressure13891389- * threshold. The idea is to recover slowly, but up13901390- * to the initial advertised window.13911391- */13921392- if (asoc->rwnd_press && asoc->rwnd >= asoc->rwnd_press) {13931393- int change = min(asoc->pathmtu, asoc->rwnd_press);13941394- asoc->rwnd += change;13951395- asoc->rwnd_press -= change;13961396- }13841384+ if ((asoc->base.sk->sk_rcvbuf - rx_count) > 0)13851385+ asoc->rwnd = (asoc->base.sk->sk_rcvbuf - rx_count) >> 1;13861386+ else13871387+ asoc->rwnd = 0;1397138813981398- pr_debug("%s: asoc:%p rwnd increased by %d to (%u, %u) - %u\n",13991399- __func__, asoc, len, asoc->rwnd, asoc->rwnd_over,14001400- asoc->a_rwnd);13891389+ pr_debug("%s: asoc:%p rwnd=%u, rx_count=%d, sk_rcvbuf=%d\n",13901390+ __func__, asoc, asoc->rwnd, rx_count,13911391+ asoc->base.sk->sk_rcvbuf);1401139214021393 /* Send a window update SACK if the rwnd has increased by at least the14031394 * minimum of the association's PMTU and half of the receive buffer.14041395 * The algorithm used is similar to the one described in14051396 * Section 4.2.3.3 of RFC 1122.14061397 */14071407- if (sctp_peer_needs_update(asoc)) {13981398+ if (update_peer && sctp_peer_needs_update(asoc)) {14081399 asoc->a_rwnd = asoc->rwnd;1409140014101401 pr_debug("%s: sending window update SACK- asoc:%p rwnd:%u "···14171426 }14181427}1419142814201420-/* Decrease asoc's rwnd by len. */14211421-void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned int len)14221422-{14231423- int rx_count;14241424- int over = 0;14251425-14261426- if (unlikely(!asoc->rwnd || asoc->rwnd_over))14271427- pr_debug("%s: association:%p has asoc->rwnd:%u, "14281428- "asoc->rwnd_over:%u!\n", __func__, asoc,14291429- asoc->rwnd, asoc->rwnd_over);14301430-14311431- if (asoc->ep->rcvbuf_policy)14321432- rx_count = atomic_read(&asoc->rmem_alloc);14331433- else14341434- rx_count = atomic_read(&asoc->base.sk->sk_rmem_alloc);14351435-14361436- /* If we've reached or overflowed our receive buffer, announce14371437- * a 0 rwnd if rwnd would still be positive. Store the14381438- * the potential pressure overflow so that the window can be restored14391439- * back to original value.14401440- */14411441- if (rx_count >= asoc->base.sk->sk_rcvbuf)14421442- over = 1;14431443-14441444- if (asoc->rwnd >= len) {14451445- asoc->rwnd -= len;14461446- if (over) {14471447- asoc->rwnd_press += asoc->rwnd;14481448- asoc->rwnd = 0;14491449- }14501450- } else {14511451- asoc->rwnd_over = len - asoc->rwnd;14521452- asoc->rwnd = 0;14531453- }14541454-14551455- pr_debug("%s: asoc:%p rwnd decreased by %d to (%u, %u, %u)\n",14561456- __func__, asoc, len, asoc->rwnd, asoc->rwnd_over,14571457- asoc->rwnd_press);14581458-}1459142914601430/* Build the bind address list for the association based on info from the14611431 * local endpoint and the remote peer.
+1-1
net/sctp/sm_statefuns.c
···61766176 * PMTU. In cases, such as loopback, this might be a rather61776177 * large spill over.61786178 */61796179- if ((!chunk->data_accepted) && (!asoc->rwnd || asoc->rwnd_over ||61796179+ if ((!chunk->data_accepted) && (!asoc->rwnd ||61806180 (datalen > asoc->rwnd + asoc->frag_point))) {6181618161826182 /* If this is the next TSN, consider reneging to make
+32-15
net/sctp/socket.c
···6464#include <linux/crypto.h>6565#include <linux/slab.h>6666#include <linux/file.h>6767+#include <linux/compat.h>67686869#include <net/ip.h>6970#include <net/icmp.h>···13691368/*13701369 * New (hopefully final) interface for the API.13711370 * We use the sctp_getaddrs_old structure so that use-space library13721372- * can avoid any unnecessary allocations. The only defferent part13711371+ * can avoid any unnecessary allocations. The only different part13731372 * is that we store the actual length of the address buffer into the13741374- * addrs_num structure member. That way we can re-use the existing13731373+ * addrs_num structure member. That way we can re-use the existing13751374 * code.13761375 */13761376+#ifdef CONFIG_COMPAT13771377+struct compat_sctp_getaddrs_old {13781378+ sctp_assoc_t assoc_id;13791379+ s32 addr_num;13801380+ compat_uptr_t addrs; /* struct sockaddr * */13811381+};13821382+#endif13831383+13771384static int sctp_getsockopt_connectx3(struct sock *sk, int len,13781385 char __user *optval,13791386 int __user *optlen)···13901381 sctp_assoc_t assoc_id = 0;13911382 int err = 0;1392138313931393- if (len < sizeof(param))13941394- return -EINVAL;13841384+#ifdef CONFIG_COMPAT13851385+ if (is_compat_task()) {13861386+ struct compat_sctp_getaddrs_old param32;1395138713961396- if (copy_from_user(¶m, optval, sizeof(param)))13971397- return -EFAULT;13881388+ if (len < sizeof(param32))13891389+ return -EINVAL;13901390+ if (copy_from_user(¶m32, optval, sizeof(param32)))13911391+ return -EFAULT;1398139213991399- err = __sctp_setsockopt_connectx(sk,14001400- (struct sockaddr __user *)param.addrs,14011401- param.addr_num, &assoc_id);13931393+ param.assoc_id = param32.assoc_id;13941394+ param.addr_num = param32.addr_num;13951395+ param.addrs = compat_ptr(param32.addrs);13961396+ } else13971397+#endif13981398+ {13991399+ if (len < sizeof(param))14001400+ return -EINVAL;14011401+ if (copy_from_user(¶m, optval, sizeof(param)))14021402+ return -EFAULT;14031403+ }1402140414051405+ err = __sctp_setsockopt_connectx(sk, (struct sockaddr __user *)14061406+ param.addrs, param.addr_num,14071407+ &assoc_id);14031408 if (err == 0 || err == -EINPROGRESS) {14041409 if (copy_to_user(optval, &assoc_id, sizeof(assoc_id)))14051410 return -EFAULT;···21152092 sctp_skb_pull(skb, copied);21162093 skb_queue_head(&sk->sk_receive_queue, skb);2117209421182118- /* When only partial message is copied to the user, increase21192119- * rwnd by that amount. If all the data in the skb is read,21202120- * rwnd is updated when the event is freed.21212121- */21222122- if (!sctp_ulpevent_is_notification(event))21232123- sctp_assoc_rwnd_increase(event->asoc, copied);21242095 goto out;21252096 } else if ((event->msg_flags & MSG_NOTIFICATION) ||21262097 (event->msg_flags & MSG_EOR))
+11-7
net/sctp/sysctl.c
···151151 },152152 {153153 .procname = "cookie_hmac_alg",154154+ .data = &init_net.sctp.sctp_hmac_alg,154155 .maxlen = 8,155156 .mode = 0644,156157 .proc_handler = proc_sctp_do_hmac_alg,···402401403402int sctp_sysctl_net_register(struct net *net)404403{405405- struct ctl_table *table;406406- int i;404404+ struct ctl_table *table = sctp_net_table;407405408408- table = kmemdup(sctp_net_table, sizeof(sctp_net_table), GFP_KERNEL);409409- if (!table)410410- return -ENOMEM;406406+ if (!net_eq(net, &init_net)) {407407+ int i;411408412412- for (i = 0; table[i].data; i++)413413- table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp;409409+ table = kmemdup(sctp_net_table, sizeof(sctp_net_table), GFP_KERNEL);410410+ if (!table)411411+ return -ENOMEM;412412+413413+ for (i = 0; table[i].data; i++)414414+ table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp;415415+ }414416415417 net->sctp.sysctl_header = register_net_sysctl(net, "net/sctp", table);416418 return 0;
+6-2
net/sctp/ulpevent.c
···989989 skb = sctp_event2skb(event);990990 /* Set the owner and charge rwnd for bytes received. */991991 sctp_ulpevent_set_owner(event, asoc);992992- sctp_assoc_rwnd_decrease(asoc, skb_headlen(skb));992992+ sctp_assoc_rwnd_update(asoc, false);993993994994 if (!skb->data_len)995995 return;···10111011{10121012 struct sk_buff *skb, *frag;10131013 unsigned int len;10141014+ struct sctp_association *asoc;1014101510151016 /* Current stack structures assume that the rcv buffer is10161017 * per socket. For UDP style sockets this is not true as···10361035 }1037103610381037done:10391039- sctp_assoc_rwnd_increase(event->asoc, len);10381038+ asoc = event->asoc;10391039+ sctp_association_hold(asoc);10401040 sctp_ulpevent_release_owner(event);10411041+ sctp_assoc_rwnd_update(asoc, true);10421042+ sctp_association_put(asoc);10411043}1042104410431045static void sctp_ulpevent_release_frag_data(struct sctp_ulpevent *event)
···13911391 u32 hdr_size;13921392 u32 min_hdr_size;1393139313941394+ /* If this packet comes from the defer queue, the skb has already13951395+ * been validated13961396+ */13971397+ if (unlikely(TIPC_SKB_CB(buf)->deferred))13981398+ return 1;13991399+13941400 if (unlikely(buf->len < MIN_H_SIZE))13951401 return 0;13961402···17091703 &l_ptr->newest_deferred_in, buf)) {17101704 l_ptr->deferred_inqueue_sz++;17111705 l_ptr->stats.deferred_recv++;17061706+ TIPC_SKB_CB(buf)->deferred = true;17121707 if ((l_ptr->deferred_inqueue_sz % 16) == 1)17131708 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 0, 0, 0, 0, 0);17141709 } else
+1
scripts/Makefile.lib
···152152dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \153153 -I$(srctree)/arch/$(SRCARCH)/boot/dts \154154 -I$(srctree)/arch/$(SRCARCH)/boot/dts/include \155155+ -I$(srctree)/drivers/of/testcase-data \155156 -undef -D__DTS__156157157158# Finds the multi-part object the current object will be linked into
···11111212config SND_BF5XX_SOC_SSM26021313 tristate "SoC SSM2602 Audio Codec Add-On Card support"1414- depends on SND_BF5XX_I2S && (SPI_MASTER || I2C)1414+ depends on SND_BF5XX_I2S && SND_SOC_I2C_AND_SPI1515 select SND_BF5XX_SOC_I2S if !BF60x1616 select SND_BF6XX_SOC_I2S if BF60x1717 select SND_SOC_SSM2602···21212222config SND_SOC_BFIN_EVAL_ADAU17012323 tristate "Support for the EVAL-ADAU1701MINIZ board on Blackfin eval boards"2424- depends on SND_BF5XX_I2S2424+ depends on SND_BF5XX_I2S && I2C2525 select SND_BF5XX_SOC_I2S2626 select SND_SOC_ADAU17012727- select I2C2827 help2928 Say Y if you want to add support for the Analog Devices EVAL-ADAU1701MINIZ3029 board connected to one of the Blackfin evaluation boards like the···44454546config SND_SOC_BFIN_EVAL_ADAV80X4647 tristate "Support for the EVAL-ADAV80X boards on Blackfin eval boards"4747- depends on SND_BF5XX_I2S && (SPI_MASTER || I2C)4848+ depends on SND_BF5XX_I2S && SND_SOC_I2C_AND_SPI4849 select SND_BF5XX_SOC_I2S4950 select SND_SOC_ADAV80X5051 help···57585859config SND_BF5XX_SOC_AD18365960 tristate "SoC AD1836 Audio support for BF5xx"6060- depends on SND_BF5XX_I2S6161+ depends on SND_BF5XX_I2S && SPI_MASTER6162 select SND_BF5XX_SOC_I2S6263 select SND_SOC_AD18366364 help···65666667config SND_BF5XX_SOC_AD193X6768 tristate "SoC AD193X Audio support for Blackfin"6868- depends on SND_BF5XX_I2S6969+ depends on SND_BF5XX_I2S && SND_SOC_I2C_AND_SPI6970 select SND_BF5XX_SOC_I2S7071 select SND_SOC_AD193X7172 help
+9-2
sound/soc/codecs/da9055.c
···15231523 return 0;15241524}1525152515261526+/*15271527+ * DO NOT change the device Ids. The naming is intentionally specific as both15281528+ * the CODEC and PMIC parts of this chip are instantiated separately as I2C15291529+ * devices (both have configurable I2C addresses, and are to all intents and15301530+ * purposes separate). As a result there are specific DA9055 Ids for CODEC15311531+ * and PMIC, which must be different to operate together.15321532+ */15261533static const struct i2c_device_id da9055_i2c_id[] = {15271527- { "da9055", 0 },15341534+ { "da9055-codec", 0 },15281535 { }15291536};15301537MODULE_DEVICE_TABLE(i2c, da9055_i2c_id);···15391532/* I2C codec control layer */15401533static struct i2c_driver da9055_i2c_driver = {15411534 .driver = {15421542- .name = "da9055",15351535+ .name = "da9055-codec",15431536 .owner = THIS_MODULE,15441537 },15451538 .probe = da9055_i2c_probe,
+11-10
sound/soc/codecs/max98090.c
···336336 case M98090_REG_RECORD_TDM_SLOT:337337 case M98090_REG_SAMPLE_RATE:338338 case M98090_REG_DMIC34_BIQUAD_BASE ... M98090_REG_DMIC34_BIQUAD_BASE + 0x0E:339339+ case M98090_REG_REVISION_ID:339340 return true;340341 default:341342 return false;···1770176917711770 switch (level) {17721771 case SND_SOC_BIAS_ON:17731773- if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {17741774- ret = regcache_sync(max98090->regmap);17751775-17761776- if (ret != 0) {17771777- dev_err(codec->dev,17781778- "Failed to sync cache: %d\n", ret);17791779- return ret;17801780- }17811781- }17821782-17831772 if (max98090->jack_state == M98090_JACK_STATE_HEADSET) {17841773 /*17851774 * Set to normal bias level.···17831792 break;1784179317851794 case SND_SOC_BIAS_STANDBY:17951795+ if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {17961796+ ret = regcache_sync(max98090->regmap);17971797+ if (ret != 0) {17981798+ dev_err(codec->dev,17991799+ "Failed to sync cache: %d\n", ret);18001800+ return ret;18011801+ }18021802+ }18031803+ break;18041804+17861805 case SND_SOC_BIAS_OFF:17871806 /* Set internal pull-up to lowest power mode */17881807 snd_soc_update_bits(codec, M98090_REG_JACK_DETECT,
···5959 select SND_SOC_WM87506060 select SND_S3C2412_SOC_I2S6161 help6262- Sat Y if you want to add support for SoC audio on the Jive.6262+ Say Y if you want to add support for SoC audio on the Jive.63636464config SND_SOC_SAMSUNG_SMDK_WM85806565 tristate "SoC I2S Audio support for WM8580 on SMDK"···145145146146config SND_SOC_SAMSUNG_SMDK_WM9713147147 tristate "SoC AC97 Audio support for SMDK with WM9713"148148- depends on SND_SOC_SAMSUNG && (MACH_SMDK6410 || MACH_SMDKC100 || MACH_SMDKV210 || MACH_SMDKC110 || MACH_SMDKV310 || MACH_SMDKC210)148148+ depends on SND_SOC_SAMSUNG && (MACH_SMDK6410 || MACH_SMDKC100 || MACH_SMDKV210 || MACH_SMDKC110)149149 select SND_SOC_WM9713150150 select SND_SAMSUNG_AC97151151 help152152- Sat Y if you want to add support for SoC audio on the SMDK.152152+ Say Y if you want to add support for SoC audio on the SMDK.153153154154config SND_SOC_SMARTQ155155 tristate "SoC I2S Audio support for SmartQ board"
+5-3
sound/soc/txx9/txx9aclc-ac97.c
···183183 irq = platform_get_irq(pdev, 0);184184 if (irq < 0)185185 return irq;186186+187187+ drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);188188+ if (!drvdata)189189+ return -ENOMEM;190190+186191 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);187192 drvdata->base = devm_ioremap_resource(&pdev->dev, r);188193 if (IS_ERR(drvdata->base))189194 return PTR_ERR(drvdata->base);190195191191- drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);192192- if (!drvdata)193193- return -ENOMEM;194196 platform_set_drvdata(pdev, drvdata);195197 drvdata->physbase = r->start;196198 if (sizeof(drvdata->physbase) > sizeof(r->start) &&
+9
sound/usb/mixer_maps.c
···328328 {}329329};330330331331+static const struct usbmix_name_map kef_x300a_map[] = {332332+ { 10, NULL }, /* firmware locks up (?) when we try to access this FU */333333+ { 0 }334334+};335335+331336/*332337 * Control map entries333338 */···423418 {424419 .id = USB_ID(0x200c, 0x1018),425420 .map = ebox44_map,421421+ },422422+ {423423+ .id = USB_ID(0x27ac, 0x1000),424424+ .map = kef_x300a_map,426425 },427426 { 0 } /* terminator */428427};
+22
tools/perf/builtin-trace.c
···3737# define MADV_UNMERGEABLE 133838#endif39394040+#ifndef EFD_SEMAPHORE4141+# define EFD_SEMAPHORE 14242+#endif4343+4044struct tp_field {4145 int offset;4246 union {···283279284280#define SCA_STRARRAY syscall_arg__scnprintf_strarray285281282282+#if defined(__i386__) || defined(__x86_64__)283283+/*284284+ * FIXME: Make this available to all arches as soon as the ioctl beautifier285285+ * gets rewritten to support all arches.286286+ */286287static size_t syscall_arg__scnprintf_strhexarray(char *bf, size_t size,287288 struct syscall_arg *arg)288289{···295286}296287297288#define SCA_STRHEXARRAY syscall_arg__scnprintf_strhexarray289289+#endif /* defined(__i386__) || defined(__x86_64__) */298290299291static size_t syscall_arg__scnprintf_fd(char *bf, size_t size,300292 struct syscall_arg *arg);···849839850840#define SCA_SIGNUM syscall_arg__scnprintf_signum851841842842+#if defined(__i386__) || defined(__x86_64__)843843+/*844844+ * FIXME: Make this available to all arches.845845+ */852846#define TCGETS 0x5401853847854848static const char *tioctls[] = {···874860};875861876862static DEFINE_STRARRAY_OFFSET(tioctls, 0x5401);863863+#endif /* defined(__i386__) || defined(__x86_64__) */877864878865#define STRARRAY(arg, name, array) \879866 .arg_scnprintf = { [arg] = SCA_STRARRAY, }, \···956941 { .name = "getrlimit", .errmsg = true, STRARRAY(0, resource, rlimit_resources), },957942 { .name = "ioctl", .errmsg = true,958943 .arg_scnprintf = { [0] = SCA_FD, /* fd */ 944944+#if defined(__i386__) || defined(__x86_64__)945945+/*946946+ * FIXME: Make this available to all arches.947947+ */959948 [1] = SCA_STRHEXARRAY, /* cmd */960949 [2] = SCA_HEX, /* arg */ },961950 .arg_parm = { [1] = &strarray__tioctls, /* cmd */ }, },951951+#else952952+ [2] = SCA_HEX, /* arg */ }, },953953+#endif962954 { .name = "kill", .errmsg = true,963955 .arg_scnprintf = { [1] = SCA_SIGNUM, /* sig */ }, },964956 { .name = "linkat", .errmsg = true,
+15-2
tools/perf/util/parse-events.c
···10911091static bool is_event_supported(u8 type, unsigned config)10921092{10931093 bool ret = true;10941094+ int open_return;10941095 struct perf_evsel *evsel;10951096 struct perf_event_attr attr = {10961097 .type = type,10971098 .config = config,10981099 .disabled = 1,10991099- .exclude_kernel = 1,11001100 };11011101 struct {11021102 struct thread_map map;···1108110811091109 evsel = perf_evsel__new(&attr);11101110 if (evsel) {11111111- ret = perf_evsel__open(evsel, NULL, &tmap.map) >= 0;11111111+ open_return = perf_evsel__open(evsel, NULL, &tmap.map);11121112+ ret = open_return >= 0;11131113+11141114+ if (open_return == -EACCES) {11151115+ /*11161116+ * This happens if the paranoid value11171117+ * /proc/sys/kernel/perf_event_paranoid is set to 211181118+ * Re-run with exclude_kernel set; we don't do that11191119+ * by default as some ARM machines do not support it.11201120+ *11211121+ */11221122+ evsel->attr.exclude_kernel = 1;11231123+ ret = perf_evsel__open(evsel, NULL, &tmap.map) >= 0;11241124+ }11121125 perf_evsel__delete(evsel);11131126 }11141127
+1-1
tools/perf/util/probe-event.c
···336336 return ret;337337338338 for (i = 0; i < ntevs && ret >= 0; i++) {339339+ /* point.address is the addres of point.symbol + point.offset */339340 offset = tevs[i].point.address - stext;340340- offset += tevs[i].point.offset;341341 tevs[i].point.offset = 0;342342 zfree(&tevs[i].point.symbol);343343 ret = e_snprintf(buf, 32, "0x%lx", offset);
+6
tools/perf/util/session.c
···10081008 if (err == 0)10091009 perf_session__set_id_hdr_size(session);10101010 return err;10111011+ case PERF_RECORD_HEADER_EVENT_TYPE:10121012+ /*10131013+ * Depreceated, but we need to handle it for sake10141014+ * of old data files create in pipe mode.10151015+ */10161016+ return 0;10111017 case PERF_RECORD_HEADER_TRACING_DATA:10121018 /* setup for reading amidst mmap */10131019 lseek(fd, file_offset, SEEK_SET);