Merge tag 'configfs-for-5.2-2' of git://git.infradead.org/users/hch/configfs
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 31 May 2019 03:35:48 +0000 (20:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 31 May 2019 03:35:48 +0000 (20:35 -0700)
Pull configs fix from Christoph Hellwig:

 - fix a use after free in configfs_d_iput (Sahitya Tummala)

* tag 'configfs-for-5.2-2' of git://git.infradead.org/users/hch/configfs:
  configfs: Fix use-after-free when accessing sd->s_dentry

30 files changed:
Documentation/admin-guide/mm/index.rst
Documentation/admin-guide/mm/numaperf.rst
Documentation/conf.py
Documentation/firmware-guide/acpi/enumeration.rst
Documentation/sphinx/kerneldoc.py
Documentation/sphinx/kernellog.py [new file with mode: 0644]
Documentation/sphinx/kfigure.py
arch/ia64/mm/numa.c
drivers/clk/imx/clk-imx8mm.c
drivers/clk/sifive/Kconfig
drivers/clk/ti/clkctrl.c
drivers/gpio/Kconfig
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_workarounds.c
drivers/pinctrl/Kconfig
drivers/pinctrl/intel/pinctrl-intel.c
kernel/trace/trace_events_filter.c
lib/list_sort.c
scripts/sphinx-pre-install
sound/firewire/fireface/ff-protocol-latter.c
sound/pci/hda/hda_intel.c
sound/pci/hda/patch_realtek.c
sound/usb/line6/driver.c
sound/usb/line6/driver.h
sound/usb/line6/toneport.c
tools/testing/selftests/ftrace/ftracetest
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc
tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc [new file with mode: 0644]
tools/testing/selftests/kselftest_harness.h
tools/testing/selftests/rtc/rtctest.c

index 8edb35f..ddf8d8d 100644 (file)
@@ -31,6 +31,7 @@ the Linux memory management.
    ksm
    memory-hotplug
    numa_memory_policy
+   numaperf
    pagemap
    soft-dirty
    transhuge
index b79f70c..c067ed1 100644 (file)
@@ -15,7 +15,7 @@ characteristics.  Some memory may share the same node as a CPU, and others
 are provided as memory only nodes. While memory only nodes do not provide
 CPUs, they may still be local to one or more compute nodes relative to
 other nodes. The following diagram shows one such example of two compute
-nodes with local memory and a memory only node for each of compute node:
+nodes with local memory and a memory only node for each of compute node::
 
  +------------------+     +------------------+
  | Compute Node 0   +-----+ Compute Node 1   |
index 72647a3..7ace3f8 100644 (file)
@@ -37,7 +37,7 @@ needs_sphinx = '1.3'
 extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain', 'kfigure', 'sphinx.ext.ifconfig']
 
 # The name of the math extension changed on Sphinx 1.4
-if major == 1 and minor > 3:
+if (major == 1 and minor > 3) or (major > 1):
     extensions.append("sphinx.ext.imgmath")
 else:
     extensions.append("sphinx.ext.pngmath")
index 6b32b7b..850be96 100644 (file)
@@ -423,7 +423,7 @@ will be enumerated to depends on the device ID returned by _HID.
 
 For example, the following ACPI sample might be used to enumerate an lm75-type
 I2C temperature sensor and match it to the driver using the Device Tree
-namespace link:
+namespace link::
 
        Device (TMP0)
        {
index 9d0a7f0..1159405 100644 (file)
@@ -37,7 +37,19 @@ import glob
 from docutils import nodes, statemachine
 from docutils.statemachine import ViewList
 from docutils.parsers.rst import directives, Directive
-from sphinx.ext.autodoc import AutodocReporter
+
+#
+# AutodocReporter is only good up to Sphinx 1.7
+#
+import sphinx
+
+Use_SSI = sphinx.__version__[:3] >= '1.7'
+if Use_SSI:
+    from sphinx.util.docutils import switch_source_input
+else:
+    from sphinx.ext.autodoc import AutodocReporter
+
+import kernellog
 
 __version__  = '1.0'
 
@@ -90,7 +102,8 @@ class KernelDocDirective(Directive):
         cmd += [filename]
 
         try:
-            env.app.verbose('calling kernel-doc \'%s\'' % (" ".join(cmd)))
+            kernellog.verbose(env.app,
+                              'calling kernel-doc \'%s\'' % (" ".join(cmd)))
 
             p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
             out, err = p.communicate()
@@ -100,7 +113,8 @@ class KernelDocDirective(Directive):
             if p.returncode != 0:
                 sys.stderr.write(err)
 
-                env.app.warn('kernel-doc \'%s\' failed with return code %d' % (" ".join(cmd), p.returncode))
+                kernellog.warn(env.app,
+                               'kernel-doc \'%s\' failed with return code %d' % (" ".join(cmd), p.returncode))
                 return [nodes.error(None, nodes.paragraph(text = "kernel-doc missing"))]
             elif env.config.kerneldoc_verbosity > 0:
                 sys.stderr.write(err)
@@ -121,20 +135,28 @@ class KernelDocDirective(Directive):
                     lineoffset += 1
 
             node = nodes.section()
-            buf = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter
+            self.do_parse(result, node)
+
+            return node.children
+
+        except Exception as e:  # pylint: disable=W0703
+            kernellog.warn(env.app, 'kernel-doc \'%s\' processing failed with: %s' %
+                           (" ".join(cmd), str(e)))
+            return [nodes.error(None, nodes.paragraph(text = "kernel-doc missing"))]
+
+    def do_parse(self, result, node):
+        if Use_SSI:
+            with switch_source_input(self.state, result):
+                self.state.nested_parse(result, 0, node, match_titles=1)
+        else:
+            save = self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter
             self.state.memo.reporter = AutodocReporter(result, self.state.memo.reporter)
             self.state.memo.title_styles, self.state.memo.section_level = [], 0
             try:
                 self.state.nested_parse(result, 0, node, match_titles=1)
             finally:
-                self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = buf
+                self.state.memo.title_styles, self.state.memo.section_level, self.state.memo.reporter = save
 
-            return node.children
-
-        except Exception as e:  # pylint: disable=W0703
-            env.app.warn('kernel-doc \'%s\' processing failed with: %s' %
-                         (" ".join(cmd), str(e)))
-            return [nodes.error(None, nodes.paragraph(text = "kernel-doc missing"))]
 
 def setup(app):
     app.add_config_value('kerneldoc_bin', None, 'env')
diff --git a/Documentation/sphinx/kernellog.py b/Documentation/sphinx/kernellog.py
new file mode 100644 (file)
index 0000000..af924f5
--- /dev/null
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Sphinx has deprecated its older logging interface, but the replacement
+# only goes back to 1.6.  So here's a wrapper layer to keep around for
+# as long as we support 1.4.
+#
+import sphinx
+
+if sphinx.__version__[:3] >= '1.6':
+    UseLogging = True
+    from sphinx.util import logging
+    logger = logging.getLogger('kerneldoc')
+else:
+    UseLogging = False
+
+def warn(app, message):
+    if UseLogging:
+        logger.warning(message)
+    else:
+        app.warn(message)
+
+def verbose(app, message):
+    if UseLogging:
+        logger.verbose(message)
+    else:
+        app.verbose(message)
+
+
index b97228d..fbfe669 100644 (file)
@@ -60,6 +60,8 @@ import sphinx
 from sphinx.util.nodes import clean_astext
 from six import iteritems
 
+import kernellog
+
 PY3 = sys.version_info[0] == 3
 
 if PY3:
@@ -171,20 +173,20 @@ def setupTools(app):
     This function is called once, when the builder is initiated.
     """
     global dot_cmd, convert_cmd   # pylint: disable=W0603
-    app.verbose("kfigure: check installed tools ...")
+    kernellog.verbose(app, "kfigure: check installed tools ...")
 
     dot_cmd = which('dot')
     convert_cmd = which('convert')
 
     if dot_cmd:
-        app.verbose("use dot(1) from: " + dot_cmd)
+        kernellog.verbose(app, "use dot(1) from: " + dot_cmd)
     else:
-        app.warn("dot(1) not found, for better output quality install "
-                 "graphviz from http://www.graphviz.org")
+        kernellog.warn(app, "dot(1) not found, for better output quality install "
+                       "graphviz from http://www.graphviz.org")
     if convert_cmd:
-        app.verbose("use convert(1) from: " + convert_cmd)
+        kernellog.verbose(app, "use convert(1) from: " + convert_cmd)
     else:
-        app.warn(
+        kernellog.warn(app,
             "convert(1) not found, for SVG to PDF conversion install "
             "ImageMagick (https://www.imagemagick.org)")
 
@@ -220,12 +222,13 @@ def convert_image(img_node, translator, src_fname=None):
 
     # in kernel builds, use 'make SPHINXOPTS=-v' to see verbose messages
 
-    app.verbose('assert best format for: ' + img_node['uri'])
+    kernellog.verbose(app, 'assert best format for: ' + img_node['uri'])
 
     if in_ext == '.dot':
 
         if not dot_cmd:
-            app.verbose("dot from graphviz not available / include DOT raw.")
+            kernellog.verbose(app,
+                              "dot from graphviz not available / include DOT raw.")
             img_node.replace_self(file2literal(src_fname))
 
         elif translator.builder.format == 'latex':
@@ -252,7 +255,8 @@ def convert_image(img_node, translator, src_fname=None):
 
         if translator.builder.format == 'latex':
             if convert_cmd is None:
-                app.verbose("no SVG to PDF conversion available / include SVG raw.")
+                kernellog.verbose(app,
+                                  "no SVG to PDF conversion available / include SVG raw.")
                 img_node.replace_self(file2literal(src_fname))
             else:
                 dst_fname = path.join(translator.builder.outdir, fname + '.pdf')
@@ -265,18 +269,19 @@ def convert_image(img_node, translator, src_fname=None):
         _name = dst_fname[len(translator.builder.outdir) + 1:]
 
         if isNewer(dst_fname, src_fname):
-            app.verbose("convert: {out}/%s already exists and is newer" % _name)
+            kernellog.verbose(app,
+                              "convert: {out}/%s already exists and is newer" % _name)
 
         else:
             ok = False
             mkdir(path.dirname(dst_fname))
 
             if in_ext == '.dot':
-                app.verbose('convert DOT to: {out}/' + _name)
+                kernellog.verbose(app, 'convert DOT to: {out}/' + _name)
                 ok = dot2format(app, src_fname, dst_fname)
 
             elif in_ext == '.svg':
-                app.verbose('convert SVG to: {out}/' + _name)
+                kernellog.verbose(app, 'convert SVG to: {out}/' + _name)
                 ok = svg2pdf(app, src_fname, dst_fname)
 
             if not ok:
@@ -305,7 +310,8 @@ def dot2format(app, dot_fname, out_fname):
     with open(out_fname, "w") as out:
         exit_code = subprocess.call(cmd, stdout = out)
         if exit_code != 0:
-            app.warn("Error #%d when calling: %s" % (exit_code, " ".join(cmd)))
+            kernellog.warn(app,
+                          "Error #%d when calling: %s" % (exit_code, " ".join(cmd)))
     return bool(exit_code == 0)
 
 def svg2pdf(app, svg_fname, pdf_fname):
@@ -322,7 +328,7 @@ def svg2pdf(app, svg_fname, pdf_fname):
     # use stdout and stderr from parent
     exit_code = subprocess.call(cmd)
     if exit_code != 0:
-        app.warn("Error #%d when calling: %s" % (exit_code, " ".join(cmd)))
+        kernellog.warn(app, "Error #%d when calling: %s" % (exit_code, " ".join(cmd)))
     return bool(exit_code == 0)
 
 
@@ -415,15 +421,15 @@ def visit_kernel_render(self, node):
     app = self.builder.app
     srclang = node.get('srclang')
 
-    app.verbose('visit kernel-render node lang: "%s"' % (srclang))
+    kernellog.verbose(app, 'visit kernel-render node lang: "%s"' % (srclang))
 
     tmp_ext = RENDER_MARKUP_EXT.get(srclang, None)
     if tmp_ext is None:
-        app.warn('kernel-render: "%s" unknown / include raw.' % (srclang))
+        kernellog.warn(app, 'kernel-render: "%s" unknown / include raw.' % (srclang))
         return
 
     if not dot_cmd and tmp_ext == '.dot':
-        app.verbose("dot from graphviz not available / include raw.")
+        kernellog.verbose(app, "dot from graphviz not available / include raw.")
         return
 
     literal_block = node[0]
index a038035..5e1015e 100644 (file)
@@ -55,6 +55,7 @@ paddr_to_nid(unsigned long paddr)
 
        return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0);
 }
+EXPORT_SYMBOL(paddr_to_nid);
 
 #if defined(CONFIG_SPARSEMEM) && defined(CONFIG_NUMA)
 /*
index 1ef8438..122a81a 100644 (file)
@@ -449,12 +449,12 @@ static int __init imx8mm_clocks_init(struct device_node *ccm_node)
        clks[IMX8MM_AUDIO_PLL2_OUT] = imx_clk_gate("audio_pll2_out", "audio_pll2_bypass", base + 0x14, 13);
        clks[IMX8MM_VIDEO_PLL1_OUT] = imx_clk_gate("video_pll1_out", "video_pll1_bypass", base + 0x28, 13);
        clks[IMX8MM_DRAM_PLL_OUT] = imx_clk_gate("dram_pll_out", "dram_pll_bypass", base + 0x50, 13);
-       clks[IMX8MM_GPU_PLL_OUT] = imx_clk_gate("gpu_pll_out", "gpu_pll_bypass", base + 0x64, 13);
-       clks[IMX8MM_VPU_PLL_OUT] = imx_clk_gate("vpu_pll_out", "vpu_pll_bypass", base + 0x74, 13);
-       clks[IMX8MM_ARM_PLL_OUT] = imx_clk_gate("arm_pll_out", "arm_pll_bypass", base + 0x84, 13);
-       clks[IMX8MM_SYS_PLL1_OUT] = imx_clk_gate("sys_pll1_out", "sys_pll1_bypass", base + 0x94, 13);
-       clks[IMX8MM_SYS_PLL2_OUT] = imx_clk_gate("sys_pll2_out", "sys_pll2_bypass", base + 0x104, 13);
-       clks[IMX8MM_SYS_PLL3_OUT] = imx_clk_gate("sys_pll3_out", "sys_pll3_bypass", base + 0x114, 13);
+       clks[IMX8MM_GPU_PLL_OUT] = imx_clk_gate("gpu_pll_out", "gpu_pll_bypass", base + 0x64, 11);
+       clks[IMX8MM_VPU_PLL_OUT] = imx_clk_gate("vpu_pll_out", "vpu_pll_bypass", base + 0x74, 11);
+       clks[IMX8MM_ARM_PLL_OUT] = imx_clk_gate("arm_pll_out", "arm_pll_bypass", base + 0x84, 11);
+       clks[IMX8MM_SYS_PLL1_OUT] = imx_clk_gate("sys_pll1_out", "sys_pll1_bypass", base + 0x94, 11);
+       clks[IMX8MM_SYS_PLL2_OUT] = imx_clk_gate("sys_pll2_out", "sys_pll2_bypass", base + 0x104, 11);
+       clks[IMX8MM_SYS_PLL3_OUT] = imx_clk_gate("sys_pll3_out", "sys_pll3_bypass", base + 0x114, 11);
 
        /* SYS PLL fixed output */
        clks[IMX8MM_SYS_PLL1_40M] = imx_clk_fixed_factor("sys_pll1_40m", "sys_pll1_out", 1, 20);
index 8db4a3e..f3b4eb9 100644 (file)
@@ -2,6 +2,7 @@
 
 menuconfig CLK_SIFIVE
        bool "SiFive SoC driver support"
+       depends on RISCV || COMPILE_TEST
        help
          SoC drivers for SiFive Linux-capable SoCs.
 
index 96d65a1..8e83431 100644 (file)
@@ -137,9 +137,6 @@ static int _omap4_clkctrl_clk_enable(struct clk_hw *hw)
        int ret;
        union omap4_timeout timeout = { 0 };
 
-       if (!clk->enable_bit)
-               return 0;
-
        if (clk->clkdm) {
                ret = ti_clk_ll_ops->clkdm_clk_enable(clk->clkdm, hw->clk);
                if (ret) {
@@ -151,6 +148,9 @@ static int _omap4_clkctrl_clk_enable(struct clk_hw *hw)
                }
        }
 
+       if (!clk->enable_bit)
+               return 0;
+
        val = ti_clk_ll_ops->clk_readl(&clk->enable_reg);
 
        val &= ~OMAP4_MODULEMODE_MASK;
@@ -179,7 +179,7 @@ static void _omap4_clkctrl_clk_disable(struct clk_hw *hw)
        union omap4_timeout timeout = { 0 };
 
        if (!clk->enable_bit)
-               return;
+               goto exit;
 
        val = ti_clk_ll_ops->clk_readl(&clk->enable_reg);
 
index be832eb..acd40eb 100644 (file)
@@ -823,6 +823,7 @@ config GPIO_ADP5588
 config GPIO_ADP5588_IRQ
        bool "Interrupt controller support for ADP5588"
        depends on GPIO_ADP5588=y
+       select GPIOLIB_IRQCHIP
        help
          Say yes here to enable the adp5588 to be used as an interrupt
          controller. It requires the driver to be built in the kernel.
index b74824f..249d35c 100644 (file)
@@ -35,7 +35,7 @@
  * macros. Do **not** mass change existing definitions just to update the style.
  *
  * Layout
- * ''''''
+ * ~~~~~~
  *
  * Keep helper macros near the top. For example, _PIPE() and friends.
  *
@@ -79,7 +79,7 @@
  * style. Use lower case in hexadecimal values.
  *
  * Naming
- * ''''''
+ * ~~~~~~
  *
  * Try to name registers according to the specs. If the register name changes in
  * the specs from platform to another, stick to the original name.
@@ -97,7 +97,7 @@
  * suffix to the name. For example, ``_SKL`` or ``_GEN8``.
  *
  * Examples
- * ''''''''
+ * ~~~~~~~~
  *
  * (Note that the values in the example are indented using spaces instead of
  * TABs to avoid misalignment in generated documentation. Use TABs in the
index 9682dd5..6decd43 100644 (file)
@@ -37,7 +37,7 @@
  *    costly and simplifies things. We can revisit this in the future.
  *
  * Layout
- * ''''''
+ * ~~~~~~
  *
  * Keep things in this file ordered by WA type, as per the above (context, GT,
  * display, register whitelist, batchbuffer). Then, inside each type, keep the
index 0522c22..b372419 100644 (file)
@@ -277,7 +277,7 @@ config PINCTRL_ST
 config PINCTRL_STMFX
        tristate "STMicroelectronics STMFX GPIO expander pinctrl driver"
        depends on I2C
-       depends on OF || COMPILE_TEST
+       depends on OF_GPIO
        select GENERIC_PINCONF
        select GPIOLIB_IRQCHIP
        select MFD_STMFX
index d7acbb7..a18d6ee 100644 (file)
 
 #define PADOWN_BITS                    4
 #define PADOWN_SHIFT(p)                        ((p) % 8 * PADOWN_BITS)
-#define PADOWN_MASK(p)                 (0xf << PADOWN_SHIFT(p))
+#define PADOWN_MASK(p)                 (GENMASK(3, 0) << PADOWN_SHIFT(p))
 #define PADOWN_GPP(p)                  ((p) / 8)
 
 /* Offset from pad_regs */
 #define PADCFG0                                0x000
 #define PADCFG0_RXEVCFG_SHIFT          25
-#define PADCFG0_RXEVCFG_MASK           (3 << PADCFG0_RXEVCFG_SHIFT)
+#define PADCFG0_RXEVCFG_MASK           GENMASK(26, 25)
 #define PADCFG0_RXEVCFG_LEVEL          0
 #define PADCFG0_RXEVCFG_EDGE           1
 #define PADCFG0_RXEVCFG_DISABLED       2
@@ -51,7 +51,7 @@
 #define PADCFG0_GPIROUTSMI             BIT(18)
 #define PADCFG0_GPIROUTNMI             BIT(17)
 #define PADCFG0_PMODE_SHIFT            10
-#define PADCFG0_PMODE_MASK             (0xf << PADCFG0_PMODE_SHIFT)
+#define PADCFG0_PMODE_MASK             GENMASK(13, 10)
 #define PADCFG0_GPIORXDIS              BIT(9)
 #define PADCFG0_GPIOTXDIS              BIT(8)
 #define PADCFG0_GPIORXSTATE            BIT(1)
@@ -60,7 +60,7 @@
 #define PADCFG1                                0x004
 #define PADCFG1_TERM_UP                        BIT(13)
 #define PADCFG1_TERM_SHIFT             10
-#define PADCFG1_TERM_MASK              (7 << PADCFG1_TERM_SHIFT)
+#define PADCFG1_TERM_MASK              GENMASK(12, 10)
 #define PADCFG1_TERM_20K               4
 #define PADCFG1_TERM_2K                        3
 #define PADCFG1_TERM_5K                        2
@@ -914,35 +914,6 @@ static void intel_gpio_irq_ack(struct irq_data *d)
        }
 }
 
-static void intel_gpio_irq_enable(struct irq_data *d)
-{
-       struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-       struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
-       const struct intel_community *community;
-       const struct intel_padgroup *padgrp;
-       int pin;
-
-       pin = intel_gpio_to_pin(pctrl, irqd_to_hwirq(d), &community, &padgrp);
-       if (pin >= 0) {
-               unsigned int gpp, gpp_offset, is_offset;
-               unsigned long flags;
-               u32 value;
-
-               gpp = padgrp->reg_num;
-               gpp_offset = padgroup_offset(padgrp, pin);
-               is_offset = community->is_offset + gpp * 4;
-
-               raw_spin_lock_irqsave(&pctrl->lock, flags);
-               /* Clear interrupt status first to avoid unexpected interrupt */
-               writel(BIT(gpp_offset), community->regs + is_offset);
-
-               value = readl(community->regs + community->ie_offset + gpp * 4);
-               value |= BIT(gpp_offset);
-               writel(value, community->regs + community->ie_offset + gpp * 4);
-               raw_spin_unlock_irqrestore(&pctrl->lock, flags);
-       }
-}
-
 static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask)
 {
        struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
@@ -955,15 +926,20 @@ static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask)
        if (pin >= 0) {
                unsigned int gpp, gpp_offset;
                unsigned long flags;
-               void __iomem *reg;
+               void __iomem *reg, *is;
                u32 value;
 
                gpp = padgrp->reg_num;
                gpp_offset = padgroup_offset(padgrp, pin);
 
                reg = community->regs + community->ie_offset + gpp * 4;
+               is = community->regs + community->is_offset + gpp * 4;
 
                raw_spin_lock_irqsave(&pctrl->lock, flags);
+
+               /* Clear interrupt status first to avoid unexpected interrupt */
+               writel(BIT(gpp_offset), is);
+
                value = readl(reg);
                if (mask)
                        value &= ~BIT(gpp_offset);
@@ -1107,7 +1083,6 @@ static irqreturn_t intel_gpio_irq(int irq, void *data)
 
 static struct irq_chip intel_gpio_irqchip = {
        .name = "intel-gpio",
-       .irq_enable = intel_gpio_irq_enable,
        .irq_ack = intel_gpio_irq_ack,
        .irq_mask = intel_gpio_irq_mask,
        .irq_unmask = intel_gpio_irq_unmask,
index d3e5931..5079d1d 100644 (file)
@@ -428,7 +428,7 @@ predicate_parse(const char *str, int nr_parens, int nr_preds,
        op_stack = kmalloc_array(nr_parens, sizeof(*op_stack), GFP_KERNEL);
        if (!op_stack)
                return ERR_PTR(-ENOMEM);
-       prog_stack = kmalloc_array(nr_preds, sizeof(*prog_stack), GFP_KERNEL);
+       prog_stack = kcalloc(nr_preds, sizeof(*prog_stack), GFP_KERNEL);
        if (!prog_stack) {
                parse_error(pe, -ENOMEM, 0);
                goto out_free;
@@ -579,7 +579,11 @@ predicate_parse(const char *str, int nr_parens, int nr_preds,
 out_free:
        kfree(op_stack);
        kfree(inverts);
-       kfree(prog_stack);
+       if (prog_stack) {
+               for (i = 0; prog_stack[i].pred; i++)
+                       kfree(prog_stack[i].pred);
+               kfree(prog_stack);
+       }
        return ERR_PTR(ret);
 }
 
index 06e900c..712ed1f 100644 (file)
@@ -120,7 +120,8 @@ static void merge_final(void *priv, cmp_func cmp, struct list_head *head,
  * The latter offers a chance to save a few cycles in the comparison
  * (which is used by e.g. plug_ctx_cmp() in block/blk-mq.c).
  *
- * A good way to write a multi-word comparison is
+ * A good way to write a multi-word comparison is::
+ *
  *     if (a->high != b->high)
  *             return a->high > b->high;
  *     if (a->middle != b->middle)
index f6a5c0b..8c2d1bc 100755 (executable)
@@ -13,7 +13,7 @@ use strict;
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 
-my $virtenv_dir = "sphinx_1.4";
+my $conf = "Documentation/conf.py";
 my $requirement_file = "Documentation/sphinx/requirements.txt";
 
 #
@@ -26,7 +26,9 @@ my $need = 0;
 my $optional = 0;
 my $need_symlink = 0;
 my $need_sphinx = 0;
+my $rec_sphinx_upgrade = 0;
 my $install = "";
+my $virtenv_dir = "sphinx_";
 
 #
 # Command line arguments
@@ -201,13 +203,15 @@ sub check_missing_tex($)
        }
 }
 
-sub check_sphinx()
+sub get_sphinx_fname()
 {
-       return if findprog("sphinx-build");
+       my $fname = "sphinx-build";
+       return $fname if findprog($fname);
 
-       if (findprog("sphinx-build-3")) {
+       $fname = "sphinx-build-3";
+       if (findprog($fname)) {
                $need_symlink = 1;
-               return;
+               return $fname;
        }
 
        if ($virtualenv) {
@@ -219,6 +223,73 @@ sub check_sphinx()
        } else {
                add_package("python-sphinx", 0);
        }
+
+       return "";
+}
+
+sub check_sphinx()
+{
+       my $min_version;
+       my $rec_version;
+       my $cur_version;
+
+       open IN, $conf or die "Can't open $conf";
+       while (<IN>) {
+               if (m/^\s*needs_sphinx\s*=\s*[\'\"]([\d\.]+)[\'\"]/) {
+                       $min_version=$1;
+                       last;
+               }
+       }
+       close IN;
+
+       die "Can't get needs_sphinx version from $conf" if (!$min_version);
+
+       open IN, $requirement_file or die "Can't open $requirement_file";
+       while (<IN>) {
+               if (m/^\s*Sphinx\s*==\s*([\d\.]+)$/) {
+                       $rec_version=$1;
+                       last;
+               }
+       }
+       close IN;
+
+       die "Can't get recommended sphinx version from $requirement_file" if (!$min_version);
+
+       $virtenv_dir .= $rec_version;
+
+       my $sphinx = get_sphinx_fname();
+       return if ($sphinx eq "");
+
+       open IN, "$sphinx --version 2>&1 |" or die "$sphinx returned an error";
+       while (<IN>) {
+               if (m/^\s*sphinx-build\s+([\d\.]+)$/) {
+                       $cur_version=$1;
+                       last;
+               }
+               # Sphinx 1.2.x uses a different format
+               if (m/^\s*Sphinx.*\s+([\d\.]+)$/) {
+                       $cur_version=$1;
+                       last;
+               }
+       }
+       close IN;
+
+       die "$sphinx didn't return its version" if (!$cur_version);
+
+       printf "Sphinx version %s (minimal: %s, recommended >= %s)\n",
+               $cur_version, $min_version, $rec_version;
+
+       if ($cur_version lt $min_version) {
+               print "Warning: Sphinx version should be >= $min_version\n\n";
+               $need_sphinx = 1;
+               return;
+       }
+
+       if ($cur_version lt $rec_version) {
+               print "Warning: It is recommended at least Sphinx version $rec_version.\n";
+               print "         To upgrade, use:\n\n";
+               $rec_sphinx_upgrade = 1;
+       }
 }
 
 #
@@ -540,7 +611,7 @@ sub check_needs()
                printf "\tsudo ln -sf %s /usr/bin/sphinx-build\n\n",
                       which("sphinx-build-3");
        }
-       if ($need_sphinx) {
+       if ($need_sphinx || $rec_sphinx_upgrade) {
                my $activate = "$virtenv_dir/bin/activate";
                if (-e "$ENV{'PWD'}/$activate") {
                        printf "\nNeed to activate virtualenv with:\n";
@@ -554,7 +625,8 @@ sub check_needs()
                        printf "\t$virtualenv $virtenv_dir\n";
                        printf "\t. $activate\n";
                        printf "\tpip install -r $requirement_file\n";
-                       $need++;
+
+                       $need++ if (!$rec_sphinx_upgrade);
                }
        }
        printf "\n";
index c8236ff..b30d02d 100644 (file)
@@ -9,11 +9,11 @@
 
 #include "ff.h"
 
-#define LATTER_STF             0xffff00000004
-#define LATTER_ISOC_CHANNELS   0xffff00000008
-#define LATTER_ISOC_START      0xffff0000000c
-#define LATTER_FETCH_MODE      0xffff00000010
-#define LATTER_SYNC_STATUS     0x0000801c0000
+#define LATTER_STF             0xffff00000004ULL
+#define LATTER_ISOC_CHANNELS   0xffff00000008ULL
+#define LATTER_ISOC_START      0xffff0000000cULL
+#define LATTER_FETCH_MODE      0xffff00000010ULL
+#define LATTER_SYNC_STATUS     0x0000801c0000ULL
 
 static int parse_clock_bits(u32 data, unsigned int *rate,
                            enum snd_ff_clock_src *src)
index 0741eae..a4b0414 100644 (file)
@@ -375,6 +375,7 @@ enum {
 
 #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
 #define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348)
+#define IS_CNL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8)
 
 static char *driver_short_names[] = {
        [AZX_DRIVER_ICH] = "HDA Intel",
@@ -1700,8 +1701,8 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
        else
                chip->bdl_pos_adj = bdl_pos_adj[dev];
 
-       /* Workaround for a communication error on CFL (bko#199007) */
-       if (IS_CFL(pci))
+       /* Workaround for a communication error on CFL (bko#199007) and CNL */
+       if (IS_CFL(pci) || IS_CNL(pci))
                chip->polling_mode = 1;
 
        err = azx_bus_init(chip, model[dev], &pci_hda_io_ops);
index 2c1942d..9742449 100644 (file)
@@ -821,6 +821,8 @@ static void alc_pre_init(struct hda_codec *codec)
        alc_fill_eapd_coef(codec);
 }
 
+#define is_s3_resume(codec) \
+       ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
 #define is_s4_resume(codec) \
        ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
 
@@ -4888,6 +4890,8 @@ static void alc_update_headset_mode(struct hda_codec *codec)
        switch (new_headset_mode) {
        case ALC_HEADSET_MODE_UNPLUGGED:
                alc_headset_mode_unplugged(codec);
+               spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
+               spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
                spec->gen.hp_jack_present = false;
                break;
        case ALC_HEADSET_MODE_HEADSET:
@@ -4930,8 +4934,6 @@ static void alc_update_headset_mode_hook(struct hda_codec *codec,
 static void alc_update_headset_jack_cb(struct hda_codec *codec,
                                       struct hda_jack_callback *jack)
 {
-       struct alc_spec *spec = codec->spec;
-       spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
        snd_hda_gen_hp_automute(codec, jack);
 }
 
@@ -4968,7 +4970,10 @@ static void alc_fixup_headset_mode(struct hda_codec *codec,
                alc_probe_headset_mode(codec);
                break;
        case HDA_FIXUP_ACT_INIT:
-               spec->current_headset_mode = 0;
+               if (is_s3_resume(codec) || is_s4_resume(codec)) {
+                       spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
+                       spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
+               }
                alc_update_headset_mode(codec);
                break;
        }
@@ -5734,7 +5739,7 @@ enum {
        ALC298_FIXUP_TPT470_DOCK,
        ALC255_FIXUP_DUMMY_LINEOUT_VERB,
        ALC255_FIXUP_DELL_HEADSET_MIC,
-       ALC256_FIXUP_HUAWEI_MBXP_PINS,
+       ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
        ALC295_FIXUP_HP_X360,
        ALC221_FIXUP_HP_HEADSET_MIC,
        ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
@@ -6025,7 +6030,7 @@ static const struct hda_fixup alc269_fixups[] = {
                .chained = true,
                .chain_id = ALC269_FIXUP_HEADSET_MIC
        },
-       [ALC256_FIXUP_HUAWEI_MBXP_PINS] = {
+       [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
                .type = HDA_FIXUP_PINS,
                .v.pins = (const struct hda_pintbl[]) {
                        {0x12, 0x90a60130},
@@ -6205,13 +6210,15 @@ static const struct hda_fixup alc269_fixups[] = {
                .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
        },
        [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
-               .type = HDA_FIXUP_PINS,
-               .v.pins = (const struct hda_pintbl[]) {
-                       { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
-                       { }
+               .type = HDA_FIXUP_VERBS,
+               .v.verbs = (const struct hda_verb[]) {
+                       /* Enable the Mic */
+                       { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
+                       { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
+                       {}
                },
                .chained = true,
-               .chain_id = ALC255_FIXUP_HEADSET_MODE
+               .chain_id = ALC269_FIXUP_LIFEBOOK_EXTMIC
        },
        [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
                .type = HDA_FIXUP_PINS,
@@ -7050,9 +7057,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
        SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
        SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
-       SND_PCI_QUIRK(0x19e5, 0x3200, "Huawei MBX", ALC255_FIXUP_MIC_MUTE_LED),
-       SND_PCI_QUIRK(0x19e5, 0x3201, "Huawei MBX", ALC255_FIXUP_MIC_MUTE_LED),
-       SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MBXP", ALC256_FIXUP_HUAWEI_MBXP_PINS),
+       SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
        SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
 
 #if 0
@@ -7111,6 +7116,7 @@ static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
        SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
        SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
        SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
+       SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
        {}
 };
 
@@ -7257,6 +7263,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
                {0x19, 0x0181303F},
                {0x21, 0x0221102f}),
        SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
+               {0x12, 0x90a60140},
+               {0x14, 0x90170120},
+               {0x21, 0x02211030}),
+       SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
                {0x12, 0x90a601c0},
                {0x14, 0x90171120},
                {0x21, 0x02211030}),
@@ -7693,7 +7703,7 @@ static int patch_alc269(struct hda_codec *codec)
 
        spec = codec->spec;
        spec->gen.shared_mic_vref_pin = 0x18;
-       codec->power_save_node = 1;
+       codec->power_save_node = 0;
 
 #ifdef CONFIG_PM
        codec->patch_ops.suspend = alc269_suspend;
index b61f65b..2b57854 100644 (file)
@@ -720,6 +720,15 @@ static int line6_init_cap_control(struct usb_line6 *line6)
        return 0;
 }
 
+static void line6_startup_work(struct work_struct *work)
+{
+       struct usb_line6 *line6 =
+               container_of(work, struct usb_line6, startup_work.work);
+
+       if (line6->startup)
+               line6->startup(line6);
+}
+
 /*
        Probe USB device.
 */
@@ -755,6 +764,7 @@ int line6_probe(struct usb_interface *interface,
        line6->properties = properties;
        line6->usbdev = usbdev;
        line6->ifcdev = &interface->dev;
+       INIT_DELAYED_WORK(&line6->startup_work, line6_startup_work);
 
        strcpy(card->id, properties->id);
        strcpy(card->driver, driver_name);
@@ -825,6 +835,8 @@ void line6_disconnect(struct usb_interface *interface)
        if (WARN_ON(usbdev != line6->usbdev))
                return;
 
+       cancel_delayed_work(&line6->startup_work);
+
        if (line6->urb_listen != NULL)
                line6_stop_listen(line6);
 
index 6142559..650d909 100644 (file)
@@ -178,11 +178,15 @@ struct usb_line6 {
                        fifo;
        } messages;
 
+       /* Work for delayed PCM startup */
+       struct delayed_work startup_work;
+
        /* If MIDI is supported, buffer_message contains the pre-processed data;
         * otherwise the data is only in urb_listen (buffer_incoming).
         */
        void (*process_message)(struct usb_line6 *);
        void (*disconnect)(struct usb_line6 *line6);
+       void (*startup)(struct usb_line6 *line6);
 };
 
 extern char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1,
index e28368d..55865f7 100644 (file)
@@ -54,9 +54,6 @@ struct usb_line6_toneport {
        /* Firmware version (x 100) */
        u8 firmware_version;
 
-       /* Work for delayed PCM startup */
-       struct delayed_work pcm_work;
-
        /* Device type */
        enum line6_device_type type;
 
@@ -241,12 +238,8 @@ static int snd_toneport_source_put(struct snd_kcontrol *kcontrol,
        return 1;
 }
 
-static void toneport_start_pcm(struct work_struct *work)
+static void toneport_startup(struct usb_line6 *line6)
 {
-       struct usb_line6_toneport *toneport =
-               container_of(work, struct usb_line6_toneport, pcm_work.work);
-       struct usb_line6 *line6 = &toneport->line6;
-
        line6_pcm_acquire(line6->line6pcm, LINE6_STREAM_MONITOR, true);
 }
 
@@ -394,7 +387,7 @@ static int toneport_setup(struct usb_line6_toneport *toneport)
        if (toneport_has_led(toneport))
                toneport_update_led(toneport);
 
-       schedule_delayed_work(&toneport->pcm_work,
+       schedule_delayed_work(&toneport->line6.startup_work,
                              msecs_to_jiffies(TONEPORT_PCM_DELAY * 1000));
        return 0;
 }
@@ -407,8 +400,6 @@ static void line6_toneport_disconnect(struct usb_line6 *line6)
        struct usb_line6_toneport *toneport =
                (struct usb_line6_toneport *)line6;
 
-       cancel_delayed_work_sync(&toneport->pcm_work);
-
        if (toneport_has_led(toneport))
                toneport_remove_leds(toneport);
 }
@@ -424,9 +415,9 @@ static int toneport_init(struct usb_line6 *line6,
        struct usb_line6_toneport *toneport =  (struct usb_line6_toneport *) line6;
 
        toneport->type = id->driver_info;
-       INIT_DELAYED_WORK(&toneport->pcm_work, toneport_start_pcm);
 
        line6->disconnect = line6_toneport_disconnect;
+       line6->startup = toneport_startup;
 
        /* initialize PCM subsystem: */
        err = line6_init_pcm(line6, &toneport_pcm_properties);
index 1363874..7da5e31 100755 (executable)
@@ -318,6 +318,7 @@ run_test() { # testfile
     local testlog=/proc/self/fd/1
   fi
   export TMPDIR=`mktemp -d /tmp/ftracetest-dir.XXXXXX`
+  export FTRACETEST_ROOT=$TOP_DIR
   echo "execute$INSTANCE: "$1 > $testlog
   SIG_RESULT=0
   if [ $VERBOSE -eq -1 ]; then
index 492426e..7650a82 100644 (file)
@@ -3,7 +3,7 @@
 # description: Kprobe dynamic event with function tracer
 
 [ -f kprobe_events ] || exit_unsupported # this is configurable
-grep function available_tracers || exit_unsupported # this is configurable
+grep "function" available_tracers || exit_unsupported # this is configurable
 
 # prepare
 echo nop > current_tracer
diff --git a/tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc b/tools/testing/selftests/ftrace/test.d/selftest/bashisms.tc
new file mode 100644 (file)
index 0000000..1b081e9
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# description: Meta-selftest: Checkbashisms
+
+if [ ! -f $FTRACETEST_ROOT/ftracetest ]; then
+  echo "Hmm, we can not find ftracetest"
+  exit_unresolved
+fi
+
+if ! which checkbashisms > /dev/null 2>&1 ; then
+  echo "No checkbashisms found. skipped."
+  exit_unresolved
+fi
+
+checkbashisms $FTRACETEST_ROOT/ftracetest
+checkbashisms $FTRACETEST_ROOT/test.d/functions
+for t in $(find $FTRACETEST_ROOT/test.d -name \*.tc); do
+  checkbashisms $t
+done
+
+exit 0
index 941d939..2067c6b 100644 (file)
@@ -62,6 +62,7 @@
 #include <sys/wait.h>
 #include <unistd.h>
 
+#define TEST_TIMEOUT_DEFAULT 30
 
 /* Utilities exposed to the test definitions */
 #ifndef TH_LOG_STREAM
        static void test_name(struct __test_metadata *_metadata); \
        static struct __test_metadata _##test_name##_object = \
                { .name = "global." #test_name, \
-                 .fn = &test_name, .termsig = _signal }; \
+                 .fn = &test_name, .termsig = _signal, \
+                 .timeout = TEST_TIMEOUT_DEFAULT, }; \
        static void __attribute__((constructor)) _register_##test_name(void) \
        { \
                __register_test(&_##test_name##_object); \
  */
 /* TODO(wad) register fixtures on dedicated test lists. */
 #define TEST_F(fixture_name, test_name) \
-       __TEST_F_IMPL(fixture_name, test_name, -1)
+       __TEST_F_IMPL(fixture_name, test_name, -1, TEST_TIMEOUT_DEFAULT)
 
 #define TEST_F_SIGNAL(fixture_name, test_name, signal) \
-       __TEST_F_IMPL(fixture_name, test_name, signal)
+       __TEST_F_IMPL(fixture_name, test_name, signal, TEST_TIMEOUT_DEFAULT)
 
-#define __TEST_F_IMPL(fixture_name, test_name, signal) \
+#define TEST_F_TIMEOUT(fixture_name, test_name, timeout) \
+       __TEST_F_IMPL(fixture_name, test_name, -1, timeout)
+
+#define __TEST_F_IMPL(fixture_name, test_name, signal, tmout) \
        static void fixture_name##_##test_name( \
                struct __test_metadata *_metadata, \
                FIXTURE_DATA(fixture_name) *self); \
                .name = #fixture_name "." #test_name, \
                .fn = &wrapper_##fixture_name##_##test_name, \
                .termsig = signal, \
+               .timeout = tmout, \
         }; \
        static void __attribute__((constructor)) \
                        _register_##fixture_name##_##test_name(void) \
@@ -632,6 +638,7 @@ struct __test_metadata {
        int termsig;
        int passed;
        int trigger; /* extra handler after the evaluation */
+       int timeout;
        __u8 step;
        bool no_print; /* manual trigger when TH_LOG_STREAM is not available */
        struct __test_metadata *prev, *next;
@@ -696,7 +703,7 @@ void __run_test(struct __test_metadata *t)
        t->passed = 1;
        t->trigger = 0;
        printf("[ RUN      ] %s\n", t->name);
-       alarm(30);
+       alarm(t->timeout);
        child_pid = fork();
        if (child_pid < 0) {
                printf("ERROR SPAWNING TEST CHILD\n");
index b206553..66af608 100644 (file)
@@ -49,7 +49,7 @@ TEST_F(rtc, date_read) {
               rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);
 }
 
-TEST_F(rtc, uie_read) {
+TEST_F_TIMEOUT(rtc, uie_read, NUM_UIE + 2) {
        int i, rc, irq = 0;
        unsigned long data;
 
@@ -211,7 +211,7 @@ TEST_F(rtc, alarm_wkalm_set) {
        ASSERT_EQ(new, secs);
 }
 
-TEST_F(rtc, alarm_alm_set_minute) {
+TEST_F_TIMEOUT(rtc, alarm_alm_set_minute, 65) {
        struct timeval tv = { .tv_sec = 62 };
        unsigned long data;
        struct rtc_time tm;
@@ -264,7 +264,7 @@ TEST_F(rtc, alarm_alm_set_minute) {
        ASSERT_EQ(new, secs);
 }
 
-TEST_F(rtc, alarm_wkalm_set_minute) {
+TEST_F_TIMEOUT(rtc, alarm_wkalm_set_minute, 65) {
        struct timeval tv = { .tv_sec = 62 };
        struct rtc_wkalrm alarm = { 0 };
        struct rtc_time tm;