From 5ba09b73cdadec99cc257409e4a95aa707b2be09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Thu, 21 Oct 2021 18:55:58 +0200 Subject: [PATCH] Add upstream patches, remove deprecated (#3214) --- .../odroidxu4-5.4/patch-5.4.154-155.patch | 1612 ++++++ .../sun50iw9-4.9/patch-4.9.286-287.patch | 543 ++ .../archive/sunxi-5.10/patch-5.10.72-73.patch | 2474 +++++++++ .../archive/sunxi-5.10/patch-5.10.73-74.patch | 1038 ++++ .../archive/sunxi-5.10/patch-5.10.74-75.patch | 2564 ++++++++++ ...maximum-divider-for-clock-above-300M.patch | 26 - .../archive/sunxi-5.14/patch-5.14.13-14.patch | 4421 +++++++++++++++++ .../archive/sunxi-5.4/patch-5.4.25-26.patch | 35 - 8 files changed, 12652 insertions(+), 61 deletions(-) create mode 100644 patch/kernel/archive/odroidxu4-5.4/patch-5.4.154-155.patch create mode 100644 patch/kernel/archive/sun50iw9-4.9/patch-4.9.286-287.patch create mode 100644 patch/kernel/archive/sunxi-5.10/patch-5.10.72-73.patch create mode 100644 patch/kernel/archive/sunxi-5.10/patch-5.10.73-74.patch create mode 100644 patch/kernel/archive/sunxi-5.10/patch-5.10.74-75.patch delete mode 100644 patch/kernel/archive/sunxi-5.14/olimex_0018-net-dwmac-Apply-maximum-divider-for-clock-above-300M.patch create mode 100644 patch/kernel/archive/sunxi-5.14/patch-5.14.13-14.patch diff --git a/patch/kernel/archive/odroidxu4-5.4/patch-5.4.154-155.patch b/patch/kernel/archive/odroidxu4-5.4/patch-5.4.154-155.patch new file mode 100644 index 0000000000..24744d17b2 --- /dev/null +++ b/patch/kernel/archive/odroidxu4-5.4/patch-5.4.154-155.patch @@ -0,0 +1,1612 @@ +diff --git a/Makefile b/Makefile +index 3358f56a37f06..f7e2bf924463b 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 154 ++SUBLEVEL = 155 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/arch/csky/kernel/ptrace.c b/arch/csky/kernel/ptrace.c +index 313623a19ecbf..885194720fe0b 100644 +--- a/arch/csky/kernel/ptrace.c ++++ b/arch/csky/kernel/ptrace.c +@@ -96,7 +96,8 @@ static int gpr_set(struct task_struct *target, + if (ret) + return ret; + +- regs.sr = task_pt_regs(target)->sr; ++ /* BIT(0) of regs.sr is Condition Code/Carry bit */ ++ regs.sr = (regs.sr & BIT(0)) | (task_pt_regs(target)->sr & ~BIT(0)); + #ifdef CONFIG_CPU_HAS_HILO + regs.dcsr = task_pt_regs(target)->dcsr; + #endif +diff --git a/arch/csky/kernel/signal.c b/arch/csky/kernel/signal.c +index 9b1b7c039ddf9..63c2bbe39d03b 100644 +--- a/arch/csky/kernel/signal.c ++++ b/arch/csky/kernel/signal.c +@@ -52,10 +52,14 @@ static long restore_sigcontext(struct pt_regs *regs, + struct sigcontext __user *sc) + { + int err = 0; ++ unsigned long sr = regs->sr; + + /* sc_pt_regs is structured the same as the start of pt_regs */ + err |= __copy_from_user(regs, &sc->sc_pt_regs, sizeof(struct pt_regs)); + ++ /* BIT(0) of regs->sr is Condition Code/Carry bit */ ++ regs->sr = (sr & ~1) | (regs->sr & 1); ++ + /* Restore the floating-point state. */ + err |= restore_fpu_state(sc); + +diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c +index 2d4c09a77910f..d4467da279668 100644 +--- a/arch/powerpc/sysdev/xive/common.c ++++ b/arch/powerpc/sysdev/xive/common.c +@@ -990,7 +990,8 @@ static int xive_get_irqchip_state(struct irq_data *data, + * interrupt to be inactive in that case. + */ + *state = (pq != XIVE_ESB_INVALID) && !xd->stale_p && +- (xd->saved_p || !!(pq & XIVE_ESB_VAL_P)); ++ (xd->saved_p || (!!(pq & XIVE_ESB_VAL_P) && ++ !irqd_irq_disabled(data))); + return 0; + default: + return -EINVAL; +diff --git a/arch/s390/lib/string.c b/arch/s390/lib/string.c +index 0e30e6e43b0c5..18fbbb679851d 100644 +--- a/arch/s390/lib/string.c ++++ b/arch/s390/lib/string.c +@@ -246,14 +246,13 @@ EXPORT_SYMBOL(strcmp); + #ifdef __HAVE_ARCH_STRRCHR + char *strrchr(const char *s, int c) + { +- size_t len = __strend(s) - s; +- +- if (len) +- do { +- if (s[len] == (char) c) +- return (char *) s + len; +- } while (--len > 0); +- return NULL; ++ ssize_t len = __strend(s) - s; ++ ++ do { ++ if (s[len] == (char)c) ++ return (char *)s + len; ++ } while (--len >= 0); ++ return NULL; + } + EXPORT_SYMBOL(strrchr); + #endif +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig +index 8c1590432e866..c2a3ec3dd8506 100644 +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -1541,7 +1541,6 @@ config AMD_MEM_ENCRYPT + + config AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT + bool "Activate AMD Secure Memory Encryption (SME) by default" +- default y + depends on AMD_MEM_ENCRYPT + ---help--- + Say yes to have system memory encrypted by default if running on +diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c +index 87a34b6e06a2b..130c3c7f56d4b 100644 +--- a/arch/x86/kernel/cpu/resctrl/core.c ++++ b/arch/x86/kernel/cpu/resctrl/core.c +@@ -588,6 +588,8 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r) + } + + if (r->mon_capable && domain_setup_mon_state(r, d)) { ++ kfree(d->ctrl_val); ++ kfree(d->mbps_val); + kfree(d); + return; + } +diff --git a/drivers/acpi/arm64/gtdt.c b/drivers/acpi/arm64/gtdt.c +index 7d7497b856020..311419d1d6b05 100644 +--- a/drivers/acpi/arm64/gtdt.c ++++ b/drivers/acpi/arm64/gtdt.c +@@ -36,7 +36,7 @@ struct acpi_gtdt_descriptor { + + static struct acpi_gtdt_descriptor acpi_gtdt_desc __initdata; + +-static inline void *next_platform_timer(void *platform_timer) ++static inline __init void *next_platform_timer(void *platform_timer) + { + struct acpi_gtdt_header *gh = platform_timer; + +diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c +index 416cfbf2f1c29..8a963d2a951db 100644 +--- a/drivers/ata/libahci_platform.c ++++ b/drivers/ata/libahci_platform.c +@@ -440,10 +440,7 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, + hpriv->phy_regulator = devm_regulator_get(dev, "phy"); + if (IS_ERR(hpriv->phy_regulator)) { + rc = PTR_ERR(hpriv->phy_regulator); +- if (rc == -EPROBE_DEFER) +- goto err_out; +- rc = 0; +- hpriv->phy_regulator = NULL; ++ goto err_out; + } + + if (flags & AHCI_PLATFORM_GET_RESETS) { +diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c +index 4fd12b20df239..d91ba47f2fc44 100644 +--- a/drivers/ata/pata_legacy.c ++++ b/drivers/ata/pata_legacy.c +@@ -315,7 +315,8 @@ static unsigned int pdc_data_xfer_vlb(struct ata_queued_cmd *qc, + iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); + + if (unlikely(slop)) { +- __le32 pad; ++ __le32 pad = 0; ++ + if (rw == READ) { + pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr)); + memcpy(buf + buflen - slop, &pad, slop); +@@ -705,7 +706,8 @@ static unsigned int vlb32_data_xfer(struct ata_queued_cmd *qc, + ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); + + if (unlikely(slop)) { +- __le32 pad; ++ __le32 pad = 0; ++ + if (rw == WRITE) { + memcpy(&pad, buf + buflen - slop, slop); + iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr); +diff --git a/drivers/edac/armada_xp_edac.c b/drivers/edac/armada_xp_edac.c +index 7f227bdcbc845..8c63447154730 100644 +--- a/drivers/edac/armada_xp_edac.c ++++ b/drivers/edac/armada_xp_edac.c +@@ -178,7 +178,7 @@ static void axp_mc_check(struct mem_ctl_info *mci) + "details unavailable (multiple errors)"); + if (cnt_dbe) + edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, +- cnt_sbe, /* error count */ ++ cnt_dbe, /* error count */ + 0, 0, 0, /* pfn, offset, syndrome */ + -1, -1, -1, /* top, mid, low layer */ + mci->ctl_name, +diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c +index e48298687b76d..6157038114a2a 100644 +--- a/drivers/firmware/efi/cper.c ++++ b/drivers/firmware/efi/cper.c +@@ -25,8 +25,6 @@ + #include + #include + +-static char rcd_decode_str[CPER_REC_LEN]; +- + /* + * CPER record ID need to be unique even after reboot, because record + * ID is used as index for ERST storage, while CPER records from +@@ -299,6 +297,7 @@ const char *cper_mem_err_unpack(struct trace_seq *p, + struct cper_mem_err_compact *cmem) + { + const char *ret = trace_seq_buffer_ptr(p); ++ char rcd_decode_str[CPER_REC_LEN]; + + if (cper_mem_err_location(cmem, rcd_decode_str)) + trace_seq_printf(p, "%s", rcd_decode_str); +@@ -313,6 +312,7 @@ static void cper_print_mem(const char *pfx, const struct cper_sec_mem_err *mem, + int len) + { + struct cper_mem_err_compact cmem; ++ char rcd_decode_str[CPER_REC_LEN]; + + /* Don't trust UEFI 2.1/2.2 structure with bad validation bits */ + if (len == sizeof(struct cper_sec_mem_err_old) && +diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c +index 65fffaa222108..136b9c7f9ac95 100644 +--- a/drivers/firmware/efi/runtime-wrappers.c ++++ b/drivers/firmware/efi/runtime-wrappers.c +@@ -414,7 +414,7 @@ static void virt_efi_reset_system(int reset_type, + unsigned long data_size, + efi_char16_t *data) + { +- if (down_interruptible(&efi_runtime_lock)) { ++ if (down_trylock(&efi_runtime_lock)) { + pr_warn("failed to invoke the reset_system() runtime service:\n" + "could not get exclusive access to the firmware\n"); + return; +diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c +index d9193ffa17a1e..54da66d02b0e5 100644 +--- a/drivers/gpio/gpio-pca953x.c ++++ b/drivers/gpio/gpio-pca953x.c +@@ -583,21 +583,21 @@ static int pca953x_gpio_set_pull_up_down(struct pca953x_chip *chip, + + mutex_lock(&chip->i2c_lock); + +- /* Disable pull-up/pull-down */ +- ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, 0); +- if (ret) +- goto exit; +- + /* Configure pull-up/pull-down */ + if (config == PIN_CONFIG_BIAS_PULL_UP) + ret = regmap_write_bits(chip->regmap, pull_sel_reg, bit, bit); + else if (config == PIN_CONFIG_BIAS_PULL_DOWN) + ret = regmap_write_bits(chip->regmap, pull_sel_reg, bit, 0); ++ else ++ ret = 0; + if (ret) + goto exit; + +- /* Enable pull-up/pull-down */ +- ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, bit); ++ /* Disable/Enable pull-up/pull-down */ ++ if (config == PIN_CONFIG_BIAS_DISABLE) ++ ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, 0); ++ else ++ ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, bit); + + exit: + mutex_unlock(&chip->i2c_lock); +@@ -611,7 +611,9 @@ static int pca953x_gpio_set_config(struct gpio_chip *gc, unsigned int offset, + + switch (pinconf_to_config_param(config)) { + case PIN_CONFIG_BIAS_PULL_UP: ++ case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT: + case PIN_CONFIG_BIAS_PULL_DOWN: ++ case PIN_CONFIG_BIAS_DISABLE: + return pca953x_gpio_set_pull_up_down(chip, offset, config); + default: + return -ENOTSUPP; +diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c +index 0d37ae5b310c4..a11b98e990019 100644 +--- a/drivers/gpu/drm/msm/dsi/dsi.c ++++ b/drivers/gpu/drm/msm/dsi/dsi.c +@@ -206,8 +206,10 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, + goto fail; + } + +- if (!msm_dsi_manager_validate_current_config(msm_dsi->id)) ++ if (!msm_dsi_manager_validate_current_config(msm_dsi->id)) { ++ ret = -EINVAL; + goto fail; ++ } + + msm_dsi->encoder = encoder; + +diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c +index 1e7b1be25bb07..5613234823f7d 100644 +--- a/drivers/gpu/drm/msm/dsi/dsi_host.c ++++ b/drivers/gpu/drm/msm/dsi/dsi_host.c +@@ -460,7 +460,7 @@ static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host) + + return 0; + err: +- for (; i > 0; i--) ++ while (--i >= 0) + clk_disable_unprepare(msm_host->bus_clks[i]); + + return ret; +diff --git a/drivers/gpu/drm/msm/edp/edp_ctrl.c b/drivers/gpu/drm/msm/edp/edp_ctrl.c +index 7f3dd3ffe2c9b..bbbd96f9eaa06 100644 +--- a/drivers/gpu/drm/msm/edp/edp_ctrl.c ++++ b/drivers/gpu/drm/msm/edp/edp_ctrl.c +@@ -1082,7 +1082,7 @@ void msm_edp_ctrl_power(struct edp_ctrl *ctrl, bool on) + int msm_edp_ctrl_init(struct msm_edp *edp) + { + struct edp_ctrl *ctrl = NULL; +- struct device *dev = &edp->pdev->dev; ++ struct device *dev; + int ret; + + if (!edp) { +@@ -1090,6 +1090,7 @@ int msm_edp_ctrl_init(struct msm_edp *edp) + return -EINVAL; + } + ++ dev = &edp->pdev->dev; + ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + if (!ctrl) + return -ENOMEM; +diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig +index f152bc4eeb535..e70ccadf7541d 100644 +--- a/drivers/gpu/drm/panel/Kconfig ++++ b/drivers/gpu/drm/panel/Kconfig +@@ -141,6 +141,7 @@ config DRM_PANEL_OLIMEX_LCD_OLINUXINO + depends on OF + depends on I2C + depends on BACKLIGHT_CLASS_DEVICE ++ select CRC32 + help + The panel is used with different sizes LCDs, from 480x272 to + 1280x800, and 24 bit per pixel. +diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c +index d3fc39df535dc..552baf327d0c4 100644 +--- a/drivers/iio/adc/aspeed_adc.c ++++ b/drivers/iio/adc/aspeed_adc.c +@@ -184,6 +184,7 @@ static int aspeed_adc_probe(struct platform_device *pdev) + + data = iio_priv(indio_dev); + data->dev = &pdev->dev; ++ platform_set_drvdata(pdev, indio_dev); + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + data->base = devm_ioremap_resource(&pdev->dev, res); +diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c +index 2449d91e47665..9cdb9084c64e8 100644 +--- a/drivers/iio/adc/mt6577_auxadc.c ++++ b/drivers/iio/adc/mt6577_auxadc.c +@@ -82,6 +82,10 @@ static const struct iio_chan_spec mt6577_auxadc_iio_channels[] = { + MT6577_AUXADC_CHANNEL(15), + }; + ++/* For Voltage calculation */ ++#define VOLTAGE_FULL_RANGE 1500 /* VA voltage */ ++#define AUXADC_PRECISE 4096 /* 12 bits */ ++ + static int mt_auxadc_get_cali_data(int rawdata, bool enable_cali) + { + return rawdata; +@@ -191,6 +195,10 @@ static int mt6577_auxadc_read_raw(struct iio_dev *indio_dev, + } + if (adc_dev->dev_comp->sample_data_cali) + *val = mt_auxadc_get_cali_data(*val, true); ++ ++ /* Convert adc raw data to voltage: 0 - 1500 mV */ ++ *val = *val * VOLTAGE_FULL_RANGE / AUXADC_PRECISE; ++ + return IIO_VAL_INT; + + default: +diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c +index 1e5a936b5b6ad..4267d756cd50e 100644 +--- a/drivers/iio/adc/ti-adc128s052.c ++++ b/drivers/iio/adc/ti-adc128s052.c +@@ -172,7 +172,13 @@ static int adc128_probe(struct spi_device *spi) + mutex_init(&adc->lock); + + ret = iio_device_register(indio_dev); ++ if (ret) ++ goto err_disable_regulator; + ++ return 0; ++ ++err_disable_regulator: ++ regulator_disable(adc->reg); + return ret; + } + +diff --git a/drivers/iio/common/ssp_sensors/ssp_spi.c b/drivers/iio/common/ssp_sensors/ssp_spi.c +index 7db3d5886e3ee..d98e0a04add05 100644 +--- a/drivers/iio/common/ssp_sensors/ssp_spi.c ++++ b/drivers/iio/common/ssp_sensors/ssp_spi.c +@@ -137,7 +137,7 @@ static int ssp_print_mcu_debug(char *data_frame, int *data_index, + if (length > received_len - *data_index || length <= 0) { + ssp_dbg("[SSP]: MSG From MCU-invalid debug length(%d/%d)\n", + length, received_len); +- return length ? length : -EPROTO; ++ return -EPROTO; + } + + ssp_dbg("[SSP]: MSG From MCU - %s\n", &data_frame[*data_index]); +@@ -273,6 +273,8 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len) + for (idx = 0; idx < len;) { + switch (dataframe[idx++]) { + case SSP_MSG2AP_INST_BYPASS_DATA: ++ if (idx >= len) ++ return -EPROTO; + sd = dataframe[idx++]; + if (sd < 0 || sd >= SSP_SENSOR_MAX) { + dev_err(SSP_DEV, +@@ -282,10 +284,13 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len) + + if (indio_devs[sd]) { + spd = iio_priv(indio_devs[sd]); +- if (spd->process_data) ++ if (spd->process_data) { ++ if (idx >= len) ++ return -EPROTO; + spd->process_data(indio_devs[sd], + &dataframe[idx], + data->timestamp); ++ } + } else { + dev_err(SSP_DEV, "no client for frame\n"); + } +@@ -293,6 +298,8 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len) + idx += ssp_offset_map[sd]; + break; + case SSP_MSG2AP_INST_DEBUG_DATA: ++ if (idx >= len) ++ return -EPROTO; + sd = ssp_print_mcu_debug(dataframe, &idx, len); + if (sd) { + dev_err(SSP_DEV, +diff --git a/drivers/iio/dac/ti-dac5571.c b/drivers/iio/dac/ti-dac5571.c +index 3a2bb0efe50de..51c41ccf00ad9 100644 +--- a/drivers/iio/dac/ti-dac5571.c ++++ b/drivers/iio/dac/ti-dac5571.c +@@ -352,6 +352,7 @@ static int dac5571_probe(struct i2c_client *client, + data->dac5571_pwrdwn = dac5571_pwrdwn_quad; + break; + default: ++ ret = -EINVAL; + goto err; + } + +diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c +index 92004a2563ea8..5588066c83246 100644 +--- a/drivers/iio/light/opt3001.c ++++ b/drivers/iio/light/opt3001.c +@@ -275,6 +275,8 @@ static int opt3001_get_lux(struct opt3001 *opt, int *val, int *val2) + ret = wait_event_timeout(opt->result_ready_queue, + opt->result_ready, + msecs_to_jiffies(OPT3001_RESULT_READY_LONG)); ++ if (ret == 0) ++ return -ETIMEDOUT; + } else { + /* Sleep for result ready time */ + timeout = (opt->int_time == OPT3001_INT_TIME_SHORT) ? +@@ -311,9 +313,7 @@ err: + /* Disallow IRQ to access the device while lock is active */ + opt->ok_to_ignore_lock = false; + +- if (ret == 0) +- return -ETIMEDOUT; +- else if (ret < 0) ++ if (ret < 0) + return ret; + + if (opt->use_irq) { +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index e5f1e3cf9179f..ba101afcfc27f 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -331,6 +331,7 @@ static const struct xpad_device { + { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, + { 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, ++ { 0x3285, 0x0607, "Nacon GC-100", 0, XTYPE_XBOX360 }, + { 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX }, + { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, + { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } +@@ -447,6 +448,7 @@ static const struct usb_device_id xpad_table[] = { + XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ + XPAD_XBOXONE_VENDOR(0x2e24), /* Hyperkin Duke X-Box One pad */ + XPAD_XBOX360_VENDOR(0x2f24), /* GameSir Controllers */ ++ XPAD_XBOX360_VENDOR(0x3285), /* Nacon GC-100 */ + { } + }; + +diff --git a/drivers/misc/cb710/sgbuf2.c b/drivers/misc/cb710/sgbuf2.c +index dfd2969e36289..d52e079bb324e 100644 +--- a/drivers/misc/cb710/sgbuf2.c ++++ b/drivers/misc/cb710/sgbuf2.c +@@ -47,7 +47,7 @@ static inline bool needs_unaligned_copy(const void *ptr) + #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS + return false; + #else +- return ((ptr - NULL) & 3) != 0; ++ return ((uintptr_t)ptr & 3) != 0; + #endif + } + +diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h +index e56dc47540646..556133daa25e9 100644 +--- a/drivers/misc/mei/hw-me-regs.h ++++ b/drivers/misc/mei/hw-me-regs.h +@@ -90,6 +90,7 @@ + #define MEI_DEV_ID_CDF 0x18D3 /* Cedar Fork */ + + #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */ ++#define MEI_DEV_ID_ICP_N 0x38E0 /* Ice Lake Point N */ + + #define MEI_DEV_ID_TGP_LP 0xA0E0 /* Tiger Lake Point LP */ + +diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c +index 75ab2ffbf235f..d7233f2238651 100644 +--- a/drivers/misc/mei/pci-me.c ++++ b/drivers/misc/mei/pci-me.c +@@ -103,6 +103,7 @@ static const struct pci_device_id mei_me_pci_tbl[] = { + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_H_3, MEI_ME_PCH8_CFG)}, + + {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)}, ++ {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_N, MEI_ME_PCH12_CFG)}, + + {MEI_PCI_DEVICE(MEI_DEV_ID_TGP_LP, MEI_ME_PCH12_CFG)}, + +diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig +index e8e9c166185de..2d4eb2f280a12 100644 +--- a/drivers/net/ethernet/Kconfig ++++ b/drivers/net/ethernet/Kconfig +@@ -100,6 +100,7 @@ config JME + config KORINA + tristate "Korina (IDT RC32434) Ethernet support" + depends on MIKROTIK_RB532 ++ select CRC32 + ---help--- + If you have a Mikrotik RouterBoard 500 or IDT RC32434 + based system say Y. Otherwise say N. +diff --git a/drivers/net/ethernet/arc/Kconfig b/drivers/net/ethernet/arc/Kconfig +index 45c663d8b9aab..2cd0e45d0b6c1 100644 +--- a/drivers/net/ethernet/arc/Kconfig ++++ b/drivers/net/ethernet/arc/Kconfig +@@ -21,6 +21,7 @@ config ARC_EMAC_CORE + depends on ARC || ARCH_ROCKCHIP || COMPILE_TEST + select MII + select PHYLIB ++ select CRC32 + + config ARC_EMAC + tristate "ARC EMAC support" +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +index 24c49a84947f3..5f4f0f61c83c8 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +@@ -3805,20 +3805,67 @@ static int set_feature_rx_all(struct net_device *netdev, bool enable) + return mlx5_set_port_fcs(mdev, !enable); + } + ++static int mlx5e_set_rx_port_ts(struct mlx5_core_dev *mdev, bool enable) ++{ ++ u32 in[MLX5_ST_SZ_DW(pcmr_reg)] = {}; ++ bool supported, curr_state; ++ int err; ++ ++ if (!MLX5_CAP_GEN(mdev, ports_check)) ++ return 0; ++ ++ err = mlx5_query_ports_check(mdev, in, sizeof(in)); ++ if (err) ++ return err; ++ ++ supported = MLX5_GET(pcmr_reg, in, rx_ts_over_crc_cap); ++ curr_state = MLX5_GET(pcmr_reg, in, rx_ts_over_crc); ++ ++ if (!supported || enable == curr_state) ++ return 0; ++ ++ MLX5_SET(pcmr_reg, in, local_port, 1); ++ MLX5_SET(pcmr_reg, in, rx_ts_over_crc, enable); ++ ++ return mlx5_set_ports_check(mdev, in, sizeof(in)); ++} ++ + static int set_feature_rx_fcs(struct net_device *netdev, bool enable) + { + struct mlx5e_priv *priv = netdev_priv(netdev); ++ struct mlx5e_channels *chs = &priv->channels; ++ struct mlx5_core_dev *mdev = priv->mdev; + int err; + + mutex_lock(&priv->state_lock); + +- priv->channels.params.scatter_fcs_en = enable; +- err = mlx5e_modify_channels_scatter_fcs(&priv->channels, enable); +- if (err) +- priv->channels.params.scatter_fcs_en = !enable; ++ if (enable) { ++ err = mlx5e_set_rx_port_ts(mdev, false); ++ if (err) ++ goto out; + +- mutex_unlock(&priv->state_lock); ++ chs->params.scatter_fcs_en = true; ++ err = mlx5e_modify_channels_scatter_fcs(chs, true); ++ if (err) { ++ chs->params.scatter_fcs_en = false; ++ mlx5e_set_rx_port_ts(mdev, true); ++ } ++ } else { ++ chs->params.scatter_fcs_en = false; ++ err = mlx5e_modify_channels_scatter_fcs(chs, false); ++ if (err) { ++ chs->params.scatter_fcs_en = true; ++ goto out; ++ } ++ err = mlx5e_set_rx_port_ts(mdev, true); ++ if (err) { ++ mlx5_core_warn(mdev, "Failed to set RX port timestamp %d\n", err); ++ err = 0; ++ } ++ } + ++out: ++ mutex_unlock(&priv->state_lock); + return err; + } + +diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +index c3fc1cc4bb2b9..882ea12098b7a 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +@@ -25,16 +25,8 @@ + #define MLXSW_THERMAL_ZONE_MAX_NAME 16 + #define MLXSW_THERMAL_TEMP_SCORE_MAX GENMASK(31, 0) + #define MLXSW_THERMAL_MAX_STATE 10 ++#define MLXSW_THERMAL_MIN_STATE 2 + #define MLXSW_THERMAL_MAX_DUTY 255 +-/* Minimum and maximum fan allowed speed in percent: from 20% to 100%. Values +- * MLXSW_THERMAL_MAX_STATE + x, where x is between 2 and 10 are used for +- * setting fan speed dynamic minimum. For example, if value is set to 14 (40%) +- * cooling levels vector will be set to 4, 4, 4, 4, 4, 5, 6, 7, 8, 9, 10 to +- * introduce PWM speed in percent: 40, 40, 40, 40, 40, 50, 60. 70, 80, 90, 100. +- */ +-#define MLXSW_THERMAL_SPEED_MIN (MLXSW_THERMAL_MAX_STATE + 2) +-#define MLXSW_THERMAL_SPEED_MAX (MLXSW_THERMAL_MAX_STATE * 2) +-#define MLXSW_THERMAL_SPEED_MIN_LEVEL 2 /* 20% */ + + /* External cooling devices, allowed for binding to mlxsw thermal zones. */ + static char * const mlxsw_thermal_external_allowed_cdev[] = { +@@ -703,49 +695,16 @@ static int mlxsw_thermal_set_cur_state(struct thermal_cooling_device *cdev, + struct mlxsw_thermal *thermal = cdev->devdata; + struct device *dev = thermal->bus_info->dev; + char mfsc_pl[MLXSW_REG_MFSC_LEN]; +- unsigned long cur_state, i; + int idx; +- u8 duty; + int err; + ++ if (state > MLXSW_THERMAL_MAX_STATE) ++ return -EINVAL; ++ + idx = mlxsw_get_cooling_device_idx(thermal, cdev); + if (idx < 0) + return idx; + +- /* Verify if this request is for changing allowed fan dynamical +- * minimum. If it is - update cooling levels accordingly and update +- * state, if current state is below the newly requested minimum state. +- * For example, if current state is 5, and minimal state is to be +- * changed from 4 to 6, thermal->cooling_levels[0 to 5] will be changed +- * all from 4 to 6. And state 5 (thermal->cooling_levels[4]) should be +- * overwritten. +- */ +- if (state >= MLXSW_THERMAL_SPEED_MIN && +- state <= MLXSW_THERMAL_SPEED_MAX) { +- state -= MLXSW_THERMAL_MAX_STATE; +- for (i = 0; i <= MLXSW_THERMAL_MAX_STATE; i++) +- thermal->cooling_levels[i] = max(state, i); +- +- mlxsw_reg_mfsc_pack(mfsc_pl, idx, 0); +- err = mlxsw_reg_query(thermal->core, MLXSW_REG(mfsc), mfsc_pl); +- if (err) +- return err; +- +- duty = mlxsw_reg_mfsc_pwm_duty_cycle_get(mfsc_pl); +- cur_state = mlxsw_duty_to_state(duty); +- +- /* If current fan state is lower than requested dynamical +- * minimum, increase fan speed up to dynamical minimum. +- */ +- if (state < cur_state) +- return 0; +- +- state = cur_state; +- } +- +- if (state > MLXSW_THERMAL_MAX_STATE) +- return -EINVAL; +- + /* Normalize the state to the valid speed range. */ + state = thermal->cooling_levels[state]; + mlxsw_reg_mfsc_pack(mfsc_pl, idx, mlxsw_state_to_duty(state)); +@@ -1040,8 +999,7 @@ int mlxsw_thermal_init(struct mlxsw_core *core, + + /* Initialize cooling levels per PWM state. */ + for (i = 0; i < MLXSW_THERMAL_MAX_STATE; i++) +- thermal->cooling_levels[i] = max(MLXSW_THERMAL_SPEED_MIN_LEVEL, +- i); ++ thermal->cooling_levels[i] = max(MLXSW_THERMAL_MIN_STATE, i); + + thermal->polling_delay = bus_info->low_frequency ? + MLXSW_THERMAL_SLOW_POLL_INT : +diff --git a/drivers/net/ethernet/microchip/encx24j600-regmap.c b/drivers/net/ethernet/microchip/encx24j600-regmap.c +index 1f496fac70332..e2528633c09a1 100644 +--- a/drivers/net/ethernet/microchip/encx24j600-regmap.c ++++ b/drivers/net/ethernet/microchip/encx24j600-regmap.c +@@ -502,13 +502,19 @@ static struct regmap_bus phymap_encx24j600 = { + .reg_read = regmap_encx24j600_phy_reg_read, + }; + +-void devm_regmap_init_encx24j600(struct device *dev, +- struct encx24j600_context *ctx) ++int devm_regmap_init_encx24j600(struct device *dev, ++ struct encx24j600_context *ctx) + { + mutex_init(&ctx->mutex); + regcfg.lock_arg = ctx; + ctx->regmap = devm_regmap_init(dev, ®map_encx24j600, ctx, ®cfg); ++ if (IS_ERR(ctx->regmap)) ++ return PTR_ERR(ctx->regmap); + ctx->phymap = devm_regmap_init(dev, &phymap_encx24j600, ctx, &phycfg); ++ if (IS_ERR(ctx->phymap)) ++ return PTR_ERR(ctx->phymap); ++ ++ return 0; + } + EXPORT_SYMBOL_GPL(devm_regmap_init_encx24j600); + +diff --git a/drivers/net/ethernet/microchip/encx24j600.c b/drivers/net/ethernet/microchip/encx24j600.c +index c3a6edc0ddf62..6b43afc4e3246 100644 +--- a/drivers/net/ethernet/microchip/encx24j600.c ++++ b/drivers/net/ethernet/microchip/encx24j600.c +@@ -1027,10 +1027,13 @@ static int encx24j600_spi_probe(struct spi_device *spi) + priv->speed = SPEED_100; + + priv->ctx.spi = spi; +- devm_regmap_init_encx24j600(&spi->dev, &priv->ctx); + ndev->irq = spi->irq; + ndev->netdev_ops = &encx24j600_netdev_ops; + ++ ret = devm_regmap_init_encx24j600(&spi->dev, &priv->ctx); ++ if (ret) ++ goto out_free; ++ + mutex_init(&priv->lock); + + /* Reset device and check if it is connected */ +diff --git a/drivers/net/ethernet/microchip/encx24j600_hw.h b/drivers/net/ethernet/microchip/encx24j600_hw.h +index f604a260ede79..711147a159aa9 100644 +--- a/drivers/net/ethernet/microchip/encx24j600_hw.h ++++ b/drivers/net/ethernet/microchip/encx24j600_hw.h +@@ -15,8 +15,8 @@ struct encx24j600_context { + int bank; + }; + +-void devm_regmap_init_encx24j600(struct device *dev, +- struct encx24j600_context *ctx); ++int devm_regmap_init_encx24j600(struct device *dev, ++ struct encx24j600_context *ctx); + + /* Single-byte instructions */ + #define BANK_SELECT(bank) (0xC0 | ((bank & (BANK_MASK >> BANK_SHIFT)) << 1)) +diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c +index e0b2bf3279053..71ab4e9c9a171 100644 +--- a/drivers/net/ethernet/neterion/s2io.c ++++ b/drivers/net/ethernet/neterion/s2io.c +@@ -8565,7 +8565,7 @@ static void s2io_io_resume(struct pci_dev *pdev) + return; + } + +- if (s2io_set_mac_addr(netdev, netdev->dev_addr) == FAILURE) { ++ if (do_s2io_prog_unicast(netdev, netdev->dev_addr) == FAILURE) { + s2io_card_down(sp); + pr_err("Can't restore mac addr after reset.\n"); + return; +diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c +index e66002251596b..99ba3551458fc 100644 +--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c ++++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c +@@ -912,6 +912,10 @@ static int ionic_addr_add(struct net_device *netdev, const u8 *addr) + + static int ionic_addr_del(struct net_device *netdev, const u8 *addr) + { ++ /* Don't delete our own address from the uc list */ ++ if (ether_addr_equal(addr, netdev->dev_addr)) ++ return 0; ++ + return ionic_lif_addr(netdev_priv(netdev), addr, false); + } + +diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c +index 1db49424aa43c..1cbcc27602780 100644 +--- a/drivers/net/ethernet/qlogic/qed/qed_main.c ++++ b/drivers/net/ethernet/qlogic/qed/qed_main.c +@@ -1238,6 +1238,7 @@ static int qed_slowpath_start(struct qed_dev *cdev, + } else { + DP_NOTICE(cdev, + "Failed to acquire PTT for aRFS\n"); ++ rc = -EINVAL; + goto err; + } + } +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c +index 2bac49b49f739..fbf2deafe8ba3 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c +@@ -218,11 +218,18 @@ static void dwmac1000_dump_dma_regs(void __iomem *ioaddr, u32 *reg_space) + readl(ioaddr + DMA_BUS_MODE + i * 4); + } + +-static void dwmac1000_get_hw_feature(void __iomem *ioaddr, +- struct dma_features *dma_cap) ++static int dwmac1000_get_hw_feature(void __iomem *ioaddr, ++ struct dma_features *dma_cap) + { + u32 hw_cap = readl(ioaddr + DMA_HW_FEATURE); + ++ if (!hw_cap) { ++ /* 0x00000000 is the value read on old hardware that does not ++ * implement this register ++ */ ++ return -EOPNOTSUPP; ++ } ++ + dma_cap->mbps_10_100 = (hw_cap & DMA_HW_FEAT_MIISEL); + dma_cap->mbps_1000 = (hw_cap & DMA_HW_FEAT_GMIISEL) >> 1; + dma_cap->half_duplex = (hw_cap & DMA_HW_FEAT_HDSEL) >> 2; +@@ -252,6 +259,8 @@ static void dwmac1000_get_hw_feature(void __iomem *ioaddr, + dma_cap->number_tx_channel = (hw_cap & DMA_HW_FEAT_TXCHCNT) >> 22; + /* Alternate (enhanced) DESC mode */ + dma_cap->enh_desc = (hw_cap & DMA_HW_FEAT_ENHDESSEL) >> 24; ++ ++ return 0; + } + + static void dwmac1000_rx_watchdog(void __iomem *ioaddr, u32 riwt, +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +index 0d993f4b701c2..ae473d85b7fb8 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +@@ -336,8 +336,8 @@ static void dwmac4_dma_tx_chan_op_mode(void __iomem *ioaddr, int mode, + writel(mtl_tx_op, ioaddr + MTL_CHAN_TX_OP_MODE(channel)); + } + +-static void dwmac4_get_hw_feature(void __iomem *ioaddr, +- struct dma_features *dma_cap) ++static int dwmac4_get_hw_feature(void __iomem *ioaddr, ++ struct dma_features *dma_cap) + { + u32 hw_cap = readl(ioaddr + GMAC_HW_FEATURE0); + +@@ -400,6 +400,8 @@ static void dwmac4_get_hw_feature(void __iomem *ioaddr, + dma_cap->frpbs = (hw_cap & GMAC_HW_FEAT_FRPBS) >> 11; + dma_cap->frpsel = (hw_cap & GMAC_HW_FEAT_FRPSEL) >> 10; + dma_cap->dvlan = (hw_cap & GMAC_HW_FEAT_DVLAN) >> 5; ++ ++ return 0; + } + + /* Enable/disable TSO feature and set MSS */ +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +index 4af7271cea561..07ef0ac725b3e 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +@@ -356,8 +356,8 @@ static int dwxgmac2_dma_interrupt(void __iomem *ioaddr, + return ret; + } + +-static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, +- struct dma_features *dma_cap) ++static int dwxgmac2_get_hw_feature(void __iomem *ioaddr, ++ struct dma_features *dma_cap) + { + u32 hw_cap; + +@@ -425,6 +425,8 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, + dma_cap->frpes = (hw_cap & XGMAC_HWFEAT_FRPES) >> 11; + dma_cap->frpbs = (hw_cap & XGMAC_HWFEAT_FRPPB) >> 9; + dma_cap->frpsel = (hw_cap & XGMAC_HWFEAT_FRPSEL) >> 3; ++ ++ return 0; + } + + static void dwxgmac2_rx_watchdog(void __iomem *ioaddr, u32 riwt, u32 nchan) +diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h +index 9010d881b12e5..59a1d8c003721 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h ++++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h +@@ -196,8 +196,8 @@ struct stmmac_dma_ops { + int (*dma_interrupt) (void __iomem *ioaddr, + struct stmmac_extra_stats *x, u32 chan); + /* If supported then get the optional core features */ +- void (*get_hw_feature)(void __iomem *ioaddr, +- struct dma_features *dma_cap); ++ int (*get_hw_feature)(void __iomem *ioaddr, ++ struct dma_features *dma_cap); + /* Program the HW RX Watchdog */ + void (*rx_watchdog)(void __iomem *ioaddr, u32 riwt, u32 number_chan); + void (*set_tx_ring_len)(void __iomem *ioaddr, u32 len, u32 chan); +@@ -247,7 +247,7 @@ struct stmmac_dma_ops { + #define stmmac_dma_interrupt_status(__priv, __args...) \ + stmmac_do_callback(__priv, dma, dma_interrupt, __args) + #define stmmac_get_hw_feature(__priv, __args...) \ +- stmmac_do_void_callback(__priv, dma, get_hw_feature, __args) ++ stmmac_do_callback(__priv, dma, get_hw_feature, __args) + #define stmmac_rx_watchdog(__priv, __args...) \ + stmmac_do_void_callback(__priv, dma, rx_watchdog, __args) + #define stmmac_set_tx_ring_len(__priv, __args...) \ +diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig +index 05bdcc5917f6b..ca234d1a0e3bf 100644 +--- a/drivers/net/usb/Kconfig ++++ b/drivers/net/usb/Kconfig +@@ -99,6 +99,10 @@ config USB_RTL8150 + config USB_RTL8152 + tristate "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters" + select MII ++ select CRC32 ++ select CRYPTO ++ select CRYPTO_HASH ++ select CRYPTO_SHA256 + help + This option adds support for Realtek RTL8152 based USB 2.0 + 10/100 Ethernet adapters and RTL8153 based USB 3.0 10/100/1000 +diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c +index 6da270e8c6746..c0f4324d8f7c8 100644 +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -954,7 +954,8 @@ static void nvmem_shift_read_buffer_in_place(struct nvmem_cell *cell, void *buf) + *p-- = 0; + + /* clear msb bits if any leftover in the last byte */ +- *p &= GENMASK((cell->nbits%BITS_PER_BYTE) - 1, 0); ++ if (cell->nbits % BITS_PER_BYTE) ++ *p &= GENMASK((cell->nbits % BITS_PER_BYTE) - 1, 0); + } + + static int __nvmem_cell_read(struct nvmem_device *nvmem, +diff --git a/drivers/platform/mellanox/mlxreg-io.c b/drivers/platform/mellanox/mlxreg-io.c +index acfaf64ffde68..1c3760c13f832 100644 +--- a/drivers/platform/mellanox/mlxreg-io.c ++++ b/drivers/platform/mellanox/mlxreg-io.c +@@ -123,7 +123,7 @@ mlxreg_io_attr_store(struct device *dev, struct device_attribute *attr, + return -EINVAL; + + /* Convert buffer to input value. */ +- ret = kstrtou32(buf, len, &input_val); ++ ret = kstrtou32(buf, 0, &input_val); + if (ret) + return ret; + +diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c +index d242779297ba7..ae8fa4ff05ee3 100644 +--- a/drivers/usb/host/xhci-pci.c ++++ b/drivers/usb/host/xhci-pci.c +@@ -28,6 +28,7 @@ + #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 + #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 + #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1009 0x1009 ++#define PCI_DEVICE_ID_FRESCO_LOGIC_FL1100 0x1100 + #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1400 0x1400 + + #define PCI_VENDOR_ID_ETRON 0x1b6f +@@ -98,6 +99,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) + /* Look for vendor-specific quirks */ + if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && + (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK || ++ pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1100 || + pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1400)) { + if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK && + pdev->revision == 0x0) { +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c +index 1228b3d92db06..2c92fd19e7822 100644 +--- a/drivers/usb/host/xhci-ring.c ++++ b/drivers/usb/host/xhci-ring.c +@@ -339,16 +339,22 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci, + /* Must be called with xhci->lock held, releases and aquires lock back */ + static int xhci_abort_cmd_ring(struct xhci_hcd *xhci, unsigned long flags) + { +- u64 temp_64; ++ u32 temp_32; + int ret; + + xhci_dbg(xhci, "Abort command ring\n"); + + reinit_completion(&xhci->cmd_ring_stop_completion); + +- temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); +- xhci_write_64(xhci, temp_64 | CMD_RING_ABORT, +- &xhci->op_regs->cmd_ring); ++ /* ++ * The control bits like command stop, abort are located in lower ++ * dword of the command ring control register. Limit the write ++ * to the lower dword to avoid corrupting the command ring pointer ++ * in case if the command ring is stopped by the time upper dword ++ * is written. ++ */ ++ temp_32 = readl(&xhci->op_regs->cmd_ring); ++ writel(temp_32 | CMD_RING_ABORT, &xhci->op_regs->cmd_ring); + + /* Section 4.6.1.2 of xHCI 1.0 spec says software should also time the + * completion of the Command Abort operation. If CRR is not negated in 5 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c +index 02a2afd130eb6..4ef7484dff8b2 100644 +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -3173,10 +3173,13 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd, + return; + + /* Bail out if toggle is already being cleared by a endpoint reset */ ++ spin_lock_irqsave(&xhci->lock, flags); + if (ep->ep_state & EP_HARD_CLEAR_TOGGLE) { + ep->ep_state &= ~EP_HARD_CLEAR_TOGGLE; ++ spin_unlock_irqrestore(&xhci->lock, flags); + return; + } ++ spin_unlock_irqrestore(&xhci->lock, flags); + /* Only interrupt and bulk ep's use data toggle, USB2 spec 5.5.4-> */ + if (usb_endpoint_xfer_control(&host_ep->desc) || + usb_endpoint_xfer_isoc(&host_ep->desc)) +@@ -3262,8 +3265,10 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd, + xhci_free_command(xhci, cfg_cmd); + cleanup: + xhci_free_command(xhci, stop_cmd); ++ spin_lock_irqsave(&xhci->lock, flags); + if (ep->ep_state & EP_SOFT_CLEAR_TOGGLE) + ep->ep_state &= ~EP_SOFT_CLEAR_TOGGLE; ++ spin_unlock_irqrestore(&xhci->lock, flags); + } + + static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, +diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c +index 89d659cef5c63..1b9ebd756f097 100644 +--- a/drivers/usb/musb/musb_dsps.c ++++ b/drivers/usb/musb/musb_dsps.c +@@ -899,11 +899,13 @@ static int dsps_probe(struct platform_device *pdev) + if (usb_get_dr_mode(&pdev->dev) == USB_DR_MODE_PERIPHERAL) { + ret = dsps_setup_optional_vbus_irq(pdev, glue); + if (ret) +- goto err; ++ goto unregister_pdev; + } + + return 0; + ++unregister_pdev: ++ platform_device_unregister(glue->musb); + err: + pm_runtime_disable(&pdev->dev); + iounmap(glue->usbss_base); +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c +index 82016d9781460..a1e9cbe518c74 100644 +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -246,11 +246,13 @@ static void option_instat_callback(struct urb *urb); + /* These Quectel products use Quectel's vendor ID */ + #define QUECTEL_PRODUCT_EC21 0x0121 + #define QUECTEL_PRODUCT_EC25 0x0125 ++#define QUECTEL_PRODUCT_EG91 0x0191 + #define QUECTEL_PRODUCT_EG95 0x0195 + #define QUECTEL_PRODUCT_BG96 0x0296 + #define QUECTEL_PRODUCT_EP06 0x0306 + #define QUECTEL_PRODUCT_EM12 0x0512 + #define QUECTEL_PRODUCT_RM500Q 0x0800 ++#define QUECTEL_PRODUCT_EC200S_CN 0x6002 + #define QUECTEL_PRODUCT_EC200T 0x6026 + + #define CMOTECH_VENDOR_ID 0x16d8 +@@ -1111,6 +1113,9 @@ static const struct usb_device_id option_ids[] = { + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0xff, 0xff), + .driver_info = NUMEP2 }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0, 0) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG91, 0xff, 0xff, 0xff), ++ .driver_info = NUMEP2 }, ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG91, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff), + .driver_info = NUMEP2 }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) }, +@@ -1128,6 +1133,7 @@ static const struct usb_device_id option_ids[] = { + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x10), + .driver_info = ZLP }, ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) }, + + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, +@@ -1227,6 +1233,8 @@ static const struct usb_device_id option_ids[] = { + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1203, 0xff), /* Telit LE910Cx (RNDIS) */ + .driver_info = NCTRL(2) | RSVD(3) }, ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1204, 0xff), /* Telit LE910Cx (MBIM) */ ++ .driver_info = NCTRL(0) | RSVD(1) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), +diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c +index 0f60363c1bbc8..b1b9923162a04 100644 +--- a/drivers/usb/serial/qcserial.c ++++ b/drivers/usb/serial/qcserial.c +@@ -165,6 +165,7 @@ static const struct usb_device_id id_table[] = { + {DEVICE_SWI(0x1199, 0x907b)}, /* Sierra Wireless EM74xx */ + {DEVICE_SWI(0x1199, 0x9090)}, /* Sierra Wireless EM7565 QDL */ + {DEVICE_SWI(0x1199, 0x9091)}, /* Sierra Wireless EM7565 */ ++ {DEVICE_SWI(0x1199, 0x90d2)}, /* Sierra Wireless EM9191 QDL */ + {DEVICE_SWI(0x413c, 0x81a2)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ + {DEVICE_SWI(0x413c, 0x81a3)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ + {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ +diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c +index 59a05f1b81054..91627e7443260 100644 +--- a/drivers/virtio/virtio.c ++++ b/drivers/virtio/virtio.c +@@ -225,6 +225,17 @@ static int virtio_dev_probe(struct device *_d) + driver_features_legacy = driver_features; + } + ++ /* ++ * Some devices detect legacy solely via F_VERSION_1. Write ++ * F_VERSION_1 to force LE config space accesses before FEATURES_OK for ++ * these when needed. ++ */ ++ if (drv->validate && !virtio_legacy_is_little_endian() ++ && device_features & BIT_ULL(VIRTIO_F_VERSION_1)) { ++ dev->features = BIT_ULL(VIRTIO_F_VERSION_1); ++ dev->config->finalize_features(dev); ++ } ++ + if (device_features & (1ULL << VIRTIO_F_VERSION_1)) + dev->features = driver_features & device_features; + else +diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c +index 8e6dfe76f9c9d..4ddb4ea2e4a32 100644 +--- a/drivers/watchdog/orion_wdt.c ++++ b/drivers/watchdog/orion_wdt.c +@@ -52,7 +52,7 @@ + #define WDT_A370_RATIO (1 << WDT_A370_RATIO_SHIFT) + + static bool nowayout = WATCHDOG_NOWAYOUT; +-static int heartbeat = -1; /* module parameter (seconds) */ ++static int heartbeat; /* module parameter (seconds) */ + + struct orion_watchdog; + +diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c +index 5273965226534..19d2104c04629 100644 +--- a/fs/btrfs/extent-tree.c ++++ b/fs/btrfs/extent-tree.c +@@ -4596,6 +4596,7 @@ struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans, + out_free_delayed: + btrfs_free_delayed_extent_op(extent_op); + out_free_buf: ++ btrfs_tree_unlock(buf); + free_extent_buffer(buf); + out_free_reserved: + btrfs_free_reserved_extent(fs_info, ins.objectid, ins.offset, 0); +diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c +index 8ea4b3da85d1a..9d358dafef367 100644 +--- a/fs/btrfs/tree-log.c ++++ b/fs/btrfs/tree-log.c +@@ -1160,7 +1160,10 @@ next: + /* look for a conflicting sequence number */ + di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(dir), + ref_index, name, namelen, 0); +- if (di && !IS_ERR(di)) { ++ if (IS_ERR(di)) { ++ if (PTR_ERR(di) != -ENOENT) ++ return PTR_ERR(di); ++ } else if (di) { + ret = drop_one_dir_item(trans, root, path, dir, di); + if (ret) + return ret; +@@ -1170,7 +1173,9 @@ next: + /* look for a conflicting name */ + di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(dir), + name, namelen, 0); +- if (di && !IS_ERR(di)) { ++ if (IS_ERR(di)) { ++ return PTR_ERR(di); ++ } else if (di) { + ret = drop_one_dir_item(trans, root, path, dir, di); + if (ret) + return ret; +@@ -1944,8 +1949,8 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, + struct btrfs_key log_key; + struct inode *dir; + u8 log_type; +- int exists; +- int ret = 0; ++ bool exists; ++ int ret; + bool update_size = (key->type == BTRFS_DIR_INDEX_KEY); + bool name_added = false; + +@@ -1965,12 +1970,12 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, + name_len); + + btrfs_dir_item_key_to_cpu(eb, di, &log_key); +- exists = btrfs_lookup_inode(trans, root, path, &log_key, 0); +- if (exists == 0) +- exists = 1; +- else +- exists = 0; ++ ret = btrfs_lookup_inode(trans, root, path, &log_key, 0); + btrfs_release_path(path); ++ if (ret < 0) ++ goto out; ++ exists = (ret == 0); ++ ret = 0; + + if (key->type == BTRFS_DIR_ITEM_KEY) { + dst_di = btrfs_lookup_dir_item(trans, root, path, key->objectid, +@@ -1985,7 +1990,14 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, + ret = -EINVAL; + goto out; + } +- if (IS_ERR_OR_NULL(dst_di)) { ++ ++ if (dst_di == ERR_PTR(-ENOENT)) ++ dst_di = NULL; ++ ++ if (IS_ERR(dst_di)) { ++ ret = PTR_ERR(dst_di); ++ goto out; ++ } else if (!dst_di) { + /* we need a sequence number to insert, so we only + * do inserts for the BTRFS_DIR_INDEX_KEY types + */ +diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c +index ab5e92897270a..81c9eab8529b6 100644 +--- a/fs/overlayfs/file.c ++++ b/fs/overlayfs/file.c +@@ -296,48 +296,6 @@ out_unlock: + return ret; + } + +-static ssize_t ovl_splice_read(struct file *in, loff_t *ppos, +- struct pipe_inode_info *pipe, size_t len, +- unsigned int flags) +-{ +- ssize_t ret; +- struct fd real; +- const struct cred *old_cred; +- +- ret = ovl_real_fdget(in, &real); +- if (ret) +- return ret; +- +- old_cred = ovl_override_creds(file_inode(in)->i_sb); +- ret = generic_file_splice_read(real.file, ppos, pipe, len, flags); +- revert_creds(old_cred); +- +- ovl_file_accessed(in); +- fdput(real); +- return ret; +-} +- +-static ssize_t +-ovl_splice_write(struct pipe_inode_info *pipe, struct file *out, +- loff_t *ppos, size_t len, unsigned int flags) +-{ +- struct fd real; +- const struct cred *old_cred; +- ssize_t ret; +- +- ret = ovl_real_fdget(out, &real); +- if (ret) +- return ret; +- +- old_cred = ovl_override_creds(file_inode(out)->i_sb); +- ret = iter_file_splice_write(pipe, real.file, ppos, len, flags); +- revert_creds(old_cred); +- +- ovl_file_accessed(out); +- fdput(real); +- return ret; +-} +- + static int ovl_fsync(struct file *file, loff_t start, loff_t end, int datasync) + { + struct fd real; +@@ -694,8 +652,8 @@ const struct file_operations ovl_file_operations = { + .fadvise = ovl_fadvise, + .unlocked_ioctl = ovl_ioctl, + .compat_ioctl = ovl_compat_ioctl, +- .splice_read = ovl_splice_read, +- .splice_write = ovl_splice_write, ++ .splice_read = generic_file_splice_read, ++ .splice_write = iter_file_splice_write, + + .copy_file_range = ovl_copy_file_range, + .remap_file_range = ovl_remap_file_range, +diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h +index 36516fe86fe7c..641a01bc5f6f7 100644 +--- a/include/linux/mlx5/mlx5_ifc.h ++++ b/include/linux/mlx5/mlx5_ifc.h +@@ -8942,16 +8942,22 @@ struct mlx5_ifc_pcmr_reg_bits { + u8 reserved_at_0[0x8]; + u8 local_port[0x8]; + u8 reserved_at_10[0x10]; ++ + u8 entropy_force_cap[0x1]; + u8 entropy_calc_cap[0x1]; + u8 entropy_gre_calc_cap[0x1]; +- u8 reserved_at_23[0x1b]; ++ u8 reserved_at_23[0xf]; ++ u8 rx_ts_over_crc_cap[0x1]; ++ u8 reserved_at_33[0xb]; + u8 fcs_cap[0x1]; + u8 reserved_at_3f[0x1]; ++ + u8 entropy_force[0x1]; + u8 entropy_calc[0x1]; + u8 entropy_gre_calc[0x1]; +- u8 reserved_at_43[0x1b]; ++ u8 reserved_at_43[0xf]; ++ u8 rx_ts_over_crc[0x1]; ++ u8 reserved_at_53[0xb]; + u8 fcs_chk[0x1]; + u8 reserved_at_5f[0x1]; + }; +diff --git a/net/nfc/af_nfc.c b/net/nfc/af_nfc.c +index 4a9e72073564a..581358dcbdf8d 100644 +--- a/net/nfc/af_nfc.c ++++ b/net/nfc/af_nfc.c +@@ -60,6 +60,9 @@ int nfc_proto_register(const struct nfc_protocol *nfc_proto) + proto_tab[nfc_proto->id] = nfc_proto; + write_unlock(&proto_tab_lock); + ++ if (rc) ++ proto_unregister(nfc_proto->proto); ++ + return rc; + } + EXPORT_SYMBOL(nfc_proto_register); +diff --git a/net/nfc/digital_core.c b/net/nfc/digital_core.c +index e3599ed4a7a87..9c9caa307cf16 100644 +--- a/net/nfc/digital_core.c ++++ b/net/nfc/digital_core.c +@@ -277,6 +277,7 @@ int digital_tg_configure_hw(struct nfc_digital_dev *ddev, int type, int param) + static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech) + { + struct digital_tg_mdaa_params *params; ++ int rc; + + params = kzalloc(sizeof(*params), GFP_KERNEL); + if (!params) +@@ -291,8 +292,12 @@ static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech) + get_random_bytes(params->nfcid2 + 2, NFC_NFCID2_MAXSIZE - 2); + params->sc = DIGITAL_SENSF_FELICA_SC; + +- return digital_send_cmd(ddev, DIGITAL_CMD_TG_LISTEN_MDAA, NULL, params, +- 500, digital_tg_recv_atr_req, NULL); ++ rc = digital_send_cmd(ddev, DIGITAL_CMD_TG_LISTEN_MDAA, NULL, params, ++ 500, digital_tg_recv_atr_req, NULL); ++ if (rc) ++ kfree(params); ++ ++ return rc; + } + + static int digital_tg_listen_md(struct nfc_digital_dev *ddev, u8 rf_tech) +diff --git a/net/nfc/digital_technology.c b/net/nfc/digital_technology.c +index 84d2345c75a3f..3adf4589852af 100644 +--- a/net/nfc/digital_technology.c ++++ b/net/nfc/digital_technology.c +@@ -465,8 +465,12 @@ static int digital_in_send_sdd_req(struct nfc_digital_dev *ddev, + skb_put_u8(skb, sel_cmd); + skb_put_u8(skb, DIGITAL_SDD_REQ_SEL_PAR); + +- return digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sdd_res, +- target); ++ rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sdd_res, ++ target); ++ if (rc) ++ kfree_skb(skb); ++ ++ return rc; + } + + static void digital_in_recv_sens_res(struct nfc_digital_dev *ddev, void *arg, +diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c +index 8766ab5b87880..5eb3b1b7ae5e7 100644 +--- a/net/sched/sch_mqprio.c ++++ b/net/sched/sch_mqprio.c +@@ -529,22 +529,28 @@ static int mqprio_dump_class_stats(struct Qdisc *sch, unsigned long cl, + for (i = tc.offset; i < tc.offset + tc.count; i++) { + struct netdev_queue *q = netdev_get_tx_queue(dev, i); + struct Qdisc *qdisc = rtnl_dereference(q->qdisc); +- struct gnet_stats_basic_cpu __percpu *cpu_bstats = NULL; +- struct gnet_stats_queue __percpu *cpu_qstats = NULL; + + spin_lock_bh(qdisc_lock(qdisc)); ++ + if (qdisc_is_percpu_stats(qdisc)) { +- cpu_bstats = qdisc->cpu_bstats; +- cpu_qstats = qdisc->cpu_qstats; ++ qlen = qdisc_qlen_sum(qdisc); ++ ++ __gnet_stats_copy_basic(NULL, &bstats, ++ qdisc->cpu_bstats, ++ &qdisc->bstats); ++ __gnet_stats_copy_queue(&qstats, ++ qdisc->cpu_qstats, ++ &qdisc->qstats, ++ qlen); ++ } else { ++ qlen += qdisc->q.qlen; ++ bstats.bytes += qdisc->bstats.bytes; ++ bstats.packets += qdisc->bstats.packets; ++ qstats.backlog += qdisc->qstats.backlog; ++ qstats.drops += qdisc->qstats.drops; ++ qstats.requeues += qdisc->qstats.requeues; ++ qstats.overlimits += qdisc->qstats.overlimits; + } +- +- qlen = qdisc_qlen_sum(qdisc); +- __gnet_stats_copy_basic(NULL, &sch->bstats, +- cpu_bstats, &qdisc->bstats); +- __gnet_stats_copy_queue(&sch->qstats, +- cpu_qstats, +- &qdisc->qstats, +- qlen); + spin_unlock_bh(qdisc_lock(qdisc)); + } + +diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c +index 000aa62281f46..4eebe708c8e4e 100644 +--- a/net/sctp/sm_make_chunk.c ++++ b/net/sctp/sm_make_chunk.c +@@ -3659,7 +3659,7 @@ struct sctp_chunk *sctp_make_strreset_req( + outlen = (sizeof(outreq) + stream_len) * out; + inlen = (sizeof(inreq) + stream_len) * in; + +- retval = sctp_make_reconf(asoc, outlen + inlen); ++ retval = sctp_make_reconf(asoc, SCTP_PAD4(outlen) + SCTP_PAD4(inlen)); + if (!retval) + return NULL; + +diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl +index 4f84657f55c23..f459ae883a0a6 100755 +--- a/scripts/recordmcount.pl ++++ b/scripts/recordmcount.pl +@@ -222,7 +222,7 @@ if ($arch =~ /(x86(_64)?)|(i386)/) { + $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)"; + $weak_regex = "^[0-9a-fA-F]+\\s+([wW])\\s+(\\S+)"; + $section_regex = "Disassembly of section\\s+(\\S+):"; +-$function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; ++$function_regex = "^([0-9a-fA-F]+)\\s+<([^^]*?)>:"; + $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s(mcount|__fentry__)\$"; + $section_type = '@progbits'; + $mcount_adjust = 0; +diff --git a/sound/core/seq_device.c b/sound/core/seq_device.c +index e9dbad93f9d09..c9223049551c4 100644 +--- a/sound/core/seq_device.c ++++ b/sound/core/seq_device.c +@@ -147,6 +147,8 @@ static int snd_seq_device_dev_free(struct snd_device *device) + struct snd_seq_device *dev = device->device_data; + + cancel_autoload_drivers(); ++ if (dev->private_free) ++ dev->private_free(dev); + put_device(&dev->dev); + return 0; + } +@@ -174,11 +176,7 @@ static int snd_seq_device_dev_disconnect(struct snd_device *device) + + static void snd_seq_dev_release(struct device *dev) + { +- struct snd_seq_device *sdev = to_seq_dev(dev); +- +- if (sdev->private_free) +- sdev->private_free(sdev); +- kfree(sdev); ++ kfree(to_seq_dev(dev)); + } + + /* +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index abe371c01fba2..c4837c78a8624 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -517,6 +517,8 @@ static void alc_shutup_pins(struct hda_codec *codec) + struct alc_spec *spec = codec->spec; + + switch (codec->core.vendor_id) { ++ case 0x10ec0236: ++ case 0x10ec0256: + case 0x10ec0283: + case 0x10ec0286: + case 0x10ec0288: +@@ -2539,7 +2541,8 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { + SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), + SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), + SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), +- SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED), + SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950), +@@ -3521,7 +3524,8 @@ static void alc256_shutup(struct hda_codec *codec) + /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly + * when booting with headset plugged. So skip setting it for the codec alc257 + */ +- if (codec->core.vendor_id != 0x10ec0257) ++ if (spec->codec_variant != ALC269_TYPE_ALC257 && ++ spec->codec_variant != ALC269_TYPE_ALC256) + alc_update_coef_idx(codec, 0x46, 0, 3 << 12); + + if (!spec->no_shutup_pins) +@@ -9688,6 +9692,9 @@ enum { + ALC671_FIXUP_HP_HEADSET_MIC2, + ALC662_FIXUP_ACER_X2660G_HEADSET_MODE, + ALC662_FIXUP_ACER_NITRO_HEADSET_MODE, ++ ALC668_FIXUP_ASUS_NO_HEADSET_MIC, ++ ALC668_FIXUP_HEADSET_MIC, ++ ALC668_FIXUP_MIC_DET_COEF, + }; + + static const struct hda_fixup alc662_fixups[] = { +@@ -10071,6 +10078,29 @@ static const struct hda_fixup alc662_fixups[] = { + .chained = true, + .chain_id = ALC662_FIXUP_USI_FUNC + }, ++ [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x1b, 0x04a1112c }, ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC668_FIXUP_HEADSET_MIC ++ }, ++ [ALC668_FIXUP_HEADSET_MIC] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc269_fixup_headset_mic, ++ .chained = true, ++ .chain_id = ALC668_FIXUP_MIC_DET_COEF ++ }, ++ [ALC668_FIXUP_MIC_DET_COEF] = { ++ .type = HDA_FIXUP_VERBS, ++ .v.verbs = (const struct hda_verb[]) { ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 }, ++ {} ++ }, ++ }, + }; + + static const struct snd_pci_quirk alc662_fixup_tbl[] = { +@@ -10106,6 +10136,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16), + SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51), + SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51), ++ SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC), + SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8), + SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16), + SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h +index 441335abb4018..9620ae0003ce4 100644 +--- a/sound/usb/quirks-table.h ++++ b/sound/usb/quirks-table.h +@@ -125,6 +125,48 @@ + .bInterfaceClass = USB_CLASS_AUDIO, + }, + ++/* ++ * Creative Technology, Ltd Live! Cam Sync HD [VF0770] ++ * The device advertises 8 formats, but only a rate of 48kHz is honored by the ++ * hardware and 24 bits give chopped audio, so only report the one working ++ * combination. ++ */ ++{ ++ USB_DEVICE(0x041e, 0x4095), ++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { ++ .ifnum = QUIRK_ANY_INTERFACE, ++ .type = QUIRK_COMPOSITE, ++ .data = &(const struct snd_usb_audio_quirk[]) { ++ { ++ .ifnum = 2, ++ .type = QUIRK_AUDIO_STANDARD_MIXER, ++ }, ++ { ++ .ifnum = 3, ++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, ++ .data = &(const struct audioformat) { ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, ++ .channels = 2, ++ .fmt_bits = 16, ++ .iface = 3, ++ .altsetting = 4, ++ .altset_idx = 4, ++ .endpoint = 0x82, ++ .ep_attr = 0x05, ++ .rates = SNDRV_PCM_RATE_48000, ++ .rate_min = 48000, ++ .rate_max = 48000, ++ .nr_rates = 1, ++ .rate_table = (unsigned int[]) { 48000 }, ++ }, ++ }, ++ { ++ .ifnum = -1 ++ }, ++ }, ++ }, ++}, ++ + /* + * HP Wireless Audio + * When not ignored, causes instability issues for some users, forcing them to diff --git a/patch/kernel/archive/sun50iw9-4.9/patch-4.9.286-287.patch b/patch/kernel/archive/sun50iw9-4.9/patch-4.9.286-287.patch new file mode 100644 index 0000000000..f3751ccb6c --- /dev/null +++ b/patch/kernel/archive/sun50iw9-4.9/patch-4.9.286-287.patch @@ -0,0 +1,543 @@ +diff --git a/Makefile b/Makefile +index 68f2c6f3869e2..76eff0f592346 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,6 @@ + VERSION = 4 + PATCHLEVEL = 9 +-SUBLEVEL = 286 ++SUBLEVEL = 287 + EXTRAVERSION = + NAME = Roaring Lionus + +diff --git a/arch/arm/boot/dts/omap3430-sdp.dts b/arch/arm/boot/dts/omap3430-sdp.dts +index abd6921143beb..e0ba97bd41b79 100644 +--- a/arch/arm/boot/dts/omap3430-sdp.dts ++++ b/arch/arm/boot/dts/omap3430-sdp.dts +@@ -104,7 +104,7 @@ + + nand@1,0 { + compatible = "ti,omap2-nand"; +- reg = <0 0 4>; /* CS0, offset 0, IO size 4 */ ++ reg = <1 0 4>; /* CS1, offset 0, IO size 4 */ + interrupt-parent = <&gpmc>; + interrupts = <0 IRQ_TYPE_NONE>, /* fifoevent */ + <1 IRQ_TYPE_NONE>; /* termcount */ +diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c +index 6da26692f2fde..950c9f2ffe005 100644 +--- a/arch/arm/mach-imx/pm-imx6.c ++++ b/arch/arm/mach-imx/pm-imx6.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -606,6 +607,7 @@ static void __init imx6_pm_common_init(const struct imx6_pm_socdata + + static void imx6_pm_stby_poweroff(void) + { ++ gic_cpu_if_down(0); + imx6_set_lpm(STOP_POWER_OFF); + imx6q_suspend_finish(0); + +diff --git a/arch/powerpc/boot/dts/fsl/t1023rdb.dts b/arch/powerpc/boot/dts/fsl/t1023rdb.dts +index 29757623e5baf..f5f8f969dd586 100644 +--- a/arch/powerpc/boot/dts/fsl/t1023rdb.dts ++++ b/arch/powerpc/boot/dts/fsl/t1023rdb.dts +@@ -125,7 +125,7 @@ + + fm1mac3: ethernet@e4000 { + phy-handle = <&sgmii_aqr_phy3>; +- phy-connection-type = "sgmii-2500"; ++ phy-connection-type = "2500base-x"; + sleep = <&rcpm 0x20000000>; + }; + +diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c +index c26cca506f646..c20df6a3540c2 100644 +--- a/arch/x86/events/core.c ++++ b/arch/x86/events/core.c +@@ -2075,6 +2075,7 @@ static int x86_pmu_event_init(struct perf_event *event) + if (err) { + if (event->destroy) + event->destroy(event); ++ event->destroy = NULL; + } + + if (ACCESS_ONCE(x86_pmu.attr_rdpmc)) +diff --git a/arch/xtensa/kernel/irq.c b/arch/xtensa/kernel/irq.c +index 441694464b1e4..fbbc24b914e30 100644 +--- a/arch/xtensa/kernel/irq.c ++++ b/arch/xtensa/kernel/irq.c +@@ -144,7 +144,7 @@ unsigned xtensa_get_ext_irq_no(unsigned irq) + + void __init init_IRQ(void) + { +-#ifdef CONFIG_OF ++#ifdef CONFIG_USE_OF + irqchip_init(); + #else + #ifdef CONFIG_HAVE_SMP +diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c +index 411c12cdb2499..bb516eb124213 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c ++++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c +@@ -178,6 +178,7 @@ static const struct file_operations nouveau_pstate_fops = { + .open = nouveau_debugfs_pstate_open, + .read = seq_read, + .write = nouveau_debugfs_pstate_set, ++ .release = single_release, + }; + + static struct drm_info_list nouveau_debugfs_list[] = { +diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c +index 959a9e38b4f54..149902619cbc8 100644 +--- a/drivers/hid/hid-apple.c ++++ b/drivers/hid/hid-apple.c +@@ -302,12 +302,19 @@ static int apple_event(struct hid_device *hdev, struct hid_field *field, + + /* + * MacBook JIS keyboard has wrong logical maximum ++ * Magic Keyboard JIS has wrong logical maximum + */ + static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int *rsize) + { + struct apple_sc *asc = hid_get_drvdata(hdev); + ++ if(*rsize >=71 && rdesc[70] == 0x65 && rdesc[64] == 0x65) { ++ hid_info(hdev, ++ "fixing up Magic Keyboard JIS report descriptor\n"); ++ rdesc[64] = rdesc[70] = 0xe7; ++ } ++ + if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 && + rdesc[53] == 0x65 && rdesc[59] == 0x65) { + hid_info(hdev, +diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c +index 832fffed4a1fa..e7585f6c4665b 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_main.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c +@@ -6646,7 +6646,7 @@ static int i40e_get_capabilities(struct i40e_pf *pf) + if (pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOMEM) { + /* retry with a larger buffer */ + buf_len = data_size; +- } else if (pf->hw.aq.asq_last_status != I40E_AQ_RC_OK) { ++ } else if (pf->hw.aq.asq_last_status != I40E_AQ_RC_OK || err) { + dev_info(&pf->pdev->dev, + "capability discovery failed, err %s aq_err %s\n", + i40e_stat_str(&pf->hw, err), +diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c +index 8cc7563ab103b..92fb664b56fbb 100644 +--- a/drivers/net/phy/mdio_bus.c ++++ b/drivers/net/phy/mdio_bus.c +@@ -316,6 +316,13 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) + bus->dev.groups = NULL; + dev_set_name(&bus->dev, "%s", bus->id); + ++ /* We need to set state to MDIOBUS_UNREGISTERED to correctly release ++ * the device in mdiobus_free() ++ * ++ * State will be updated later in this function in case of success ++ */ ++ bus->state = MDIOBUS_UNREGISTERED; ++ + err = device_register(&bus->dev); + if (err) { + pr_err("mii_bus %s failed to register\n", bus->id); +diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c +index 3aa22ae4d94c0..a911325fc0b4f 100644 +--- a/drivers/ptp/ptp_pch.c ++++ b/drivers/ptp/ptp_pch.c +@@ -698,6 +698,7 @@ static const struct pci_device_id pch_ieee1588_pcidev_id[] = { + }, + {0} + }; ++MODULE_DEVICE_TABLE(pci, pch_ieee1588_pcidev_id); + + static struct pci_driver pch_driver = { + .name = KBUILD_MODNAME, +diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c +index 69046d342bc5d..39396548f9b55 100644 +--- a/drivers/scsi/ses.c ++++ b/drivers/scsi/ses.c +@@ -120,7 +120,7 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, + static int ses_send_diag(struct scsi_device *sdev, int page_code, + void *buf, int bufflen) + { +- u32 result; ++ int result; + + unsigned char cmd[] = { + SEND_DIAGNOSTIC, +diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c +index 7ba0031d3a738..d5575869a25c7 100644 +--- a/drivers/scsi/virtio_scsi.c ++++ b/drivers/scsi/virtio_scsi.c +@@ -343,7 +343,7 @@ static void virtscsi_handle_transport_reset(struct virtio_scsi *vscsi, + } + break; + default: +- pr_info("Unsupport virtio scsi event reason %x\n", event->reason); ++ pr_info("Unsupported virtio scsi event reason %x\n", event->reason); + } + } + +@@ -396,7 +396,7 @@ static void virtscsi_handle_event(struct work_struct *work) + virtscsi_handle_param_change(vscsi, event); + break; + default: +- pr_err("Unsupport virtio scsi event %x\n", event->event); ++ pr_err("Unsupported virtio scsi event %x\n", event->event); + } + virtscsi_kick_event(vscsi, event_node); + } +diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig +index 0103f777b97ad..bff5a15e59c00 100644 +--- a/drivers/usb/Kconfig ++++ b/drivers/usb/Kconfig +@@ -160,8 +160,7 @@ source "drivers/usb/gadget/Kconfig" + + config USB_LED_TRIG + bool "USB LED Triggers" +- depends on LEDS_CLASS && LEDS_TRIGGERS +- select USB_COMMON ++ depends on LEDS_CLASS && USB_COMMON && LEDS_TRIGGERS + help + This option adds LED triggers for USB host and/or gadget activity. + +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c +index 23df1549eb0d8..b7b83ca83ba0d 100644 +--- a/drivers/usb/class/cdc-acm.c ++++ b/drivers/usb/class/cdc-acm.c +@@ -349,6 +349,9 @@ static void acm_ctrl_irq(struct urb *urb) + acm->iocount.overrun++; + spin_unlock(&acm->read_lock); + ++ if (newctrl & ACM_CTRL_BRK) ++ tty_flip_buffer_push(&acm->port); ++ + if (difference) + wake_up_all(&acm->wioctl); + +@@ -408,11 +411,16 @@ static int acm_submit_read_urbs(struct acm *acm, gfp_t mem_flags) + + static void acm_process_read_urb(struct acm *acm, struct urb *urb) + { ++ unsigned long flags; ++ + if (!urb->actual_length) + return; + ++ spin_lock_irqsave(&acm->read_lock, flags); + tty_insert_flip_string(&acm->port, urb->transfer_buffer, + urb->actual_length); ++ spin_unlock_irqrestore(&acm->read_lock, flags); ++ + tty_flip_buffer_push(&acm->port); + } + +diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c +index b16a6c0363527..dc51011d670df 100644 +--- a/fs/nfsd/nfs4xdr.c ++++ b/fs/nfsd/nfs4xdr.c +@@ -3028,15 +3028,18 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen, + goto fail; + cd->rd_maxcount -= entry_bytes; + /* +- * RFC 3530 14.2.24 describes rd_dircount as only a "hint", so +- * let's always let through the first entry, at least: ++ * RFC 3530 14.2.24 describes rd_dircount as only a "hint", and ++ * notes that it could be zero. If it is zero, then the server ++ * should enforce only the rd_maxcount value. + */ +- if (!cd->rd_dircount) +- goto fail; +- name_and_cookie = 4 + 4 * XDR_QUADLEN(namlen) + 8; +- if (name_and_cookie > cd->rd_dircount && cd->cookie_offset) +- goto fail; +- cd->rd_dircount -= min(cd->rd_dircount, name_and_cookie); ++ if (cd->rd_dircount) { ++ name_and_cookie = 4 + 4 * XDR_QUADLEN(namlen) + 8; ++ if (name_and_cookie > cd->rd_dircount && cd->cookie_offset) ++ goto fail; ++ cd->rd_dircount -= min(cd->rd_dircount, name_and_cookie); ++ if (!cd->rd_dircount) ++ cd->rd_maxcount = 0; ++ } + + cd->cookie_offset = cookie_offset; + skip_entry: +diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c +index 8546384a5fdfd..edd5979aca4f6 100644 +--- a/fs/overlayfs/dir.c ++++ b/fs/overlayfs/dir.c +@@ -926,9 +926,13 @@ static int ovl_rename2(struct inode *olddir, struct dentry *old, + goto out_dput; + } + } else { +- if (!d_is_negative(newdentry) && +- (!new_opaque || !ovl_is_whiteout(newdentry))) +- goto out_dput; ++ if (!d_is_negative(newdentry)) { ++ if (!new_opaque || !ovl_is_whiteout(newdentry)) ++ goto out_dput; ++ } else { ++ if (flags & RENAME_EXCHANGE) ++ goto out_dput; ++ } + } + + if (olddentry == trap) +diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c +index 2fdf6f96f9762..6f09728cd1dd3 100644 +--- a/kernel/bpf/stackmap.c ++++ b/kernel/bpf/stackmap.c +@@ -28,7 +28,8 @@ struct bpf_stack_map { + + static int prealloc_elems_and_freelist(struct bpf_stack_map *smap) + { +- u32 elem_size = sizeof(struct stack_map_bucket) + smap->map.value_size; ++ u64 elem_size = sizeof(struct stack_map_bucket) + ++ (u64)smap->map.value_size; + int err; + + smap->elems = bpf_map_area_alloc(elem_size * smap->map.max_entries); +diff --git a/mm/gup.c b/mm/gup.c +index 6bb7a8eb7f820..301dd96ef176c 100644 +--- a/mm/gup.c ++++ b/mm/gup.c +@@ -61,13 +61,22 @@ static int follow_pfn_pte(struct vm_area_struct *vma, unsigned long address, + } + + /* +- * FOLL_FORCE can write to even unwritable pte's, but only +- * after we've gone through a COW cycle and they are dirty. ++ * FOLL_FORCE or a forced COW break can write even to unwritable pte's, ++ * but only after we've gone through a COW cycle and they are dirty. + */ + static inline bool can_follow_write_pte(pte_t pte, unsigned int flags) + { +- return pte_write(pte) || +- ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pte_dirty(pte)); ++ return pte_write(pte) || ((flags & FOLL_COW) && pte_dirty(pte)); ++} ++ ++/* ++ * A (separate) COW fault might break the page the other way and ++ * get_user_pages() would return the page from what is now the wrong ++ * VM. So we need to force a COW break at GUP time even for reads. ++ */ ++static inline bool should_force_cow_break(struct vm_area_struct *vma, unsigned int flags) ++{ ++ return is_cow_mapping(vma->vm_flags) && (flags & FOLL_GET); + } + + static struct page *follow_page_pte(struct vm_area_struct *vma, +@@ -577,12 +586,18 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, + if (!vma || check_vma_flags(vma, gup_flags)) + return i ? : -EFAULT; + if (is_vm_hugetlb_page(vma)) { ++ if (should_force_cow_break(vma, foll_flags)) ++ foll_flags |= FOLL_WRITE; + i = follow_hugetlb_page(mm, vma, pages, vmas, + &start, &nr_pages, i, +- gup_flags); ++ foll_flags); + continue; + } + } ++ ++ if (should_force_cow_break(vma, foll_flags)) ++ foll_flags |= FOLL_WRITE; ++ + retry: + /* + * If we have a pending SIGKILL, don't keep faulting pages and +@@ -1503,6 +1518,10 @@ static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end, + /* + * Like get_user_pages_fast() except it's IRQ-safe in that it won't fall back to + * the regular GUP. It will only return non-negative values. ++ * ++ * Careful, careful! COW breaking can go either way, so a non-write ++ * access can get ambiguous page results. If you call this function without ++ * 'write' set, you'd better be sure that you're ok with that ambiguity. + */ + int __get_user_pages_fast(unsigned long start, int nr_pages, int write, + struct page **pages) +@@ -1532,6 +1551,12 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write, + * + * We do not adopt an rcu_read_lock(.) here as we also want to + * block IPIs that come from THPs splitting. ++ * ++ * NOTE! We allow read-only gup_fast() here, but you'd better be ++ * careful about possible COW pages. You'll get _a_ COW page, but ++ * not necessarily the one you intended to get depending on what ++ * COW event happens after this. COW may break the page copy in a ++ * random direction. + */ + + local_irq_save(flags); +@@ -1542,15 +1567,22 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write, + next = pgd_addr_end(addr, end); + if (pgd_none(pgd)) + break; ++ /* ++ * The FAST_GUP case requires FOLL_WRITE even for pure reads, ++ * because get_user_pages() may need to cause an early COW in ++ * order to avoid confusing the normal COW routines. So only ++ * targets that are already writable are safe to do by just ++ * looking at the page tables. ++ */ + if (unlikely(pgd_huge(pgd))) { +- if (!gup_huge_pgd(pgd, pgdp, addr, next, write, ++ if (!gup_huge_pgd(pgd, pgdp, addr, next, 1, + pages, &nr)) + break; + } else if (unlikely(is_hugepd(__hugepd(pgd_val(pgd))))) { + if (!gup_huge_pd(__hugepd(pgd_val(pgd)), addr, +- PGDIR_SHIFT, next, write, pages, &nr)) ++ PGDIR_SHIFT, next, 1, pages, &nr)) + break; +- } else if (!gup_pud_range(pgd, addr, next, write, pages, &nr)) ++ } else if (!gup_pud_range(pgd, addr, next, 1, pages, &nr)) + break; + } while (pgdp++, addr = next, addr != end); + local_irq_restore(flags); +diff --git a/mm/huge_memory.c b/mm/huge_memory.c +index 91f33bb43f178..3f3a86cc62b68 100644 +--- a/mm/huge_memory.c ++++ b/mm/huge_memory.c +@@ -1135,13 +1135,12 @@ out_unlock: + } + + /* +- * FOLL_FORCE can write to even unwritable pmd's, but only +- * after we've gone through a COW cycle and they are dirty. ++ * FOLL_FORCE or a forced COW break can write even to unwritable pmd's, ++ * but only after we've gone through a COW cycle and they are dirty. + */ + static inline bool can_follow_write_pmd(pmd_t pmd, unsigned int flags) + { +- return pmd_write(pmd) || +- ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pmd_dirty(pmd)); ++ return pmd_write(pmd) || ((flags & FOLL_COW) && pmd_dirty(pmd)); + } + + struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, +diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c +index 4f831225d34f4..ca8757090ae35 100644 +--- a/net/bridge/br_netlink.c ++++ b/net/bridge/br_netlink.c +@@ -1298,7 +1298,7 @@ static size_t br_get_linkxstats_size(const struct net_device *dev, int attr) + } + + return numvls * nla_total_size(sizeof(struct bridge_vlan_xstats)) + +- nla_total_size(sizeof(struct br_mcast_stats)) + ++ nla_total_size_64bit(sizeof(struct br_mcast_stats)) + + nla_total_size(0); + } + +diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c +index 911752e8a3e64..012143f313a87 100644 +--- a/net/core/rtnetlink.c ++++ b/net/core/rtnetlink.c +@@ -3900,7 +3900,7 @@ nla_put_failure: + static size_t if_nlmsg_stats_size(const struct net_device *dev, + u32 filter_mask) + { +- size_t size = 0; ++ size_t size = NLMSG_ALIGN(sizeof(struct if_stats_msg)); + + if (stats_attr_valid(filter_mask, IFLA_STATS_LINK_64, 0)) + size += nla_total_size_64bit(sizeof(struct rtnl_link_stats64)); +diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c +index 579fda1bc45df..ce54e66b47a03 100644 +--- a/net/ipv6/netfilter/ip6_tables.c ++++ b/net/ipv6/netfilter/ip6_tables.c +@@ -290,6 +290,7 @@ ip6t_do_table(struct sk_buff *skb, + * things we don't know, ie. tcp syn flag or ports). If the + * rule is also a fragment-specific rule, non-fragments won't + * match it. */ ++ acpar.fragoff = 0; + acpar.hotdrop = false; + acpar.net = state->net; + acpar.in = state->in; +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c +index b40e71a5d7957..3dc370ad23bf6 100644 +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -3692,7 +3692,8 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx) + if (!bssid) + return false; + if (ether_addr_equal(sdata->vif.addr, hdr->addr2) || +- ether_addr_equal(sdata->u.ibss.bssid, hdr->addr2)) ++ ether_addr_equal(sdata->u.ibss.bssid, hdr->addr2) || ++ !is_valid_ether_addr(hdr->addr2)) + return false; + if (ieee80211_is_beacon(hdr->frame_control)) + return true; +diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c +index 453b0efdc0d71..1b70de5898c42 100644 +--- a/net/netlink/af_netlink.c ++++ b/net/netlink/af_netlink.c +@@ -574,7 +574,10 @@ static int netlink_insert(struct sock *sk, u32 portid) + + /* We need to ensure that the socket is hashed and visible. */ + smp_wmb(); +- nlk_sk(sk)->bound = portid; ++ /* Paired with lockless reads from netlink_bind(), ++ * netlink_connect() and netlink_sendmsg(). ++ */ ++ WRITE_ONCE(nlk_sk(sk)->bound, portid); + + err: + release_sock(sk); +@@ -993,7 +996,8 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, + else if (nlk->ngroups < 8*sizeof(groups)) + groups &= (1UL << nlk->ngroups) - 1; + +- bound = nlk->bound; ++ /* Paired with WRITE_ONCE() in netlink_insert() */ ++ bound = READ_ONCE(nlk->bound); + if (bound) { + /* Ensure nlk->portid is up-to-date. */ + smp_rmb(); +@@ -1073,8 +1077,9 @@ static int netlink_connect(struct socket *sock, struct sockaddr *addr, + + /* No need for barriers here as we return to user-space without + * using any of the bound attributes. ++ * Paired with WRITE_ONCE() in netlink_insert(). + */ +- if (!nlk->bound) ++ if (!READ_ONCE(nlk->bound)) + err = netlink_autobind(sock); + + if (err == 0) { +@@ -1821,7 +1826,8 @@ static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) + dst_group = nlk->dst_group; + } + +- if (!nlk->bound) { ++ /* Paired with WRITE_ONCE() in netlink_insert() */ ++ if (!READ_ONCE(nlk->bound)) { + err = netlink_autobind(sock); + if (err) + goto out; +diff --git a/net/sched/sch_fifo.c b/net/sched/sch_fifo.c +index 1e37247656f80..8b7110cbcce4c 100644 +--- a/net/sched/sch_fifo.c ++++ b/net/sched/sch_fifo.c +@@ -151,6 +151,9 @@ int fifo_set_limit(struct Qdisc *q, unsigned int limit) + if (strncmp(q->ops->id + 1, "fifo", 4) != 0) + return 0; + ++ if (!q->ops->change) ++ return 0; ++ + nla = kmalloc(nla_attr_size(sizeof(struct tc_fifo_qopt)), GFP_KERNEL); + if (nla) { + nla->nla_type = RTM_NEWQDISC; diff --git a/patch/kernel/archive/sunxi-5.10/patch-5.10.72-73.patch b/patch/kernel/archive/sunxi-5.10/patch-5.10.72-73.patch new file mode 100644 index 0000000000..5327e555f4 --- /dev/null +++ b/patch/kernel/archive/sunxi-5.10/patch-5.10.72-73.patch @@ -0,0 +1,2474 @@ +diff --git a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.yaml b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.yaml +index f8622bd0f61ee..f0e0345da498f 100644 +--- a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.yaml ++++ b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.yaml +@@ -18,7 +18,7 @@ properties: + const: ti,sn65dsi86 + + reg: +- const: 0x2d ++ enum: [ 0x2c, 0x2d ] + + enable-gpios: + maxItems: 1 +diff --git a/Makefile b/Makefile +index 48211c8503d4e..3f62cea9afc0e 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 10 +-SUBLEVEL = 72 ++SUBLEVEL = 73 + EXTRAVERSION = + NAME = Dare mighty things + +diff --git a/arch/arm/boot/dts/imx53-m53menlo.dts b/arch/arm/boot/dts/imx53-m53menlo.dts +index d3082b9774e40..4f88e96d81ddb 100644 +--- a/arch/arm/boot/dts/imx53-m53menlo.dts ++++ b/arch/arm/boot/dts/imx53-m53menlo.dts +@@ -56,6 +56,7 @@ + panel { + compatible = "edt,etm0700g0dh6"; + pinctrl-0 = <&pinctrl_display_gpio>; ++ pinctrl-names = "default"; + enable-gpios = <&gpio6 0 GPIO_ACTIVE_HIGH>; + + port { +@@ -76,8 +77,7 @@ + regulator-name = "vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; +- gpio = <&gpio1 2 GPIO_ACTIVE_HIGH>; +- enable-active-high; ++ gpio = <&gpio1 2 0>; + }; + }; + +diff --git a/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi b/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi +index 9148a01ed6d9f..ebc0892e37c7a 100644 +--- a/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi ++++ b/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi +@@ -5,6 +5,7 @@ + #include + #include + #include ++#include + #include + + / { +@@ -275,6 +276,7 @@ + led-cur = /bits/ 8 <0x20>; + max-cur = /bits/ 8 <0x60>; + reg = <0>; ++ color = ; + }; + + chan@1 { +@@ -282,6 +284,7 @@ + led-cur = /bits/ 8 <0x20>; + max-cur = /bits/ 8 <0x60>; + reg = <1>; ++ color = ; + }; + + chan@2 { +@@ -289,6 +292,7 @@ + led-cur = /bits/ 8 <0x20>; + max-cur = /bits/ 8 <0x60>; + reg = <2>; ++ color = ; + }; + + chan@3 { +@@ -296,6 +300,7 @@ + led-cur = /bits/ 8 <0x0>; + max-cur = /bits/ 8 <0x0>; + reg = <3>; ++ color = ; + }; + }; + +diff --git a/arch/arm/boot/dts/imx6qdl-pico.dtsi b/arch/arm/boot/dts/imx6qdl-pico.dtsi +index 5de4ccb979163..f7a56d6b160c8 100644 +--- a/arch/arm/boot/dts/imx6qdl-pico.dtsi ++++ b/arch/arm/boot/dts/imx6qdl-pico.dtsi +@@ -176,7 +176,18 @@ + pinctrl-0 = <&pinctrl_enet>; + phy-mode = "rgmii-id"; + phy-reset-gpios = <&gpio1 26 GPIO_ACTIVE_LOW>; ++ phy-handle = <&phy>; + status = "okay"; ++ ++ mdio { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ phy: ethernet-phy@1 { ++ reg = <1>; ++ qca,clk-out-frequency = <125000000>; ++ }; ++ }; + }; + + &hdmi { +diff --git a/arch/arm/boot/dts/omap3430-sdp.dts b/arch/arm/boot/dts/omap3430-sdp.dts +index c5b9037184149..7d530ae3483b8 100644 +--- a/arch/arm/boot/dts/omap3430-sdp.dts ++++ b/arch/arm/boot/dts/omap3430-sdp.dts +@@ -101,7 +101,7 @@ + + nand@1,0 { + compatible = "ti,omap2-nand"; +- reg = <0 0 4>; /* CS0, offset 0, IO size 4 */ ++ reg = <1 0 4>; /* CS1, offset 0, IO size 4 */ + interrupt-parent = <&gpmc>; + interrupts = <0 IRQ_TYPE_NONE>, /* fifoevent */ + <1 IRQ_TYPE_NONE>; /* termcount */ +diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi +index e36d590e83732..72c4a9fc41a20 100644 +--- a/arch/arm/boot/dts/qcom-apq8064.dtsi ++++ b/arch/arm/boot/dts/qcom-apq8064.dtsi +@@ -198,7 +198,7 @@ + clock-frequency = <19200000>; + }; + +- pxo_board { ++ pxo_board: pxo_board { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <27000000>; +@@ -1148,7 +1148,7 @@ + }; + + gpu: adreno-3xx@4300000 { +- compatible = "qcom,adreno-3xx"; ++ compatible = "qcom,adreno-320.2", "qcom,adreno"; + reg = <0x04300000 0x20000>; + reg-names = "kgsl_3d0_reg_memory"; + interrupts = ; +@@ -1163,7 +1163,6 @@ + <&mmcc GFX3D_AHB_CLK>, + <&mmcc GFX3D_AXI_CLK>, + <&mmcc MMSS_IMEM_AHB_CLK>; +- qcom,chipid = <0x03020002>; + + iommus = <&gfx3d 0 + &gfx3d 1 +@@ -1306,7 +1305,7 @@ + reg-names = "dsi_pll", "dsi_phy", "dsi_phy_regulator"; + clock-names = "iface_clk", "ref"; + clocks = <&mmcc DSI_M_AHB_CLK>, +- <&cxo_board>; ++ <&pxo_board>; + }; + + +diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c +index 120f9aa6fff32..3f015cb6ec2b0 100644 +--- a/arch/arm/mach-at91/pm.c ++++ b/arch/arm/mach-at91/pm.c +@@ -517,18 +517,22 @@ static const struct of_device_id ramc_ids[] __initconst = { + { /*sentinel*/ } + }; + +-static __init void at91_dt_ramc(void) ++static __init int at91_dt_ramc(void) + { + struct device_node *np; + const struct of_device_id *of_id; + int idx = 0; + void *standby = NULL; + const struct ramc_info *ramc; ++ int ret; + + for_each_matching_node_and_match(np, ramc_ids, &of_id) { + soc_pm.data.ramc[idx] = of_iomap(np, 0); +- if (!soc_pm.data.ramc[idx]) +- panic(pr_fmt("unable to map ramc[%d] cpu registers\n"), idx); ++ if (!soc_pm.data.ramc[idx]) { ++ pr_err("unable to map ramc[%d] cpu registers\n", idx); ++ ret = -ENOMEM; ++ goto unmap_ramc; ++ } + + ramc = of_id->data; + if (!standby) +@@ -538,15 +542,26 @@ static __init void at91_dt_ramc(void) + idx++; + } + +- if (!idx) +- panic(pr_fmt("unable to find compatible ram controller node in dtb\n")); ++ if (!idx) { ++ pr_err("unable to find compatible ram controller node in dtb\n"); ++ ret = -ENODEV; ++ goto unmap_ramc; ++ } + + if (!standby) { + pr_warn("ramc no standby function available\n"); +- return; ++ return 0; + } + + at91_cpuidle_device.dev.platform_data = standby; ++ ++ return 0; ++ ++unmap_ramc: ++ while (idx) ++ iounmap(soc_pm.data.ramc[--idx]); ++ ++ return ret; + } + + static void at91rm9200_idle(void) +@@ -869,6 +884,8 @@ static void __init at91_pm_init(void (*pm_idle)(void)) + + void __init at91rm9200_pm_init(void) + { ++ int ret; ++ + if (!IS_ENABLED(CONFIG_SOC_AT91RM9200)) + return; + +@@ -880,7 +897,9 @@ void __init at91rm9200_pm_init(void) + soc_pm.data.standby_mode = AT91_PM_STANDBY; + soc_pm.data.suspend_mode = AT91_PM_ULP0; + +- at91_dt_ramc(); ++ ret = at91_dt_ramc(); ++ if (ret) ++ return; + + /* + * AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. +@@ -895,13 +914,17 @@ void __init sam9x60_pm_init(void) + static const int modes[] __initconst = { + AT91_PM_STANDBY, AT91_PM_ULP0, AT91_PM_ULP0_FAST, AT91_PM_ULP1, + }; ++ int ret; + + if (!IS_ENABLED(CONFIG_SOC_SAM9X60)) + return; + + at91_pm_modes_validate(modes, ARRAY_SIZE(modes)); + at91_pm_modes_init(); +- at91_dt_ramc(); ++ ret = at91_dt_ramc(); ++ if (ret) ++ return; ++ + at91_pm_init(NULL); + + soc_pm.ws_ids = sam9x60_ws_ids; +@@ -910,6 +933,8 @@ void __init sam9x60_pm_init(void) + + void __init at91sam9_pm_init(void) + { ++ int ret; ++ + if (!IS_ENABLED(CONFIG_SOC_AT91SAM9)) + return; + +@@ -921,7 +946,10 @@ void __init at91sam9_pm_init(void) + soc_pm.data.standby_mode = AT91_PM_STANDBY; + soc_pm.data.suspend_mode = AT91_PM_ULP0; + +- at91_dt_ramc(); ++ ret = at91_dt_ramc(); ++ if (ret) ++ return; ++ + at91_pm_init(at91sam9_idle); + } + +@@ -930,12 +958,16 @@ void __init sama5_pm_init(void) + static const int modes[] __initconst = { + AT91_PM_STANDBY, AT91_PM_ULP0, AT91_PM_ULP0_FAST, + }; ++ int ret; + + if (!IS_ENABLED(CONFIG_SOC_SAMA5)) + return; + + at91_pm_modes_validate(modes, ARRAY_SIZE(modes)); +- at91_dt_ramc(); ++ ret = at91_dt_ramc(); ++ if (ret) ++ return; ++ + at91_pm_init(NULL); + } + +@@ -945,13 +977,17 @@ void __init sama5d2_pm_init(void) + AT91_PM_STANDBY, AT91_PM_ULP0, AT91_PM_ULP0_FAST, AT91_PM_ULP1, + AT91_PM_BACKUP, + }; ++ int ret; + + if (!IS_ENABLED(CONFIG_SOC_SAMA5D2)) + return; + + at91_pm_modes_validate(modes, ARRAY_SIZE(modes)); + at91_pm_modes_init(); +- at91_dt_ramc(); ++ ret = at91_dt_ramc(); ++ if (ret) ++ return; ++ + at91_pm_init(NULL); + + soc_pm.ws_ids = sama5d2_ws_ids; +diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c +index 40c74b4c4d730..e24409c1f5d39 100644 +--- a/arch/arm/mach-imx/pm-imx6.c ++++ b/arch/arm/mach-imx/pm-imx6.c +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -618,6 +619,7 @@ static void __init imx6_pm_common_init(const struct imx6_pm_socdata + + static void imx6_pm_stby_poweroff(void) + { ++ gic_cpu_if_down(0); + imx6_set_lpm(STOP_POWER_OFF); + imx6q_suspend_finish(0); + +diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c +index 83d595ebcf1f6..9443f129859b2 100644 +--- a/arch/arm/mach-omap2/omap_hwmod.c ++++ b/arch/arm/mach-omap2/omap_hwmod.c +@@ -3618,6 +3618,8 @@ int omap_hwmod_init_module(struct device *dev, + oh->flags |= HWMOD_SWSUP_SIDLE_ACT; + if (data->cfg->quirks & SYSC_QUIRK_SWSUP_MSTANDBY) + oh->flags |= HWMOD_SWSUP_MSTANDBY; ++ if (data->cfg->quirks & SYSC_QUIRK_CLKDM_NOAUTO) ++ oh->flags |= HWMOD_CLKDM_NOAUTO; + + error = omap_hwmod_check_module(dev, oh, data, sysc_fields, + rev_offs, sysc_offs, syss_offs, +diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c +index ce8b043263521..1214e39aad5ec 100644 +--- a/arch/arm/net/bpf_jit_32.c ++++ b/arch/arm/net/bpf_jit_32.c +@@ -36,6 +36,10 @@ + * +-----+ + * |RSVD | JIT scratchpad + * current ARM_SP => +-----+ <= (BPF_FP - STACK_SIZE + SCRATCH_SIZE) ++ * | ... | caller-saved registers ++ * +-----+ ++ * | ... | arguments passed on stack ++ * ARM_SP during call => +-----| + * | | + * | ... | Function call stack + * | | +@@ -63,6 +67,12 @@ + * + * When popping registers off the stack at the end of a BPF function, we + * reference them via the current ARM_FP register. ++ * ++ * Some eBPF operations are implemented via a call to a helper function. ++ * Such calls are "invisible" in the eBPF code, so it is up to the calling ++ * program to preserve any caller-saved ARM registers during the call. The ++ * JIT emits code to push and pop those registers onto the stack, immediately ++ * above the callee stack frame. + */ + #define CALLEE_MASK (1 << ARM_R4 | 1 << ARM_R5 | 1 << ARM_R6 | \ + 1 << ARM_R7 | 1 << ARM_R8 | 1 << ARM_R9 | \ +@@ -70,6 +80,8 @@ + #define CALLEE_PUSH_MASK (CALLEE_MASK | 1 << ARM_LR) + #define CALLEE_POP_MASK (CALLEE_MASK | 1 << ARM_PC) + ++#define CALLER_MASK (1 << ARM_R0 | 1 << ARM_R1 | 1 << ARM_R2 | 1 << ARM_R3) ++ + enum { + /* Stack layout - these are offsets from (top of stack - 4) */ + BPF_R2_HI, +@@ -464,6 +476,7 @@ static inline int epilogue_offset(const struct jit_ctx *ctx) + + static inline void emit_udivmod(u8 rd, u8 rm, u8 rn, struct jit_ctx *ctx, u8 op) + { ++ const int exclude_mask = BIT(ARM_R0) | BIT(ARM_R1); + const s8 *tmp = bpf2a32[TMP_REG_1]; + + #if __LINUX_ARM_ARCH__ == 7 +@@ -495,11 +508,17 @@ static inline void emit_udivmod(u8 rd, u8 rm, u8 rn, struct jit_ctx *ctx, u8 op) + emit(ARM_MOV_R(ARM_R0, rm), ctx); + } + ++ /* Push caller-saved registers on stack */ ++ emit(ARM_PUSH(CALLER_MASK & ~exclude_mask), ctx); ++ + /* Call appropriate function */ + emit_mov_i(ARM_IP, op == BPF_DIV ? + (u32)jit_udiv32 : (u32)jit_mod32, ctx); + emit_blx_r(ARM_IP, ctx); + ++ /* Restore caller-saved registers from stack */ ++ emit(ARM_POP(CALLER_MASK & ~exclude_mask), ctx); ++ + /* Save return value */ + if (rd != ARM_R0) + emit(ARM_MOV_R(rd, ARM_R0), ctx); +diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +index 5f42904d53ab6..580690057601c 100644 +--- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi ++++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +@@ -386,6 +386,24 @@ + status = "disabled"; + }; + ++ can0: can@2180000 { ++ compatible = "fsl,ls1028ar1-flexcan", "fsl,lx2160ar1-flexcan"; ++ reg = <0x0 0x2180000 0x0 0x10000>; ++ interrupts = ; ++ clocks = <&sysclk>, <&clockgen 4 1>; ++ clock-names = "ipg", "per"; ++ status = "disabled"; ++ }; ++ ++ can1: can@2190000 { ++ compatible = "fsl,ls1028ar1-flexcan", "fsl,lx2160ar1-flexcan"; ++ reg = <0x0 0x2190000 0x0 0x10000>; ++ interrupts = ; ++ clocks = <&sysclk>, <&clockgen 4 1>; ++ clock-names = "ipg", "per"; ++ status = "disabled"; ++ }; ++ + duart0: serial@21c0500 { + compatible = "fsl,ns16550", "ns16550a"; + reg = <0x00 0x21c0500 0x0 0x100>; +diff --git a/arch/arm64/boot/dts/qcom/pm8150.dtsi b/arch/arm64/boot/dts/qcom/pm8150.dtsi +index 1b6406927509f..82edcd74ce983 100644 +--- a/arch/arm64/boot/dts/qcom/pm8150.dtsi ++++ b/arch/arm64/boot/dts/qcom/pm8150.dtsi +@@ -48,7 +48,7 @@ + #size-cells = <0>; + + pon: power-on@800 { +- compatible = "qcom,pm8916-pon"; ++ compatible = "qcom,pm8998-pon"; + reg = <0x0800>; + pwrkey { + compatible = "qcom,pm8941-pwrkey"; +diff --git a/arch/powerpc/boot/dts/fsl/t1023rdb.dts b/arch/powerpc/boot/dts/fsl/t1023rdb.dts +index 5ba6fbfca2742..f82f85c65964c 100644 +--- a/arch/powerpc/boot/dts/fsl/t1023rdb.dts ++++ b/arch/powerpc/boot/dts/fsl/t1023rdb.dts +@@ -154,7 +154,7 @@ + + fm1mac3: ethernet@e4000 { + phy-handle = <&sgmii_aqr_phy3>; +- phy-connection-type = "sgmii-2500"; ++ phy-connection-type = "2500base-x"; + sleep = <&rcpm 0x20000000>; + }; + +diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c +index a1c7441940184..9ac0651795cf6 100644 +--- a/arch/powerpc/kernel/dma-iommu.c ++++ b/arch/powerpc/kernel/dma-iommu.c +@@ -117,6 +117,15 @@ u64 dma_iommu_get_required_mask(struct device *dev) + struct iommu_table *tbl = get_iommu_table_base(dev); + u64 mask; + ++ if (dev_is_pci(dev)) { ++ u64 bypass_mask = dma_direct_get_required_mask(dev); ++ ++ if (dma_iommu_dma_supported(dev, bypass_mask)) { ++ dev_info(dev, "%s: returning bypass mask 0x%llx\n", __func__, bypass_mask); ++ return bypass_mask; ++ } ++ } ++ + if (!tbl) + return 0; + +diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S +index 9d3b468bd2d7a..10df278dc3fbe 100644 +--- a/arch/powerpc/kernel/exceptions-64s.S ++++ b/arch/powerpc/kernel/exceptions-64s.S +@@ -1715,27 +1715,30 @@ EXC_COMMON_BEGIN(program_check_common) + */ + + andi. r10,r12,MSR_PR +- bne 2f /* If userspace, go normal path */ ++ bne .Lnormal_stack /* If userspace, go normal path */ + + andis. r10,r12,(SRR1_PROGTM)@h +- bne 1f /* If TM, emergency */ ++ bne .Lemergency_stack /* If TM, emergency */ + + cmpdi r1,-INT_FRAME_SIZE /* check if r1 is in userspace */ +- blt 2f /* normal path if not */ ++ blt .Lnormal_stack /* normal path if not */ + + /* Use the emergency stack */ +-1: andi. r10,r12,MSR_PR /* Set CR0 correctly for label */ ++.Lemergency_stack: ++ andi. r10,r12,MSR_PR /* Set CR0 correctly for label */ + /* 3 in EXCEPTION_PROLOG_COMMON */ + mr r10,r1 /* Save r1 */ + ld r1,PACAEMERGSP(r13) /* Use emergency stack */ + subi r1,r1,INT_FRAME_SIZE /* alloc stack frame */ + __ISTACK(program_check)=0 + __GEN_COMMON_BODY program_check +- b 3f +-2: ++ b .Ldo_program_check ++ ++.Lnormal_stack: + __ISTACK(program_check)=1 + __GEN_COMMON_BODY program_check +-3: ++ ++.Ldo_program_check: + addi r3,r1,STACK_FRAME_OVERHEAD + bl program_check_exception + REST_NVGPRS(r1) /* instruction emulation may change GPRs */ +diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c +index 658ca2bab13cc..0752967f351bb 100644 +--- a/arch/powerpc/net/bpf_jit_comp64.c ++++ b/arch/powerpc/net/bpf_jit_comp64.c +@@ -347,18 +347,25 @@ static int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, + EMIT(PPC_RAW_SUB(dst_reg, dst_reg, src_reg)); + goto bpf_alu32_trunc; + case BPF_ALU | BPF_ADD | BPF_K: /* (u32) dst += (u32) imm */ +- case BPF_ALU | BPF_SUB | BPF_K: /* (u32) dst -= (u32) imm */ + case BPF_ALU64 | BPF_ADD | BPF_K: /* dst += imm */ ++ if (!imm) { ++ goto bpf_alu32_trunc; ++ } else if (imm >= -32768 && imm < 32768) { ++ EMIT(PPC_RAW_ADDI(dst_reg, dst_reg, IMM_L(imm))); ++ } else { ++ PPC_LI32(b2p[TMP_REG_1], imm); ++ EMIT(PPC_RAW_ADD(dst_reg, dst_reg, b2p[TMP_REG_1])); ++ } ++ goto bpf_alu32_trunc; ++ case BPF_ALU | BPF_SUB | BPF_K: /* (u32) dst -= (u32) imm */ + case BPF_ALU64 | BPF_SUB | BPF_K: /* dst -= imm */ +- if (BPF_OP(code) == BPF_SUB) +- imm = -imm; +- if (imm) { +- if (imm >= -32768 && imm < 32768) +- EMIT(PPC_RAW_ADDI(dst_reg, dst_reg, IMM_L(imm))); +- else { +- PPC_LI32(b2p[TMP_REG_1], imm); +- EMIT(PPC_RAW_ADD(dst_reg, dst_reg, b2p[TMP_REG_1])); +- } ++ if (!imm) { ++ goto bpf_alu32_trunc; ++ } else if (imm > -32768 && imm <= 32768) { ++ EMIT(PPC_RAW_ADDI(dst_reg, dst_reg, IMM_L(-imm))); ++ } else { ++ PPC_LI32(b2p[TMP_REG_1], imm); ++ EMIT(PPC_RAW_SUB(dst_reg, dst_reg, b2p[TMP_REG_1])); + } + goto bpf_alu32_trunc; + case BPF_ALU | BPF_MUL | BPF_X: /* (u32) dst *= (u32) src */ +diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c +index cf024fa37bda0..7ed38ebd0c7b6 100644 +--- a/arch/powerpc/platforms/pseries/eeh_pseries.c ++++ b/arch/powerpc/platforms/pseries/eeh_pseries.c +@@ -868,6 +868,10 @@ static int __init eeh_pseries_init(void) + if (is_kdump_kernel() || reset_devices) { + pr_info("Issue PHB reset ...\n"); + list_for_each_entry(phb, &hose_list, list_node) { ++ // Skip if the slot is empty ++ if (list_empty(&PCI_DN(phb->dn)->child_list)) ++ continue; ++ + pdn = list_first_entry(&PCI_DN(phb->dn)->child_list, struct pci_dn, list); + config_addr = pseries_eeh_get_pe_config_addr(pdn); + +diff --git a/arch/riscv/include/uapi/asm/unistd.h b/arch/riscv/include/uapi/asm/unistd.h +index 4b989ae15d59f..8062996c2dfd0 100644 +--- a/arch/riscv/include/uapi/asm/unistd.h ++++ b/arch/riscv/include/uapi/asm/unistd.h +@@ -18,9 +18,10 @@ + #ifdef __LP64__ + #define __ARCH_WANT_NEW_STAT + #define __ARCH_WANT_SET_GET_RLIMIT +-#define __ARCH_WANT_SYS_CLONE3 + #endif /* __LP64__ */ + ++#define __ARCH_WANT_SYS_CLONE3 ++ + #include + + /* +diff --git a/arch/riscv/kernel/vdso.c b/arch/riscv/kernel/vdso.c +index 3f1d35e7c98a6..73d45931a053a 100644 +--- a/arch/riscv/kernel/vdso.c ++++ b/arch/riscv/kernel/vdso.c +@@ -65,7 +65,9 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, + + vdso_len = (vdso_pages + 1) << PAGE_SHIFT; + +- mmap_write_lock(mm); ++ if (mmap_write_lock_killable(mm)) ++ return -EINTR; ++ + vdso_base = get_unmapped_area(NULL, 0, vdso_len, 0, 0); + if (IS_ERR_VALUE(vdso_base)) { + ret = vdso_base; +diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c +index 094118663285d..89f81067e09ed 100644 +--- a/arch/riscv/mm/cacheflush.c ++++ b/arch/riscv/mm/cacheflush.c +@@ -16,6 +16,8 @@ static void ipi_remote_fence_i(void *info) + + void flush_icache_all(void) + { ++ local_flush_icache_all(); ++ + if (IS_ENABLED(CONFIG_RISCV_SBI)) + sbi_remote_fence_i(NULL); + else +diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c +index 8d9047d2d1e11..cd0cbdafedbd2 100644 +--- a/arch/s390/net/bpf_jit_comp.c ++++ b/arch/s390/net/bpf_jit_comp.c +@@ -1775,7 +1775,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp) + jit.addrs = kvcalloc(fp->len + 1, sizeof(*jit.addrs), GFP_KERNEL); + if (jit.addrs == NULL) { + fp = orig_fp; +- goto out; ++ goto free_addrs; + } + /* + * Three initial passes: +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig +index f3c8a8110f60c..4201d0cf5f835 100644 +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -1415,7 +1415,7 @@ config HIGHMEM4G + + config HIGHMEM64G + bool "64GB" +- depends on !M486SX && !M486 && !M586 && !M586TSC && !M586MMX && !MGEODE_LX && !MGEODEGX1 && !MCYRIXIII && !MELAN && !MWINCHIPC6 && !WINCHIP3D && !MK6 ++ depends on !M486SX && !M486 && !M586 && !M586TSC && !M586MMX && !MGEODE_LX && !MGEODEGX1 && !MCYRIXIII && !MELAN && !MWINCHIPC6 && !MWINCHIP3D && !MK6 + select X86_PAE + help + Select this if you have a 32-bit processor and more than 4 +diff --git a/arch/x86/include/asm/entry-common.h b/arch/x86/include/asm/entry-common.h +index 6fe54b2813c13..4a382fb6a9ef8 100644 +--- a/arch/x86/include/asm/entry-common.h ++++ b/arch/x86/include/asm/entry-common.h +@@ -24,7 +24,7 @@ static __always_inline void arch_check_user_regs(struct pt_regs *regs) + * For !SMAP hardware we patch out CLAC on entry. + */ + if (boot_cpu_has(X86_FEATURE_SMAP) || +- (IS_ENABLED(CONFIG_64_BIT) && boot_cpu_has(X86_FEATURE_XENPV))) ++ (IS_ENABLED(CONFIG_64BIT) && boot_cpu_has(X86_FEATURE_XENPV))) + mask |= X86_EFLAGS_AC; + + WARN_ON_ONCE(flags & mask); +diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c +index 25148ebd36341..ec21f5e9ffd05 100644 +--- a/arch/x86/kernel/cpu/common.c ++++ b/arch/x86/kernel/cpu/common.c +@@ -320,6 +320,7 @@ static __always_inline void setup_smap(struct cpuinfo_x86 *c) + #ifdef CONFIG_X86_SMAP + cr4_set_bits(X86_CR4_SMAP); + #else ++ clear_cpu_cap(c, X86_FEATURE_SMAP); + cr4_clear_bits(X86_CR4_SMAP); + #endif + } +diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c +index a4b5af03dcc1b..0c6d1dc59fa21 100644 +--- a/arch/x86/kernel/early-quirks.c ++++ b/arch/x86/kernel/early-quirks.c +@@ -711,12 +711,6 @@ static struct chipset early_qrk[] __initdata = { + */ + { PCI_VENDOR_ID_INTEL, 0x0f00, + PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, +- { PCI_VENDOR_ID_INTEL, 0x3e20, +- PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, +- { PCI_VENDOR_ID_INTEL, 0x3ec4, +- PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, +- { PCI_VENDOR_ID_INTEL, 0x8a12, +- PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, + { PCI_VENDOR_ID_BROADCOM, 0x4331, + PCI_CLASS_NETWORK_OTHER, PCI_ANY_ID, 0, apple_airport_reset}, + {} +diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c +index 7a50f0b62a709..4ab7a9757e521 100644 +--- a/arch/x86/kernel/hpet.c ++++ b/arch/x86/kernel/hpet.c +@@ -9,6 +9,7 @@ + + #include + #include ++#include + + #undef pr_fmt + #define pr_fmt(fmt) "hpet: " fmt +@@ -806,6 +807,83 @@ static bool __init hpet_counting(void) + return false; + } + ++static bool __init mwait_pc10_supported(void) ++{ ++ unsigned int eax, ebx, ecx, mwait_substates; ++ ++ if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) ++ return false; ++ ++ if (!cpu_feature_enabled(X86_FEATURE_MWAIT)) ++ return false; ++ ++ if (boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF) ++ return false; ++ ++ cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &mwait_substates); ++ ++ return (ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) && ++ (ecx & CPUID5_ECX_INTERRUPT_BREAK) && ++ (mwait_substates & (0xF << 28)); ++} ++ ++/* ++ * Check whether the system supports PC10. If so force disable HPET as that ++ * stops counting in PC10. This check is overbroad as it does not take any ++ * of the following into account: ++ * ++ * - ACPI tables ++ * - Enablement of intel_idle ++ * - Command line arguments which limit intel_idle C-state support ++ * ++ * That's perfectly fine. HPET is a piece of hardware designed by committee ++ * and the only reasons why it is still in use on modern systems is the ++ * fact that it is impossible to reliably query TSC and CPU frequency via ++ * CPUID or firmware. ++ * ++ * If HPET is functional it is useful for calibrating TSC, but this can be ++ * done via PMTIMER as well which seems to be the last remaining timer on ++ * X86/INTEL platforms that has not been completely wreckaged by feature ++ * creep. ++ * ++ * In theory HPET support should be removed altogether, but there are older ++ * systems out there which depend on it because TSC and APIC timer are ++ * dysfunctional in deeper C-states. ++ * ++ * It's only 20 years now that hardware people have been asked to provide ++ * reliable and discoverable facilities which can be used for timekeeping ++ * and per CPU timer interrupts. ++ * ++ * The probability that this problem is going to be solved in the ++ * forseeable future is close to zero, so the kernel has to be cluttered ++ * with heuristics to keep up with the ever growing amount of hardware and ++ * firmware trainwrecks. Hopefully some day hardware people will understand ++ * that the approach of "This can be fixed in software" is not sustainable. ++ * Hope dies last... ++ */ ++static bool __init hpet_is_pc10_damaged(void) ++{ ++ unsigned long long pcfg; ++ ++ /* Check whether PC10 substates are supported */ ++ if (!mwait_pc10_supported()) ++ return false; ++ ++ /* Check whether PC10 is enabled in PKG C-state limit */ ++ rdmsrl(MSR_PKG_CST_CONFIG_CONTROL, pcfg); ++ if ((pcfg & 0xF) < 8) ++ return false; ++ ++ if (hpet_force_user) { ++ pr_warn("HPET force enabled via command line, but dysfunctional in PC10.\n"); ++ return false; ++ } ++ ++ pr_info("HPET dysfunctional in PC10. Force disabled.\n"); ++ boot_hpet_disable = true; ++ return true; ++} ++ + /** + * hpet_enable - Try to setup the HPET timer. Returns 1 on success. + */ +@@ -819,6 +897,9 @@ int __init hpet_enable(void) + if (!is_hpet_capable()) + return 0; + ++ if (hpet_is_pc10_damaged()) ++ return 0; ++ + hpet_set_mapping(); + if (!hpet_virt_address) + return 0; +diff --git a/arch/x86/kernel/sev-es-shared.c b/arch/x86/kernel/sev-es-shared.c +index ecb20b17b7df6..82db4014deb21 100644 +--- a/arch/x86/kernel/sev-es-shared.c ++++ b/arch/x86/kernel/sev-es-shared.c +@@ -130,6 +130,8 @@ static enum es_result sev_es_ghcb_hv_call(struct ghcb *ghcb, + } else { + ret = ES_VMM_ERROR; + } ++ } else if (ghcb->save.sw_exit_info_1 & 0xffffffff) { ++ ret = ES_VMM_ERROR; + } else { + ret = ES_OK; + } +diff --git a/arch/x86/platform/olpc/olpc.c b/arch/x86/platform/olpc/olpc.c +index ee2beda590d0d..1d4a00e767ece 100644 +--- a/arch/x86/platform/olpc/olpc.c ++++ b/arch/x86/platform/olpc/olpc.c +@@ -274,7 +274,7 @@ static struct olpc_ec_driver ec_xo1_driver = { + + static struct olpc_ec_driver ec_xo1_5_driver = { + .ec_cmd = olpc_xo1_ec_cmd, +-#ifdef CONFIG_OLPC_XO1_5_SCI ++#ifdef CONFIG_OLPC_XO15_SCI + /* + * XO-1.5 EC wakeups are available when olpc-xo15-sci driver is + * compiled in +diff --git a/arch/xtensa/include/asm/kmem_layout.h b/arch/xtensa/include/asm/kmem_layout.h +index 7cbf68ca71060..6fc05cba61a27 100644 +--- a/arch/xtensa/include/asm/kmem_layout.h ++++ b/arch/xtensa/include/asm/kmem_layout.h +@@ -78,7 +78,7 @@ + #endif + #define XCHAL_KIO_SIZE 0x10000000 + +-#if (!XCHAL_HAVE_PTP_MMU || XCHAL_HAVE_SPANNING_WAY) && defined(CONFIG_OF) ++#if (!XCHAL_HAVE_PTP_MMU || XCHAL_HAVE_SPANNING_WAY) && defined(CONFIG_USE_OF) + #define XCHAL_KIO_PADDR xtensa_get_kio_paddr() + #ifndef __ASSEMBLY__ + extern unsigned long xtensa_kio_paddr; +diff --git a/arch/xtensa/kernel/irq.c b/arch/xtensa/kernel/irq.c +index a48bf2d10ac2d..80cc9770a8d2d 100644 +--- a/arch/xtensa/kernel/irq.c ++++ b/arch/xtensa/kernel/irq.c +@@ -145,7 +145,7 @@ unsigned xtensa_get_ext_irq_no(unsigned irq) + + void __init init_IRQ(void) + { +-#ifdef CONFIG_OF ++#ifdef CONFIG_USE_OF + irqchip_init(); + #else + #ifdef CONFIG_HAVE_SMP +diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c +index ed184106e4cf9..ee9082a142feb 100644 +--- a/arch/xtensa/kernel/setup.c ++++ b/arch/xtensa/kernel/setup.c +@@ -63,7 +63,7 @@ extern unsigned long initrd_end; + extern int initrd_below_start_ok; + #endif + +-#ifdef CONFIG_OF ++#ifdef CONFIG_USE_OF + void *dtb_start = __dtb_start; + #endif + +@@ -125,7 +125,7 @@ __tagtable(BP_TAG_INITRD, parse_tag_initrd); + + #endif /* CONFIG_BLK_DEV_INITRD */ + +-#ifdef CONFIG_OF ++#ifdef CONFIG_USE_OF + + static int __init parse_tag_fdt(const bp_tag_t *tag) + { +@@ -135,7 +135,7 @@ static int __init parse_tag_fdt(const bp_tag_t *tag) + + __tagtable(BP_TAG_FDT, parse_tag_fdt); + +-#endif /* CONFIG_OF */ ++#endif /* CONFIG_USE_OF */ + + static int __init parse_tag_cmdline(const bp_tag_t* tag) + { +@@ -183,7 +183,7 @@ static int __init parse_bootparam(const bp_tag_t *tag) + } + #endif + +-#ifdef CONFIG_OF ++#ifdef CONFIG_USE_OF + + #if !XCHAL_HAVE_PTP_MMU || XCHAL_HAVE_SPANNING_WAY + unsigned long xtensa_kio_paddr = XCHAL_KIO_DEFAULT_PADDR; +@@ -232,7 +232,7 @@ void __init early_init_devtree(void *params) + strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); + } + +-#endif /* CONFIG_OF */ ++#endif /* CONFIG_USE_OF */ + + /* + * Initialize architecture. (Early stage) +@@ -253,7 +253,7 @@ void __init init_arch(bp_tag_t *bp_start) + if (bp_start) + parse_bootparam(bp_start); + +-#ifdef CONFIG_OF ++#ifdef CONFIG_USE_OF + early_init_devtree(dtb_start); + #endif + +diff --git a/arch/xtensa/mm/mmu.c b/arch/xtensa/mm/mmu.c +index fd2193df8a145..511bb92518f28 100644 +--- a/arch/xtensa/mm/mmu.c ++++ b/arch/xtensa/mm/mmu.c +@@ -100,7 +100,7 @@ void init_mmu(void) + + void init_kio(void) + { +-#if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && defined(CONFIG_OF) ++#if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && defined(CONFIG_USE_OF) + /* + * Update the IO area mapping in case xtensa_kio_paddr has changed + */ +diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c +index 159b57c6dc4df..02341fd66e8d2 100644 +--- a/drivers/bus/ti-sysc.c ++++ b/drivers/bus/ti-sysc.c +@@ -1464,6 +1464,9 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { + /* Quirks that need to be set based on detected module */ + SYSC_QUIRK("aess", 0, 0, 0x10, -ENODEV, 0x40000000, 0xffffffff, + SYSC_MODULE_QUIRK_AESS), ++ /* Errata i893 handling for dra7 dcan1 and 2 */ ++ SYSC_QUIRK("dcan", 0x4ae3c000, 0x20, -ENODEV, -ENODEV, 0xa3170504, 0xffffffff, ++ SYSC_QUIRK_CLKDM_NOAUTO), + SYSC_QUIRK("dcan", 0x48480000, 0x20, -ENODEV, -ENODEV, 0xa3170504, 0xffffffff, + SYSC_QUIRK_CLKDM_NOAUTO), + SYSC_QUIRK("dss", 0x4832a000, 0, 0x10, 0x14, 0x00000020, 0xffffffff, +@@ -2922,6 +2925,7 @@ static int sysc_init_soc(struct sysc *ddata) + break; + case SOC_AM3: + sysc_add_disabled(0x48310000); /* rng */ ++ break; + default: + break; + }; +diff --git a/drivers/gpu/drm/nouveau/dispnv50/crc.c b/drivers/gpu/drm/nouveau/dispnv50/crc.c +index b8c31b697797e..66f32d965c723 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/crc.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/crc.c +@@ -704,6 +704,7 @@ static const struct file_operations nv50_crc_flip_threshold_fops = { + .open = nv50_crc_debugfs_flip_threshold_open, + .read = seq_read, + .write = nv50_crc_debugfs_flip_threshold_set, ++ .release = single_release, + }; + + int nv50_head_crc_late_register(struct nv50_head *head) +diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c +index 61826cac3061a..be649d14f8797 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/head.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/head.c +@@ -51,6 +51,7 @@ nv50_head_flush_clr(struct nv50_head *head, + void + nv50_head_flush_set_wndw(struct nv50_head *head, struct nv50_head_atom *asyh) + { ++ if (asyh->set.curs ) head->func->curs_set(head, asyh); + if (asyh->set.olut ) { + asyh->olut.offset = nv50_lut_load(&head->olut, + asyh->olut.buffer, +@@ -66,7 +67,6 @@ nv50_head_flush_set(struct nv50_head *head, struct nv50_head_atom *asyh) + if (asyh->set.view ) head->func->view (head, asyh); + if (asyh->set.mode ) head->func->mode (head, asyh); + if (asyh->set.core ) head->func->core_set(head, asyh); +- if (asyh->set.curs ) head->func->curs_set(head, asyh); + if (asyh->set.base ) head->func->base (head, asyh); + if (asyh->set.ovly ) head->func->ovly (head, asyh); + if (asyh->set.dither ) head->func->dither (head, asyh); +diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c +index c2bc05eb2e54a..1cbe01048b930 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c ++++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c +@@ -207,6 +207,7 @@ static const struct file_operations nouveau_pstate_fops = { + .open = nouveau_debugfs_pstate_open, + .read = seq_read, + .write = nouveau_debugfs_pstate_set, ++ .release = single_release, + }; + + static struct drm_info_list nouveau_debugfs_list[] = { +diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c +index c2051380d18c0..6504ebec11901 100644 +--- a/drivers/gpu/drm/nouveau/nouveau_gem.c ++++ b/drivers/gpu/drm/nouveau/nouveau_gem.c +@@ -196,10 +196,8 @@ nouveau_gem_new(struct nouveau_cli *cli, u64 size, int align, uint32_t domain, + } + + ret = nouveau_bo_init(nvbo, size, align, domain, NULL, NULL); +- if (ret) { +- nouveau_bo_ref(NULL, &nvbo); ++ if (ret) + return ret; +- } + + /* we restrict allowed domains on nv50+ to only the types + * that were requested at creation time. not possibly on +diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +index f75fb157f2ff7..016b877051dab 100644 +--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c ++++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +@@ -216,11 +216,13 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, + goto err_disable_clk_tmds; + } + ++ ret = sun8i_hdmi_phy_init(hdmi->phy); ++ if (ret) ++ goto err_disable_clk_tmds; ++ + drm_encoder_helper_add(encoder, &sun8i_dw_hdmi_encoder_helper_funcs); + drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); + +- sun8i_hdmi_phy_init(hdmi->phy); +- + plat_data->mode_valid = hdmi->quirks->mode_valid; + plat_data->use_drm_infoframe = hdmi->quirks->use_drm_infoframe; + sun8i_hdmi_phy_set_ops(hdmi->phy, plat_data); +@@ -262,6 +264,7 @@ static void sun8i_dw_hdmi_unbind(struct device *dev, struct device *master, + struct sun8i_dw_hdmi *hdmi = dev_get_drvdata(dev); + + dw_hdmi_unbind(hdmi->hdmi); ++ sun8i_hdmi_phy_deinit(hdmi->phy); + clk_disable_unprepare(hdmi->clk_tmds); + reset_control_assert(hdmi->rst_ctrl); + gpiod_set_value(hdmi->ddc_en, 0); +diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +index 74f6ed0e25709..bffe1b9cd3dcb 100644 +--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h ++++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +@@ -169,6 +169,7 @@ struct sun8i_hdmi_phy { + struct clk *clk_phy; + struct clk *clk_pll0; + struct clk *clk_pll1; ++ struct device *dev; + unsigned int rcal; + struct regmap *regs; + struct reset_control *rst_phy; +@@ -205,7 +206,8 @@ encoder_to_sun8i_dw_hdmi(struct drm_encoder *encoder) + + int sun8i_hdmi_phy_get(struct sun8i_dw_hdmi *hdmi, struct device_node *node); + +-void sun8i_hdmi_phy_init(struct sun8i_hdmi_phy *phy); ++int sun8i_hdmi_phy_init(struct sun8i_hdmi_phy *phy); ++void sun8i_hdmi_phy_deinit(struct sun8i_hdmi_phy *phy); + void sun8i_hdmi_phy_set_ops(struct sun8i_hdmi_phy *phy, + struct dw_hdmi_plat_data *plat_data); + +diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +index c9239708d398c..b64d93da651d2 100644 +--- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c ++++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +@@ -506,9 +506,60 @@ static void sun8i_hdmi_phy_init_h3(struct sun8i_hdmi_phy *phy) + phy->rcal = (val & SUN8I_HDMI_PHY_ANA_STS_RCAL_MASK) >> 2; + } + +-void sun8i_hdmi_phy_init(struct sun8i_hdmi_phy *phy) ++int sun8i_hdmi_phy_init(struct sun8i_hdmi_phy *phy) + { ++ int ret; ++ ++ ret = reset_control_deassert(phy->rst_phy); ++ if (ret) { ++ dev_err(phy->dev, "Cannot deassert phy reset control: %d\n", ret); ++ return ret; ++ } ++ ++ ret = clk_prepare_enable(phy->clk_bus); ++ if (ret) { ++ dev_err(phy->dev, "Cannot enable bus clock: %d\n", ret); ++ goto err_assert_rst_phy; ++ } ++ ++ ret = clk_prepare_enable(phy->clk_mod); ++ if (ret) { ++ dev_err(phy->dev, "Cannot enable mod clock: %d\n", ret); ++ goto err_disable_clk_bus; ++ } ++ ++ if (phy->variant->has_phy_clk) { ++ ret = sun8i_phy_clk_create(phy, phy->dev, ++ phy->variant->has_second_pll); ++ if (ret) { ++ dev_err(phy->dev, "Couldn't create the PHY clock\n"); ++ goto err_disable_clk_mod; ++ } ++ ++ clk_prepare_enable(phy->clk_phy); ++ } ++ + phy->variant->phy_init(phy); ++ ++ return 0; ++ ++err_disable_clk_mod: ++ clk_disable_unprepare(phy->clk_mod); ++err_disable_clk_bus: ++ clk_disable_unprepare(phy->clk_bus); ++err_assert_rst_phy: ++ reset_control_assert(phy->rst_phy); ++ ++ return ret; ++} ++ ++void sun8i_hdmi_phy_deinit(struct sun8i_hdmi_phy *phy) ++{ ++ clk_disable_unprepare(phy->clk_mod); ++ clk_disable_unprepare(phy->clk_bus); ++ clk_disable_unprepare(phy->clk_phy); ++ ++ reset_control_assert(phy->rst_phy); + } + + void sun8i_hdmi_phy_set_ops(struct sun8i_hdmi_phy *phy, +@@ -638,6 +689,7 @@ static int sun8i_hdmi_phy_probe(struct platform_device *pdev) + return -ENOMEM; + + phy->variant = (struct sun8i_hdmi_phy_variant *)match->data; ++ phy->dev = dev; + + ret = of_address_to_resource(node, 0, &res); + if (ret) { +@@ -696,47 +748,10 @@ static int sun8i_hdmi_phy_probe(struct platform_device *pdev) + goto err_put_clk_pll1; + } + +- ret = reset_control_deassert(phy->rst_phy); +- if (ret) { +- dev_err(dev, "Cannot deassert phy reset control: %d\n", ret); +- goto err_put_rst_phy; +- } +- +- ret = clk_prepare_enable(phy->clk_bus); +- if (ret) { +- dev_err(dev, "Cannot enable bus clock: %d\n", ret); +- goto err_deassert_rst_phy; +- } +- +- ret = clk_prepare_enable(phy->clk_mod); +- if (ret) { +- dev_err(dev, "Cannot enable mod clock: %d\n", ret); +- goto err_disable_clk_bus; +- } +- +- if (phy->variant->has_phy_clk) { +- ret = sun8i_phy_clk_create(phy, dev, +- phy->variant->has_second_pll); +- if (ret) { +- dev_err(dev, "Couldn't create the PHY clock\n"); +- goto err_disable_clk_mod; +- } +- +- clk_prepare_enable(phy->clk_phy); +- } +- + platform_set_drvdata(pdev, phy); + + return 0; + +-err_disable_clk_mod: +- clk_disable_unprepare(phy->clk_mod); +-err_disable_clk_bus: +- clk_disable_unprepare(phy->clk_bus); +-err_deassert_rst_phy: +- reset_control_assert(phy->rst_phy); +-err_put_rst_phy: +- reset_control_put(phy->rst_phy); + err_put_clk_pll1: + clk_put(phy->clk_pll1); + err_put_clk_pll0: +@@ -753,12 +768,6 @@ static int sun8i_hdmi_phy_remove(struct platform_device *pdev) + { + struct sun8i_hdmi_phy *phy = platform_get_drvdata(pdev); + +- clk_disable_unprepare(phy->clk_mod); +- clk_disable_unprepare(phy->clk_bus); +- clk_disable_unprepare(phy->clk_phy); +- +- reset_control_assert(phy->rst_phy); +- + reset_control_put(phy->rst_phy); + + clk_put(phy->clk_pll0); +diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c +index 1a5f1ccd1d2f7..0af2784cbd0d9 100644 +--- a/drivers/i2c/busses/i2c-mt65xx.c ++++ b/drivers/i2c/busses/i2c-mt65xx.c +@@ -41,6 +41,8 @@ + #define I2C_HANDSHAKE_RST 0x0020 + #define I2C_FIFO_ADDR_CLR 0x0001 + #define I2C_DELAY_LEN 0x0002 ++#define I2C_ST_START_CON 0x8001 ++#define I2C_FS_START_CON 0x1800 + #define I2C_TIME_CLR_VALUE 0x0000 + #define I2C_TIME_DEFAULT_VALUE 0x0003 + #define I2C_WRRD_TRANAC_VALUE 0x0002 +@@ -479,6 +481,7 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c) + { + u16 control_reg; + u16 intr_stat_reg; ++ u16 ext_conf_val; + + mtk_i2c_writew(i2c, I2C_CHN_CLR_FLAG, OFFSET_START); + intr_stat_reg = mtk_i2c_readw(i2c, OFFSET_INTR_STAT); +@@ -517,8 +520,13 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c) + if (i2c->dev_comp->ltiming_adjust) + mtk_i2c_writew(i2c, i2c->ltiming_reg, OFFSET_LTIMING); + ++ if (i2c->speed_hz <= I2C_MAX_STANDARD_MODE_FREQ) ++ ext_conf_val = I2C_ST_START_CON; ++ else ++ ext_conf_val = I2C_FS_START_CON; ++ + if (i2c->dev_comp->timing_adjust) { +- mtk_i2c_writew(i2c, i2c->ac_timing.ext, OFFSET_EXT_CONF); ++ ext_conf_val = i2c->ac_timing.ext; + mtk_i2c_writew(i2c, i2c->ac_timing.inter_clk_div, + OFFSET_CLOCK_DIV); + mtk_i2c_writew(i2c, I2C_SCL_MIS_COMP_VALUE, +@@ -543,6 +551,7 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c) + OFFSET_HS_STA_STO_AC_TIMING); + } + } ++ mtk_i2c_writew(i2c, ext_conf_val, OFFSET_EXT_CONF); + + /* If use i2c pin from PMIC mt6397 side, need set PATH_DIR first */ + if (i2c->have_pmic) +diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c +index 37c510d9347a7..4b136d8710743 100644 +--- a/drivers/i2c/i2c-core-acpi.c ++++ b/drivers/i2c/i2c-core-acpi.c +@@ -426,6 +426,7 @@ static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value, + break; + + i2c_acpi_register_device(adapter, adev, &info); ++ put_device(&adapter->dev); + break; + case ACPI_RECONFIG_DEVICE_REMOVE: + if (!acpi_device_enumerated(adev)) +diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c +index d3f40c9a8c6c8..b274083a6e635 100644 +--- a/drivers/mmc/host/meson-gx-mmc.c ++++ b/drivers/mmc/host/meson-gx-mmc.c +@@ -735,7 +735,7 @@ static void meson_mmc_desc_chain_transfer(struct mmc_host *mmc, u32 cmd_cfg) + writel(start, host->regs + SD_EMMC_START); + } + +-/* local sg copy to buffer version with _to/fromio usage for dram_access_quirk */ ++/* local sg copy for dram_access_quirk */ + static void meson_mmc_copy_buffer(struct meson_host *host, struct mmc_data *data, + size_t buflen, bool to_buffer) + { +@@ -753,21 +753,27 @@ static void meson_mmc_copy_buffer(struct meson_host *host, struct mmc_data *data + sg_miter_start(&miter, sgl, nents, sg_flags); + + while ((offset < buflen) && sg_miter_next(&miter)) { +- unsigned int len; ++ unsigned int buf_offset = 0; ++ unsigned int len, left; ++ u32 *buf = miter.addr; + + len = min(miter.length, buflen - offset); ++ left = len; + +- /* When dram_access_quirk, the bounce buffer is a iomem mapping */ +- if (host->dram_access_quirk) { +- if (to_buffer) +- memcpy_toio(host->bounce_iomem_buf + offset, miter.addr, len); +- else +- memcpy_fromio(miter.addr, host->bounce_iomem_buf + offset, len); ++ if (to_buffer) { ++ do { ++ writel(*buf++, host->bounce_iomem_buf + offset + buf_offset); ++ ++ buf_offset += 4; ++ left -= 4; ++ } while (left); + } else { +- if (to_buffer) +- memcpy(host->bounce_buf + offset, miter.addr, len); +- else +- memcpy(miter.addr, host->bounce_buf + offset, len); ++ do { ++ *buf++ = readl(host->bounce_iomem_buf + offset + buf_offset); ++ ++ buf_offset += 4; ++ left -= 4; ++ } while (left); + } + + offset += len; +@@ -819,7 +825,11 @@ static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd) + if (data->flags & MMC_DATA_WRITE) { + cmd_cfg |= CMD_CFG_DATA_WR; + WARN_ON(xfer_bytes > host->bounce_buf_size); +- meson_mmc_copy_buffer(host, data, xfer_bytes, true); ++ if (host->dram_access_quirk) ++ meson_mmc_copy_buffer(host, data, xfer_bytes, true); ++ else ++ sg_copy_to_buffer(data->sg, data->sg_len, ++ host->bounce_buf, xfer_bytes); + dma_wmb(); + } + +@@ -838,12 +848,43 @@ static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd) + writel(cmd->arg, host->regs + SD_EMMC_CMD_ARG); + } + ++static int meson_mmc_validate_dram_access(struct mmc_host *mmc, struct mmc_data *data) ++{ ++ struct scatterlist *sg; ++ int i; ++ ++ /* Reject request if any element offset or size is not 32bit aligned */ ++ for_each_sg(data->sg, sg, data->sg_len, i) { ++ if (!IS_ALIGNED(sg->offset, sizeof(u32)) || ++ !IS_ALIGNED(sg->length, sizeof(u32))) { ++ dev_err(mmc_dev(mmc), "unaligned sg offset %u len %u\n", ++ data->sg->offset, data->sg->length); ++ return -EINVAL; ++ } ++ } ++ ++ return 0; ++} ++ + static void meson_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) + { + struct meson_host *host = mmc_priv(mmc); + bool needs_pre_post_req = mrq->data && + !(mrq->data->host_cookie & SD_EMMC_PRE_REQ_DONE); + ++ /* ++ * The memory at the end of the controller used as bounce buffer for ++ * the dram_access_quirk only accepts 32bit read/write access, ++ * check the aligment and length of the data before starting the request. ++ */ ++ if (host->dram_access_quirk && mrq->data) { ++ mrq->cmd->error = meson_mmc_validate_dram_access(mmc, mrq->data); ++ if (mrq->cmd->error) { ++ mmc_request_done(mmc, mrq); ++ return; ++ } ++ } ++ + if (needs_pre_post_req) { + meson_mmc_get_transfer_mode(mmc, mrq); + if (!meson_mmc_desc_chain_mode(mrq->data)) +@@ -988,7 +1029,11 @@ static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id) + if (meson_mmc_bounce_buf_read(data)) { + xfer_bytes = data->blksz * data->blocks; + WARN_ON(xfer_bytes > host->bounce_buf_size); +- meson_mmc_copy_buffer(host, data, xfer_bytes, false); ++ if (host->dram_access_quirk) ++ meson_mmc_copy_buffer(host, data, xfer_bytes, false); ++ else ++ sg_copy_from_buffer(data->sg, data->sg_len, ++ host->bounce_buf, xfer_bytes); + } + + next_cmd = meson_mmc_get_next_command(cmd); +diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c +index 5564d7b23e7cd..d1a1c548c515f 100644 +--- a/drivers/mmc/host/sdhci-of-at91.c ++++ b/drivers/mmc/host/sdhci-of-at91.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -61,7 +62,6 @@ static void sdhci_at91_set_force_card_detect(struct sdhci_host *host) + static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock) + { + u16 clk; +- unsigned long timeout; + + host->mmc->actual_clock = 0; + +@@ -86,16 +86,11 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock) + sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); + + /* Wait max 20 ms */ +- timeout = 20; +- while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL)) +- & SDHCI_CLOCK_INT_STABLE)) { +- if (timeout == 0) { +- pr_err("%s: Internal clock never stabilised.\n", +- mmc_hostname(host->mmc)); +- return; +- } +- timeout--; +- mdelay(1); ++ if (read_poll_timeout(sdhci_readw, clk, (clk & SDHCI_CLOCK_INT_STABLE), ++ 1000, 20000, false, host, SDHCI_CLOCK_CONTROL)) { ++ pr_err("%s: Internal clock never stabilised.\n", ++ mmc_hostname(host->mmc)); ++ return; + } + + clk |= SDHCI_CLOCK_CARD_EN; +@@ -114,6 +109,7 @@ static void sdhci_at91_reset(struct sdhci_host *host, u8 mask) + { + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_at91_priv *priv = sdhci_pltfm_priv(pltfm_host); ++ unsigned int tmp; + + sdhci_reset(host, mask); + +@@ -126,6 +122,10 @@ static void sdhci_at91_reset(struct sdhci_host *host, u8 mask) + + sdhci_writel(host, calcr | SDMMC_CALCR_ALWYSON | SDMMC_CALCR_EN, + SDMMC_CALCR); ++ ++ if (read_poll_timeout(sdhci_readl, tmp, !(tmp & SDMMC_CALCR_EN), ++ 10, 20000, false, host, SDMMC_CALCR)) ++ dev_err(mmc_dev(host->mmc), "Failed to calibrate\n"); + } + } + +diff --git a/drivers/net/ethernet/google/gve/gve.h b/drivers/net/ethernet/google/gve/gve.h +index f5c80229ea966..cfb174624d4ee 100644 +--- a/drivers/net/ethernet/google/gve/gve.h ++++ b/drivers/net/ethernet/google/gve/gve.h +@@ -472,7 +472,7 @@ struct gve_queue_page_list *gve_assign_rx_qpl(struct gve_priv *priv) + gve_num_tx_qpls(priv)); + + /* we are out of rx qpls */ +- if (id == priv->qpl_cfg.qpl_map_size) ++ if (id == gve_num_tx_qpls(priv) + gve_num_rx_qpls(priv)) + return NULL; + + set_bit(id, priv->qpl_cfg.qpl_id_map); +diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c +index 0b714b606ba19..fd52218f48846 100644 +--- a/drivers/net/ethernet/google/gve/gve_main.c ++++ b/drivers/net/ethernet/google/gve/gve_main.c +@@ -30,6 +30,7 @@ static void gve_get_stats(struct net_device *dev, struct rtnl_link_stats64 *s) + { + struct gve_priv *priv = netdev_priv(dev); + unsigned int start; ++ u64 packets, bytes; + int ring; + + if (priv->rx) { +@@ -37,10 +38,12 @@ static void gve_get_stats(struct net_device *dev, struct rtnl_link_stats64 *s) + do { + start = + u64_stats_fetch_begin(&priv->rx[ring].statss); +- s->rx_packets += priv->rx[ring].rpackets; +- s->rx_bytes += priv->rx[ring].rbytes; ++ packets = priv->rx[ring].rpackets; ++ bytes = priv->rx[ring].rbytes; + } while (u64_stats_fetch_retry(&priv->rx[ring].statss, + start)); ++ s->rx_packets += packets; ++ s->rx_bytes += bytes; + } + } + if (priv->tx) { +@@ -48,10 +51,12 @@ static void gve_get_stats(struct net_device *dev, struct rtnl_link_stats64 *s) + do { + start = + u64_stats_fetch_begin(&priv->tx[ring].statss); +- s->tx_packets += priv->tx[ring].pkt_done; +- s->tx_bytes += priv->tx[ring].bytes_done; ++ packets = priv->tx[ring].pkt_done; ++ bytes = priv->tx[ring].bytes_done; + } while (u64_stats_fetch_retry(&priv->tx[ring].statss, + start)); ++ s->tx_packets += packets; ++ s->tx_bytes += bytes; + } + } + } +@@ -71,6 +76,9 @@ static int gve_alloc_counter_array(struct gve_priv *priv) + + static void gve_free_counter_array(struct gve_priv *priv) + { ++ if (!priv->counter_array) ++ return; ++ + dma_free_coherent(&priv->pdev->dev, + priv->num_event_counters * + sizeof(*priv->counter_array), +@@ -131,6 +139,9 @@ static int gve_alloc_stats_report(struct gve_priv *priv) + + static void gve_free_stats_report(struct gve_priv *priv) + { ++ if (!priv->stats_report) ++ return; ++ + del_timer_sync(&priv->stats_report_timer); + dma_free_coherent(&priv->pdev->dev, priv->stats_report_len, + priv->stats_report, priv->stats_report_bus); +@@ -301,18 +312,19 @@ static void gve_free_notify_blocks(struct gve_priv *priv) + { + int i; + +- if (priv->msix_vectors) { +- /* Free the irqs */ +- for (i = 0; i < priv->num_ntfy_blks; i++) { +- struct gve_notify_block *block = &priv->ntfy_blocks[i]; +- int msix_idx = i; ++ if (!priv->msix_vectors) ++ return; + +- irq_set_affinity_hint(priv->msix_vectors[msix_idx].vector, +- NULL); +- free_irq(priv->msix_vectors[msix_idx].vector, block); +- } +- free_irq(priv->msix_vectors[priv->mgmt_msix_idx].vector, priv); ++ /* Free the irqs */ ++ for (i = 0; i < priv->num_ntfy_blks; i++) { ++ struct gve_notify_block *block = &priv->ntfy_blocks[i]; ++ int msix_idx = i; ++ ++ irq_set_affinity_hint(priv->msix_vectors[msix_idx].vector, ++ NULL); ++ free_irq(priv->msix_vectors[msix_idx].vector, block); + } ++ free_irq(priv->msix_vectors[priv->mgmt_msix_idx].vector, priv); + dma_free_coherent(&priv->pdev->dev, + priv->num_ntfy_blks * sizeof(*priv->ntfy_blocks), + priv->ntfy_blocks, priv->ntfy_block_bus); +@@ -975,9 +987,10 @@ static void gve_handle_reset(struct gve_priv *priv) + + void gve_handle_report_stats(struct gve_priv *priv) + { +- int idx, stats_idx = 0, tx_bytes; +- unsigned int start = 0; + struct stats *stats = priv->stats_report->stats; ++ int idx, stats_idx = 0; ++ unsigned int start = 0; ++ u64 tx_bytes; + + if (!gve_get_report_stats(priv)) + return; +diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c +index bc648ce0743c7..52c2d6fdeb7a0 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_main.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c +@@ -4839,7 +4839,8 @@ static void i40e_clear_interrupt_scheme(struct i40e_pf *pf) + { + int i; + +- i40e_free_misc_vector(pf); ++ if (test_bit(__I40E_MISC_IRQ_REQUESTED, pf->state)) ++ i40e_free_misc_vector(pf); + + i40e_put_lump(pf->irq_pile, pf->iwarp_base_vector, + I40E_IWARP_IRQ_PILE_ID); +@@ -9662,7 +9663,7 @@ static int i40e_get_capabilities(struct i40e_pf *pf, + if (pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOMEM) { + /* retry with a larger buffer */ + buf_len = data_size; +- } else if (pf->hw.aq.asq_last_status != I40E_AQ_RC_OK) { ++ } else if (pf->hw.aq.asq_last_status != I40E_AQ_RC_OK || err) { + dev_info(&pf->pdev->dev, + "capability discovery failed, err %s aq_err %s\n", + i40e_stat_str(&pf->hw, err), +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +index f327b78261ec4..117a593414537 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +@@ -999,14 +999,9 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, + goto csum_unnecessary; + + if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) { +- u8 ipproto = get_ip_proto(skb, network_depth, proto); +- +- if (unlikely(ipproto == IPPROTO_SCTP)) ++ if (unlikely(get_ip_proto(skb, network_depth, proto) == IPPROTO_SCTP)) + goto csum_unnecessary; + +- if (unlikely(mlx5_ipsec_is_rx_flow(cqe))) +- goto csum_none; +- + stats->csum_complete++; + skb->ip_summed = CHECKSUM_COMPLETE; + skb->csum = csum_unfold((__force __sum16)cqe->check_sum); +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/egress_lgcy.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/egress_lgcy.c +index 3e19b1721303f..b00c7d47833f3 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/egress_lgcy.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/egress_lgcy.c +@@ -79,12 +79,16 @@ int esw_acl_egress_lgcy_setup(struct mlx5_eswitch *esw, + int dest_num = 0; + int err = 0; + +- if (MLX5_CAP_ESW_EGRESS_ACL(esw->dev, flow_counter)) { ++ if (vport->egress.legacy.drop_counter) { ++ drop_counter = vport->egress.legacy.drop_counter; ++ } else if (MLX5_CAP_ESW_EGRESS_ACL(esw->dev, flow_counter)) { + drop_counter = mlx5_fc_create(esw->dev, false); +- if (IS_ERR(drop_counter)) ++ if (IS_ERR(drop_counter)) { + esw_warn(esw->dev, + "vport[%d] configure egress drop rule counter err(%ld)\n", + vport->vport, PTR_ERR(drop_counter)); ++ drop_counter = NULL; ++ } + vport->egress.legacy.drop_counter = drop_counter; + } + +@@ -123,7 +127,7 @@ int esw_acl_egress_lgcy_setup(struct mlx5_eswitch *esw, + flow_act.action = MLX5_FLOW_CONTEXT_ACTION_DROP; + + /* Attach egress drop flow counter */ +- if (!IS_ERR_OR_NULL(drop_counter)) { ++ if (drop_counter) { + flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_COUNT; + drop_ctr_dst.type = MLX5_FLOW_DESTINATION_TYPE_COUNTER; + drop_ctr_dst.counter_id = mlx5_fc_id(drop_counter); +@@ -162,7 +166,7 @@ void esw_acl_egress_lgcy_cleanup(struct mlx5_eswitch *esw, + esw_acl_egress_table_destroy(vport); + + clean_drop_counter: +- if (!IS_ERR_OR_NULL(vport->egress.legacy.drop_counter)) { ++ if (vport->egress.legacy.drop_counter) { + mlx5_fc_destroy(esw->dev, vport->egress.legacy.drop_counter); + vport->egress.legacy.drop_counter = NULL; + } +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c +index d64fad2823e73..45570d0a58d2f 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c +@@ -160,7 +160,9 @@ int esw_acl_ingress_lgcy_setup(struct mlx5_eswitch *esw, + + esw_acl_ingress_lgcy_rules_destroy(vport); + +- if (MLX5_CAP_ESW_INGRESS_ACL(esw->dev, flow_counter)) { ++ if (vport->ingress.legacy.drop_counter) { ++ counter = vport->ingress.legacy.drop_counter; ++ } else if (MLX5_CAP_ESW_INGRESS_ACL(esw->dev, flow_counter)) { + counter = mlx5_fc_create(esw->dev, false); + if (IS_ERR(counter)) { + esw_warn(esw->dev, +diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c +index b848439fa837c..2645ca35103c9 100644 +--- a/drivers/net/phy/mdio_bus.c ++++ b/drivers/net/phy/mdio_bus.c +@@ -534,6 +534,13 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) + bus->dev.groups = NULL; + dev_set_name(&bus->dev, "%s", bus->id); + ++ /* We need to set state to MDIOBUS_UNREGISTERED to correctly release ++ * the device in mdiobus_free() ++ * ++ * State will be updated later in this function in case of success ++ */ ++ bus->state = MDIOBUS_UNREGISTERED; ++ + err = device_register(&bus->dev); + if (err) { + pr_err("mii_bus %s failed to register\n", bus->id); +diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c +index 2fff62695455d..32c34c728c7a1 100644 +--- a/drivers/net/phy/sfp.c ++++ b/drivers/net/phy/sfp.c +@@ -133,7 +133,7 @@ static const char * const sm_state_strings[] = { + [SFP_S_LINK_UP] = "link_up", + [SFP_S_TX_FAULT] = "tx_fault", + [SFP_S_REINIT] = "reinit", +- [SFP_S_TX_DISABLE] = "rx_disable", ++ [SFP_S_TX_DISABLE] = "tx_disable", + }; + + static const char *sm_state_to_str(unsigned short sm_state) +diff --git a/drivers/net/wireless/ath/ath5k/Kconfig b/drivers/net/wireless/ath/ath5k/Kconfig +index f35cd8de228e4..6914b37bb0fbc 100644 +--- a/drivers/net/wireless/ath/ath5k/Kconfig ++++ b/drivers/net/wireless/ath/ath5k/Kconfig +@@ -3,9 +3,7 @@ config ATH5K + tristate "Atheros 5xxx wireless cards support" + depends on (PCI || ATH25) && MAC80211 + select ATH_COMMON +- select MAC80211_LEDS +- select LEDS_CLASS +- select NEW_LEDS ++ select MAC80211_LEDS if LEDS_CLASS=y || LEDS_CLASS=MAC80211 + select ATH5K_AHB if ATH25 + select ATH5K_PCI if !ATH25 + help +diff --git a/drivers/net/wireless/ath/ath5k/led.c b/drivers/net/wireless/ath/ath5k/led.c +index 6a2a168567630..33e9928af3635 100644 +--- a/drivers/net/wireless/ath/ath5k/led.c ++++ b/drivers/net/wireless/ath/ath5k/led.c +@@ -89,7 +89,8 @@ static const struct pci_device_id ath5k_led_devices[] = { + + void ath5k_led_enable(struct ath5k_hw *ah) + { +- if (test_bit(ATH_STAT_LEDSOFT, ah->status)) { ++ if (IS_ENABLED(CONFIG_MAC80211_LEDS) && ++ test_bit(ATH_STAT_LEDSOFT, ah->status)) { + ath5k_hw_set_gpio_output(ah, ah->led_pin); + ath5k_led_off(ah); + } +@@ -104,7 +105,8 @@ static void ath5k_led_on(struct ath5k_hw *ah) + + void ath5k_led_off(struct ath5k_hw *ah) + { +- if (!test_bit(ATH_STAT_LEDSOFT, ah->status)) ++ if (!IS_ENABLED(CONFIG_MAC80211_LEDS) || ++ !test_bit(ATH_STAT_LEDSOFT, ah->status)) + return; + ath5k_hw_set_gpio(ah, ah->led_pin, !ah->led_on); + } +@@ -146,7 +148,7 @@ ath5k_register_led(struct ath5k_hw *ah, struct ath5k_led *led, + static void + ath5k_unregister_led(struct ath5k_led *led) + { +- if (!led->ah) ++ if (!IS_ENABLED(CONFIG_MAC80211_LEDS) || !led->ah) + return; + led_classdev_unregister(&led->led_dev); + ath5k_led_off(led->ah); +@@ -169,7 +171,7 @@ int ath5k_init_leds(struct ath5k_hw *ah) + char name[ATH5K_LED_MAX_NAME_LEN + 1]; + const struct pci_device_id *match; + +- if (!ah->pdev) ++ if (!IS_ENABLED(CONFIG_MAC80211_LEDS) || !ah->pdev) + return 0; + + #ifdef CONFIG_ATH5K_AHB +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c +index 90b12e201795c..4e43efd5d1ea1 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c +@@ -635,6 +635,8 @@ static const struct iwl_dev_info iwl_dev_info_table[] = { + IWL_DEV_INFO(0x43F0, 0x0074, iwl_ax201_cfg_qu_hr, NULL), + IWL_DEV_INFO(0x43F0, 0x0078, iwl_ax201_cfg_qu_hr, NULL), + IWL_DEV_INFO(0x43F0, 0x007C, iwl_ax201_cfg_qu_hr, NULL), ++ IWL_DEV_INFO(0x43F0, 0x1651, killer1650s_2ax_cfg_qu_b0_hr_b0, iwl_ax201_killer_1650s_name), ++ IWL_DEV_INFO(0x43F0, 0x1652, killer1650i_2ax_cfg_qu_b0_hr_b0, iwl_ax201_killer_1650i_name), + IWL_DEV_INFO(0x43F0, 0x2074, iwl_ax201_cfg_qu_hr, NULL), + IWL_DEV_INFO(0x43F0, 0x4070, iwl_ax201_cfg_qu_hr, NULL), + IWL_DEV_INFO(0xA0F0, 0x0070, iwl_ax201_cfg_qu_hr, NULL), +diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c +index 44e15f0e3a2ed..ad3e3cde1c20d 100644 +--- a/drivers/pci/controller/pci-hyperv.c ++++ b/drivers/pci/controller/pci-hyperv.c +@@ -3259,9 +3259,17 @@ static int hv_pci_bus_exit(struct hv_device *hdev, bool keep_devs) + return 0; + + if (!keep_devs) { +- /* Delete any children which might still exist. */ ++ struct list_head removed; ++ ++ /* Move all present children to the list on stack */ ++ INIT_LIST_HEAD(&removed); + spin_lock_irqsave(&hbus->device_list_lock, flags); +- list_for_each_entry_safe(hpdev, tmp, &hbus->children, list_entry) { ++ list_for_each_entry_safe(hpdev, tmp, &hbus->children, list_entry) ++ list_move_tail(&hpdev->list_entry, &removed); ++ spin_unlock_irqrestore(&hbus->device_list_lock, flags); ++ ++ /* Remove all children in the list */ ++ list_for_each_entry_safe(hpdev, tmp, &removed, list_entry) { + list_del(&hpdev->list_entry); + if (hpdev->pci_slot) + pci_destroy_slot(hpdev->pci_slot); +@@ -3269,7 +3277,6 @@ static int hv_pci_bus_exit(struct hv_device *hdev, bool keep_devs) + put_pcichild(hpdev); + put_pcichild(hpdev); + } +- spin_unlock_irqrestore(&hbus->device_list_lock, flags); + } + + ret = hv_send_resources_released(hdev); +diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c +index ce10ecd41ba0f..9492ed09518ff 100644 +--- a/drivers/ptp/ptp_pch.c ++++ b/drivers/ptp/ptp_pch.c +@@ -651,6 +651,7 @@ static const struct pci_device_id pch_ieee1588_pcidev_id[] = { + }, + {0} + }; ++MODULE_DEVICE_TABLE(pci, pch_ieee1588_pcidev_id); + + static SIMPLE_DEV_PM_OPS(pch_pm_ops, pch_suspend, pch_resume); + +diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c +index eba7f76f9d61a..6034cd8992b0e 100644 +--- a/drivers/soc/qcom/mdt_loader.c ++++ b/drivers/soc/qcom/mdt_loader.c +@@ -98,7 +98,7 @@ void *qcom_mdt_read_metadata(const struct firmware *fw, size_t *data_len) + if (ehdr->e_phnum < 2) + return ERR_PTR(-EINVAL); + +- if (phdrs[0].p_type == PT_LOAD || phdrs[1].p_type == PT_LOAD) ++ if (phdrs[0].p_type == PT_LOAD) + return ERR_PTR(-EINVAL); + + if ((phdrs[1].p_flags & QCOM_MDT_TYPE_MASK) != QCOM_MDT_TYPE_HASH) +diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c +index e0620416e5743..60c82dcaa8d1d 100644 +--- a/drivers/soc/qcom/socinfo.c ++++ b/drivers/soc/qcom/socinfo.c +@@ -521,7 +521,7 @@ static int qcom_socinfo_probe(struct platform_device *pdev) + /* Feed the soc specific unique data into entropy pool */ + add_device_randomness(info, item_size); + +- platform_set_drvdata(pdev, qs->soc_dev); ++ platform_set_drvdata(pdev, qs); + + return 0; + } +diff --git a/drivers/soc/ti/omap_prm.c b/drivers/soc/ti/omap_prm.c +index fb067b5e4a977..4a782bfd753c3 100644 +--- a/drivers/soc/ti/omap_prm.c ++++ b/drivers/soc/ti/omap_prm.c +@@ -509,25 +509,28 @@ static int omap_reset_deassert(struct reset_controller_dev *rcdev, + writel_relaxed(v, reset->prm->base + reset->prm->data->rstctrl); + spin_unlock_irqrestore(&reset->lock, flags); + +- if (!has_rstst) +- goto exit; ++ /* wait for the reset bit to clear */ ++ ret = readl_relaxed_poll_timeout_atomic(reset->prm->base + ++ reset->prm->data->rstctrl, ++ v, !(v & BIT(id)), 1, ++ OMAP_RESET_MAX_WAIT); ++ if (ret) ++ pr_err("%s: timedout waiting for %s:%lu\n", __func__, ++ reset->prm->data->name, id); + + /* wait for the status to be set */ +- ret = readl_relaxed_poll_timeout_atomic(reset->prm->base + ++ if (has_rstst) { ++ ret = readl_relaxed_poll_timeout_atomic(reset->prm->base + + reset->prm->data->rstst, + v, v & BIT(st_bit), 1, + OMAP_RESET_MAX_WAIT); +- if (ret) +- pr_err("%s: timedout waiting for %s:%lu\n", __func__, +- reset->prm->data->name, id); ++ if (ret) ++ pr_err("%s: timedout waiting for %s:%lu\n", __func__, ++ reset->prm->data->name, id); ++ } + +-exit: +- if (reset->clkdm) { +- /* At least dra7 iva needs a delay before clkdm idle */ +- if (has_rstst) +- udelay(1); ++ if (reset->clkdm) + pdata->clkdm_allow_idle(reset->clkdm); +- } + + return ret; + } +diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c +index ee565bdb44d65..b4c6527fe5f66 100644 +--- a/drivers/usb/chipidea/ci_hdrc_imx.c ++++ b/drivers/usb/chipidea/ci_hdrc_imx.c +@@ -425,11 +425,16 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) + data->phy = devm_usb_get_phy_by_phandle(dev, "fsl,usbphy", 0); + if (IS_ERR(data->phy)) { + ret = PTR_ERR(data->phy); +- /* Return -EINVAL if no usbphy is available */ +- if (ret == -ENODEV) +- data->phy = NULL; +- else +- goto err_clk; ++ if (ret == -ENODEV) { ++ data->phy = devm_usb_get_phy_by_phandle(dev, "phys", 0); ++ if (IS_ERR(data->phy)) { ++ ret = PTR_ERR(data->phy); ++ if (ret == -ENODEV) ++ data->phy = NULL; ++ else ++ goto err_clk; ++ } ++ } + } + + pdata.usb_phy = data->phy; +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c +index 7748b1335558e..7950d5b3af429 100644 +--- a/drivers/usb/class/cdc-acm.c ++++ b/drivers/usb/class/cdc-acm.c +@@ -340,6 +340,9 @@ static void acm_process_notification(struct acm *acm, unsigned char *buf) + acm->iocount.overrun++; + spin_unlock_irqrestore(&acm->read_lock, flags); + ++ if (newctrl & ACM_CTRL_BRK) ++ tty_flip_buffer_push(&acm->port); ++ + if (difference) + wake_up_all(&acm->wioctl); + +@@ -475,11 +478,16 @@ static int acm_submit_read_urbs(struct acm *acm, gfp_t mem_flags) + + static void acm_process_read_urb(struct acm *acm, struct urb *urb) + { ++ unsigned long flags; ++ + if (!urb->actual_length) + return; + ++ spin_lock_irqsave(&acm->read_lock, flags); + tty_insert_flip_string(&acm->port, urb->transfer_buffer, + urb->actual_length); ++ spin_unlock_irqrestore(&acm->read_lock, flags); ++ + tty_flip_buffer_push(&acm->port); + } + +diff --git a/drivers/usb/common/Kconfig b/drivers/usb/common/Kconfig +index 5e8a04e3dd3c8..b856622431a73 100644 +--- a/drivers/usb/common/Kconfig ++++ b/drivers/usb/common/Kconfig +@@ -6,8 +6,7 @@ config USB_COMMON + + config USB_LED_TRIG + bool "USB LED Triggers" +- depends on LEDS_CLASS && LEDS_TRIGGERS +- select USB_COMMON ++ depends on LEDS_CLASS && USB_COMMON && LEDS_TRIGGERS + help + This option adds LED triggers for USB host and/or gadget activity. + +diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c +index 0b08dd3b19eb0..291d020427924 100644 +--- a/drivers/usb/typec/tcpm/tcpm.c ++++ b/drivers/usb/typec/tcpm/tcpm.c +@@ -3922,6 +3922,7 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1, + tcpm_set_state(port, SRC_ATTACH_WAIT, 0); + break; + case SRC_ATTACHED: ++ case SRC_STARTUP: + case SRC_SEND_CAPABILITIES: + case SRC_READY: + if (tcpm_port_is_disconnected(port) || +diff --git a/drivers/video/fbdev/gbefb.c b/drivers/video/fbdev/gbefb.c +index 31270a8986e8e..8f8ca1f88fe21 100644 +--- a/drivers/video/fbdev/gbefb.c ++++ b/drivers/video/fbdev/gbefb.c +@@ -1269,7 +1269,7 @@ static struct platform_device *gbefb_device; + static int __init gbefb_init(void) + { + int ret = platform_driver_register(&gbefb_driver); +- if (!ret) { ++ if (IS_ENABLED(CONFIG_SGI_IP32) && !ret) { + gbefb_device = platform_device_alloc("gbefb", 0); + if (gbefb_device) { + ret = platform_device_add(gbefb_device); +diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c +index 15d4b1ef19f83..1911a62a6d9c1 100644 +--- a/drivers/xen/balloon.c ++++ b/drivers/xen/balloon.c +@@ -491,12 +491,12 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) + } + + /* +- * Stop waiting if either state is not BP_EAGAIN and ballooning action is +- * needed, or if the credit has changed while state is BP_EAGAIN. ++ * Stop waiting if either state is BP_DONE and ballooning action is ++ * needed, or if the credit has changed while state is not BP_DONE. + */ + static bool balloon_thread_cond(enum bp_state state, long credit) + { +- if (state != BP_EAGAIN) ++ if (state == BP_DONE) + credit = 0; + + return current_credit() != credit || kthread_should_stop(); +@@ -516,10 +516,19 @@ static int balloon_thread(void *unused) + + set_freezable(); + for (;;) { +- if (state == BP_EAGAIN) +- timeout = balloon_stats.schedule_delay * HZ; +- else ++ switch (state) { ++ case BP_DONE: ++ case BP_ECANCELED: + timeout = 3600 * HZ; ++ break; ++ case BP_EAGAIN: ++ timeout = balloon_stats.schedule_delay * HZ; ++ break; ++ case BP_WAIT: ++ timeout = HZ; ++ break; ++ } ++ + credit = current_credit(); + + wait_event_freezable_timeout(balloon_thread_wq, +diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c +index 720a7b7abd46d..fe8df32bb612b 100644 +--- a/drivers/xen/privcmd.c ++++ b/drivers/xen/privcmd.c +@@ -803,11 +803,12 @@ static long privcmd_ioctl_mmap_resource(struct file *file, + unsigned int domid = + (xdata.flags & XENMEM_rsrc_acq_caller_owned) ? + DOMID_SELF : kdata.dom; +- int num; ++ int num, *errs = (int *)pfns; + ++ BUILD_BUG_ON(sizeof(*errs) > sizeof(*pfns)); + num = xen_remap_domain_mfn_array(vma, + kdata.addr & PAGE_MASK, +- pfns, kdata.num, (int *)pfns, ++ pfns, kdata.num, errs, + vma->vm_page_prot, + domid, + vma->vm_private_data); +@@ -817,7 +818,7 @@ static long privcmd_ioctl_mmap_resource(struct file *file, + unsigned int i; + + for (i = 0; i < num; i++) { +- rc = pfns[i]; ++ rc = errs[i]; + if (rc < 0) + break; + } +diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c +index 5f5169b9c2e90..46f825cf53f4f 100644 +--- a/fs/nfsd/nfs4xdr.c ++++ b/fs/nfsd/nfs4xdr.c +@@ -3427,15 +3427,18 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen, + goto fail; + cd->rd_maxcount -= entry_bytes; + /* +- * RFC 3530 14.2.24 describes rd_dircount as only a "hint", so +- * let's always let through the first entry, at least: ++ * RFC 3530 14.2.24 describes rd_dircount as only a "hint", and ++ * notes that it could be zero. If it is zero, then the server ++ * should enforce only the rd_maxcount value. + */ +- if (!cd->rd_dircount) +- goto fail; +- name_and_cookie = 4 + 4 * XDR_QUADLEN(namlen) + 8; +- if (name_and_cookie > cd->rd_dircount && cd->cookie_offset) +- goto fail; +- cd->rd_dircount -= min(cd->rd_dircount, name_and_cookie); ++ if (cd->rd_dircount) { ++ name_and_cookie = 4 + 4 * XDR_QUADLEN(namlen) + 8; ++ if (name_and_cookie > cd->rd_dircount && cd->cookie_offset) ++ goto fail; ++ cd->rd_dircount -= min(cd->rd_dircount, name_and_cookie); ++ if (!cd->rd_dircount) ++ cd->rd_maxcount = 0; ++ } + + cd->cookie_offset = cookie_offset; + skip_entry: +diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c +index 0759e589ab52b..ddf2b375632b7 100644 +--- a/fs/nfsd/nfsctl.c ++++ b/fs/nfsd/nfsctl.c +@@ -1547,7 +1547,7 @@ static int __init init_nfsd(void) + goto out_free_all; + return 0; + out_free_all: +- unregister_pernet_subsys(&nfsd_net_ops); ++ unregister_filesystem(&nfsd_fs_type); + out_free_exports: + remove_proc_entry("fs/nfs/exports", NULL); + remove_proc_entry("fs/nfs", NULL); +diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c +index 08b595c526d74..16955a307dcd9 100644 +--- a/fs/overlayfs/dir.c ++++ b/fs/overlayfs/dir.c +@@ -1214,9 +1214,13 @@ static int ovl_rename(struct inode *olddir, struct dentry *old, + goto out_dput; + } + } else { +- if (!d_is_negative(newdentry) && +- (!new_opaque || !ovl_is_whiteout(newdentry))) +- goto out_dput; ++ if (!d_is_negative(newdentry)) { ++ if (!new_opaque || !ovl_is_whiteout(newdentry)) ++ goto out_dput; ++ } else { ++ if (flags & RENAME_EXCHANGE) ++ goto out_dput; ++ } + } + + if (olddentry == trap) +diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c +index 5c5c3972ebd0a..f7135777cb4eb 100644 +--- a/fs/overlayfs/file.c ++++ b/fs/overlayfs/file.c +@@ -301,6 +301,12 @@ static ssize_t ovl_read_iter(struct kiocb *iocb, struct iov_iter *iter) + if (ret) + return ret; + ++ ret = -EINVAL; ++ if (iocb->ki_flags & IOCB_DIRECT && ++ (!real.file->f_mapping->a_ops || ++ !real.file->f_mapping->a_ops->direct_IO)) ++ goto out_fdput; ++ + old_cred = ovl_override_creds(file_inode(file)->i_sb); + if (is_sync_kiocb(iocb)) { + ret = vfs_iter_read(real.file, iter, &iocb->ki_pos, +@@ -325,7 +331,7 @@ static ssize_t ovl_read_iter(struct kiocb *iocb, struct iov_iter *iter) + out: + revert_creds(old_cred); + ovl_file_accessed(file); +- ++out_fdput: + fdput(real); + + return ret; +@@ -354,6 +360,12 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter) + if (ret) + goto out_unlock; + ++ ret = -EINVAL; ++ if (iocb->ki_flags & IOCB_DIRECT && ++ (!real.file->f_mapping->a_ops || ++ !real.file->f_mapping->a_ops->direct_IO)) ++ goto out_fdput; ++ + if (!ovl_should_sync(OVL_FS(inode->i_sb))) + ifl &= ~(IOCB_DSYNC | IOCB_SYNC); + +@@ -389,6 +401,7 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter) + } + out: + revert_creds(old_cred); ++out_fdput: + fdput(real); + + out_unlock: +diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c +index ebf60848d5eb7..4477873ac3a0b 100644 +--- a/kernel/bpf/stackmap.c ++++ b/kernel/bpf/stackmap.c +@@ -64,7 +64,8 @@ static inline int stack_map_data_size(struct bpf_map *map) + + static int prealloc_elems_and_freelist(struct bpf_stack_map *smap) + { +- u32 elem_size = sizeof(struct stack_map_bucket) + smap->map.value_size; ++ u64 elem_size = sizeof(struct stack_map_bucket) + ++ (u64)smap->map.value_size; + int err; + + smap->elems = bpf_map_area_alloc(elem_size * smap->map.max_entries, +diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c +index 73f71c22f4c03..31b00ba5dcc84 100644 +--- a/net/bridge/br_netlink.c ++++ b/net/bridge/br_netlink.c +@@ -1590,7 +1590,8 @@ static size_t br_get_linkxstats_size(const struct net_device *dev, int attr) + } + + return numvls * nla_total_size(sizeof(struct bridge_vlan_xstats)) + +- nla_total_size(sizeof(struct br_mcast_stats)) + ++ nla_total_size_64bit(sizeof(struct br_mcast_stats)) + ++ (p ? nla_total_size_64bit(sizeof(p->stp_xstats)) : 0) + + nla_total_size(0); + } + +diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c +index 7266571d5c7e2..27ffa83ffeb3c 100644 +--- a/net/core/rtnetlink.c ++++ b/net/core/rtnetlink.c +@@ -5257,7 +5257,7 @@ nla_put_failure: + static size_t if_nlmsg_stats_size(const struct net_device *dev, + u32 filter_mask) + { +- size_t size = 0; ++ size_t size = NLMSG_ALIGN(sizeof(struct if_stats_msg)); + + if (stats_attr_valid(filter_mask, IFLA_STATS_LINK_64, 0)) + size += nla_total_size_64bit(sizeof(struct rtnl_link_stats64)); +diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c +index 45fb450b45227..f3fd5c911ed09 100644 +--- a/net/ipv4/inet_hashtables.c ++++ b/net/ipv4/inet_hashtables.c +@@ -242,8 +242,10 @@ static inline int compute_score(struct sock *sk, struct net *net, + + if (!inet_sk_bound_dev_eq(net, sk->sk_bound_dev_if, dif, sdif)) + return -1; ++ score = sk->sk_bound_dev_if ? 2 : 1; + +- score = sk->sk_family == PF_INET ? 2 : 1; ++ if (sk->sk_family == PF_INET) ++ score++; + if (READ_ONCE(sk->sk_incoming_cpu) == raw_smp_processor_id()) + score++; + } +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c +index bd7fd9b1f24c8..655f0d8a13d36 100644 +--- a/net/ipv4/udp.c ++++ b/net/ipv4/udp.c +@@ -390,7 +390,8 @@ static int compute_score(struct sock *sk, struct net *net, + dif, sdif); + if (!dev_match) + return -1; +- score += 4; ++ if (sk->sk_bound_dev_if) ++ score += 4; + + if (READ_ONCE(sk->sk_incoming_cpu) == raw_smp_processor_id()) + score++; +diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c +index 55c290d556059..67c9114835c84 100644 +--- a/net/ipv6/inet6_hashtables.c ++++ b/net/ipv6/inet6_hashtables.c +@@ -106,7 +106,7 @@ static inline int compute_score(struct sock *sk, struct net *net, + if (!inet_sk_bound_dev_eq(net, sk->sk_bound_dev_if, dif, sdif)) + return -1; + +- score = 1; ++ score = sk->sk_bound_dev_if ? 2 : 1; + if (READ_ONCE(sk->sk_incoming_cpu) == raw_smp_processor_id()) + score++; + } +diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c +index 1943ae5103eb6..bae6b51a9bd46 100644 +--- a/net/ipv6/udp.c ++++ b/net/ipv6/udp.c +@@ -133,7 +133,8 @@ static int compute_score(struct sock *sk, struct net *net, + dev_match = udp_sk_bound_dev_eq(net, sk->sk_bound_dev_if, dif, sdif); + if (!dev_match) + return -1; +- score++; ++ if (sk->sk_bound_dev_if) ++ score++; + + if (READ_ONCE(sk->sk_incoming_cpu) == raw_smp_processor_id()) + score++; +diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c +index 8434da3c0487a..0886267ea81ef 100644 +--- a/net/netlink/af_netlink.c ++++ b/net/netlink/af_netlink.c +@@ -586,7 +586,10 @@ static int netlink_insert(struct sock *sk, u32 portid) + + /* We need to ensure that the socket is hashed and visible. */ + smp_wmb(); +- nlk_sk(sk)->bound = portid; ++ /* Paired with lockless reads from netlink_bind(), ++ * netlink_connect() and netlink_sendmsg(). ++ */ ++ WRITE_ONCE(nlk_sk(sk)->bound, portid); + + err: + release_sock(sk); +@@ -1004,7 +1007,8 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, + if (nlk->ngroups < BITS_PER_LONG) + groups &= (1UL << nlk->ngroups) - 1; + +- bound = nlk->bound; ++ /* Paired with WRITE_ONCE() in netlink_insert() */ ++ bound = READ_ONCE(nlk->bound); + if (bound) { + /* Ensure nlk->portid is up-to-date. */ + smp_rmb(); +@@ -1090,8 +1094,9 @@ static int netlink_connect(struct socket *sock, struct sockaddr *addr, + + /* No need for barriers here as we return to user-space without + * using any of the bound attributes. ++ * Paired with WRITE_ONCE() in netlink_insert(). + */ +- if (!nlk->bound) ++ if (!READ_ONCE(nlk->bound)) + err = netlink_autobind(sock); + + if (err == 0) { +@@ -1880,7 +1885,8 @@ static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) + dst_group = nlk->dst_group; + } + +- if (!nlk->bound) { ++ /* Paired with WRITE_ONCE() in netlink_insert() */ ++ if (!READ_ONCE(nlk->bound)) { + err = netlink_autobind(sock); + if (err) + goto out; +diff --git a/net/sched/sch_fifo.c b/net/sched/sch_fifo.c +index a579a4131d22d..e1040421b7979 100644 +--- a/net/sched/sch_fifo.c ++++ b/net/sched/sch_fifo.c +@@ -233,6 +233,9 @@ int fifo_set_limit(struct Qdisc *q, unsigned int limit) + if (strncmp(q->ops->id + 1, "fifo", 4) != 0) + return 0; + ++ if (!q->ops->change) ++ return 0; ++ + nla = kmalloc(nla_attr_size(sizeof(struct tc_fifo_qopt)), GFP_KERNEL); + if (nla) { + nla->nla_type = RTM_NEWQDISC; +diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c +index cb5e5220da552..93899559ba6d2 100644 +--- a/net/sched/sch_taprio.c ++++ b/net/sched/sch_taprio.c +@@ -1630,6 +1630,10 @@ static void taprio_destroy(struct Qdisc *sch) + list_del(&q->taprio_list); + spin_unlock(&taprio_list_lock); + ++ /* Note that taprio_reset() might not be called if an error ++ * happens in qdisc_create(), after taprio_init() has been called. ++ */ ++ hrtimer_cancel(&q->advance_timer); + + taprio_disable_offload(dev, q, NULL); + +diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c +index e22f2d65457da..f5111d62972d3 100644 +--- a/net/sunrpc/auth_gss/svcauth_gss.c ++++ b/net/sunrpc/auth_gss/svcauth_gss.c +@@ -643,7 +643,7 @@ static bool gss_check_seq_num(const struct svc_rqst *rqstp, struct rsc *rsci, + } + __set_bit(seq_num % GSS_SEQ_WIN, sd->sd_win); + goto ok; +- } else if (seq_num <= sd->sd_max - GSS_SEQ_WIN) { ++ } else if (seq_num + GSS_SEQ_WIN <= sd->sd_max) { + goto toolow; + } + if (__test_and_set_bit(seq_num % GSS_SEQ_WIN, sd->sd_win)) +diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c +index dcfdf6a322dc4..c679a79aef513 100644 +--- a/tools/perf/pmu-events/jevents.c ++++ b/tools/perf/pmu-events/jevents.c +@@ -1100,12 +1100,13 @@ static int process_one_file(const char *fpath, const struct stat *sb, + */ + int main(int argc, char *argv[]) + { +- int rc, ret = 0; ++ int rc, ret = 0, empty_map = 0; + int maxfds; + char ldirname[PATH_MAX]; + const char *arch; + const char *output_file; + const char *start_dirname; ++ char *err_string_ext = ""; + struct stat stbuf; + + prog = basename(argv[0]); +@@ -1133,7 +1134,8 @@ int main(int argc, char *argv[]) + /* If architecture does not have any event lists, bail out */ + if (stat(ldirname, &stbuf) < 0) { + pr_info("%s: Arch %s has no PMU event lists\n", prog, arch); +- goto empty_map; ++ empty_map = 1; ++ goto err_close_eventsfp; + } + + /* Include pmu-events.h first */ +@@ -1150,75 +1152,60 @@ int main(int argc, char *argv[]) + */ + + maxfds = get_maxfds(); +- mapfile = NULL; + rc = nftw(ldirname, preprocess_arch_std_files, maxfds, 0); +- if (rc && verbose) { +- pr_info("%s: Error preprocessing arch standard files %s\n", +- prog, ldirname); +- goto empty_map; +- } else if (rc < 0) { +- /* Make build fail */ +- fclose(eventsfp); +- free_arch_std_events(); +- return 1; +- } else if (rc) { +- goto empty_map; +- } ++ if (rc) ++ goto err_processing_std_arch_event_dir; + + rc = nftw(ldirname, process_one_file, maxfds, 0); +- if (rc && verbose) { +- pr_info("%s: Error walking file tree %s\n", prog, ldirname); +- goto empty_map; +- } else if (rc < 0) { +- /* Make build fail */ +- fclose(eventsfp); +- free_arch_std_events(); +- ret = 1; +- goto out_free_mapfile; +- } else if (rc) { +- goto empty_map; +- } ++ if (rc) ++ goto err_processing_dir; + + sprintf(ldirname, "%s/test", start_dirname); + + rc = nftw(ldirname, process_one_file, maxfds, 0); +- if (rc && verbose) { +- pr_info("%s: Error walking file tree %s rc=%d for test\n", +- prog, ldirname, rc); +- goto empty_map; +- } else if (rc < 0) { +- /* Make build fail */ +- free_arch_std_events(); +- ret = 1; +- goto out_free_mapfile; +- } else if (rc) { +- goto empty_map; +- } ++ if (rc) ++ goto err_processing_dir; + + if (close_table) + print_events_table_suffix(eventsfp); + + if (!mapfile) { + pr_info("%s: No CPU->JSON mapping?\n", prog); +- goto empty_map; ++ empty_map = 1; ++ goto err_close_eventsfp; + } + +- if (process_mapfile(eventsfp, mapfile)) { ++ rc = process_mapfile(eventsfp, mapfile); ++ fclose(eventsfp); ++ if (rc) { + pr_info("%s: Error processing mapfile %s\n", prog, mapfile); + /* Make build fail */ +- fclose(eventsfp); +- free_arch_std_events(); + ret = 1; ++ goto err_out; + } + ++ free_arch_std_events(); ++ free(mapfile); ++ return 0; + +- goto out_free_mapfile; +- +-empty_map: ++err_processing_std_arch_event_dir: ++ err_string_ext = " for std arch event"; ++err_processing_dir: ++ if (verbose) { ++ pr_info("%s: Error walking file tree %s%s\n", prog, ldirname, ++ err_string_ext); ++ empty_map = 1; ++ } else if (rc < 0) { ++ ret = 1; ++ } else { ++ empty_map = 1; ++ } ++err_close_eventsfp: + fclose(eventsfp); +- create_empty_mapping(output_file); ++ if (empty_map) ++ create_empty_mapping(output_file); ++err_out: + free_arch_std_events(); +-out_free_mapfile: + free(mapfile); + return ret; + } diff --git a/patch/kernel/archive/sunxi-5.10/patch-5.10.73-74.patch b/patch/kernel/archive/sunxi-5.10/patch-5.10.73-74.patch new file mode 100644 index 0000000000..d6bbfb1906 --- /dev/null +++ b/patch/kernel/archive/sunxi-5.10/patch-5.10.73-74.patch @@ -0,0 +1,1038 @@ +diff --git a/Makefile b/Makefile +index 3f62cea9afc0e..84d540aed24c9 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 10 +-SUBLEVEL = 73 ++SUBLEVEL = 74 + EXTRAVERSION = + NAME = Dare mighty things + +diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c +index 46f91e0f6a082..fd916844a683f 100644 +--- a/arch/m68k/kernel/signal.c ++++ b/arch/m68k/kernel/signal.c +@@ -447,7 +447,7 @@ static inline void save_fpu_state(struct sigcontext *sc, struct pt_regs *regs) + + if (CPU_IS_060 ? sc->sc_fpstate[2] : sc->sc_fpstate[0]) { + fpu_version = sc->sc_fpstate[0]; +- if (CPU_IS_020_OR_030 && ++ if (CPU_IS_020_OR_030 && !regs->stkadj && + regs->vector >= (VEC_FPBRUC * 4) && + regs->vector <= (VEC_FPNAN * 4)) { + /* Clear pending exception in 68882 idle frame */ +@@ -510,7 +510,7 @@ static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs * + if (!(CPU_IS_060 || CPU_IS_COLDFIRE)) + context_size = fpstate[1]; + fpu_version = fpstate[0]; +- if (CPU_IS_020_OR_030 && ++ if (CPU_IS_020_OR_030 && !regs->stkadj && + regs->vector >= (VEC_FPBRUC * 4) && + regs->vector <= (VEC_FPNAN * 4)) { + /* Clear pending exception in 68882 idle frame */ +@@ -828,18 +828,24 @@ badframe: + return 0; + } + ++static inline struct pt_regs *rte_regs(struct pt_regs *regs) ++{ ++ return (void *)regs + regs->stkadj; ++} ++ + static void setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, + unsigned long mask) + { ++ struct pt_regs *tregs = rte_regs(regs); + sc->sc_mask = mask; + sc->sc_usp = rdusp(); + sc->sc_d0 = regs->d0; + sc->sc_d1 = regs->d1; + sc->sc_a0 = regs->a0; + sc->sc_a1 = regs->a1; +- sc->sc_sr = regs->sr; +- sc->sc_pc = regs->pc; +- sc->sc_formatvec = regs->format << 12 | regs->vector; ++ sc->sc_sr = tregs->sr; ++ sc->sc_pc = tregs->pc; ++ sc->sc_formatvec = tregs->format << 12 | tregs->vector; + save_a5_state(sc, regs); + save_fpu_state(sc, regs); + } +@@ -847,6 +853,7 @@ static void setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, + static inline int rt_setup_ucontext(struct ucontext __user *uc, struct pt_regs *regs) + { + struct switch_stack *sw = (struct switch_stack *)regs - 1; ++ struct pt_regs *tregs = rte_regs(regs); + greg_t __user *gregs = uc->uc_mcontext.gregs; + int err = 0; + +@@ -867,9 +874,9 @@ static inline int rt_setup_ucontext(struct ucontext __user *uc, struct pt_regs * + err |= __put_user(sw->a5, &gregs[13]); + err |= __put_user(sw->a6, &gregs[14]); + err |= __put_user(rdusp(), &gregs[15]); +- err |= __put_user(regs->pc, &gregs[16]); +- err |= __put_user(regs->sr, &gregs[17]); +- err |= __put_user((regs->format << 12) | regs->vector, &uc->uc_formatvec); ++ err |= __put_user(tregs->pc, &gregs[16]); ++ err |= __put_user(tregs->sr, &gregs[17]); ++ err |= __put_user((tregs->format << 12) | tregs->vector, &uc->uc_formatvec); + err |= rt_save_fpu_state(uc, regs); + return err; + } +@@ -886,13 +893,14 @@ static int setup_frame(struct ksignal *ksig, sigset_t *set, + struct pt_regs *regs) + { + struct sigframe __user *frame; +- int fsize = frame_extra_sizes(regs->format); ++ struct pt_regs *tregs = rte_regs(regs); ++ int fsize = frame_extra_sizes(tregs->format); + struct sigcontext context; + int err = 0, sig = ksig->sig; + + if (fsize < 0) { + pr_debug("setup_frame: Unknown frame format %#x\n", +- regs->format); ++ tregs->format); + return -EFAULT; + } + +@@ -903,7 +911,7 @@ static int setup_frame(struct ksignal *ksig, sigset_t *set, + + err |= __put_user(sig, &frame->sig); + +- err |= __put_user(regs->vector, &frame->code); ++ err |= __put_user(tregs->vector, &frame->code); + err |= __put_user(&frame->sc, &frame->psc); + + if (_NSIG_WORDS > 1) +@@ -929,34 +937,28 @@ static int setup_frame(struct ksignal *ksig, sigset_t *set, + + push_cache ((unsigned long) &frame->retcode); + +- /* +- * Set up registers for signal handler. All the state we are about +- * to destroy is successfully copied to sigframe. +- */ +- wrusp ((unsigned long) frame); +- regs->pc = (unsigned long) ksig->ka.sa.sa_handler; +- adjustformat(regs); +- + /* + * This is subtle; if we build more than one sigframe, all but the + * first one will see frame format 0 and have fsize == 0, so we won't + * screw stkadj. + */ +- if (fsize) ++ if (fsize) { + regs->stkadj = fsize; +- +- /* Prepare to skip over the extra stuff in the exception frame. */ +- if (regs->stkadj) { +- struct pt_regs *tregs = +- (struct pt_regs *)((ulong)regs + regs->stkadj); ++ tregs = rte_regs(regs); + pr_debug("Performing stackadjust=%04lx\n", regs->stkadj); +- /* This must be copied with decreasing addresses to +- handle overlaps. */ + tregs->vector = 0; + tregs->format = 0; +- tregs->pc = regs->pc; + tregs->sr = regs->sr; + } ++ ++ /* ++ * Set up registers for signal handler. All the state we are about ++ * to destroy is successfully copied to sigframe. ++ */ ++ wrusp ((unsigned long) frame); ++ tregs->pc = (unsigned long) ksig->ka.sa.sa_handler; ++ adjustformat(regs); ++ + return 0; + } + +@@ -964,7 +966,8 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, + struct pt_regs *regs) + { + struct rt_sigframe __user *frame; +- int fsize = frame_extra_sizes(regs->format); ++ struct pt_regs *tregs = rte_regs(regs); ++ int fsize = frame_extra_sizes(tregs->format); + int err = 0, sig = ksig->sig; + + if (fsize < 0) { +@@ -1014,34 +1017,27 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, + + push_cache ((unsigned long) &frame->retcode); + +- /* +- * Set up registers for signal handler. All the state we are about +- * to destroy is successfully copied to sigframe. +- */ +- wrusp ((unsigned long) frame); +- regs->pc = (unsigned long) ksig->ka.sa.sa_handler; +- adjustformat(regs); +- + /* + * This is subtle; if we build more than one sigframe, all but the + * first one will see frame format 0 and have fsize == 0, so we won't + * screw stkadj. + */ +- if (fsize) ++ if (fsize) { + regs->stkadj = fsize; +- +- /* Prepare to skip over the extra stuff in the exception frame. */ +- if (regs->stkadj) { +- struct pt_regs *tregs = +- (struct pt_regs *)((ulong)regs + regs->stkadj); ++ tregs = rte_regs(regs); + pr_debug("Performing stackadjust=%04lx\n", regs->stkadj); +- /* This must be copied with decreasing addresses to +- handle overlaps. */ + tregs->vector = 0; + tregs->format = 0; +- tregs->pc = regs->pc; + tregs->sr = regs->sr; + } ++ ++ /* ++ * Set up registers for signal handler. All the state we are about ++ * to destroy is successfully copied to sigframe. ++ */ ++ wrusp ((unsigned long) frame); ++ tregs->pc = (unsigned long) ksig->ka.sa.sa_handler; ++ adjustformat(regs); + return 0; + } + +diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +index dbc8b76b9b78e..150fa5258fb6f 100644 +--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c ++++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +@@ -1018,6 +1018,8 @@ static int gmc_v10_0_hw_fini(void *handle) + { + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + ++ gmc_v10_0_gart_disable(adev); ++ + if (amdgpu_sriov_vf(adev)) { + /* full access mode, so don't touch any GMC register */ + DRM_DEBUG("For SRIOV client, shouldn't do anything.\n"); +@@ -1026,7 +1028,6 @@ static int gmc_v10_0_hw_fini(void *handle) + + amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0); + amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0); +- gmc_v10_0_gart_disable(adev); + + return 0; + } +diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +index 3ebbddb63705c..3a864041968f6 100644 +--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c ++++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +@@ -1677,6 +1677,8 @@ static int gmc_v9_0_hw_fini(void *handle) + { + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + ++ gmc_v9_0_gart_disable(adev); ++ + if (amdgpu_sriov_vf(adev)) { + /* full access mode, so don't touch any GMC register */ + DRM_DEBUG("For SRIOV client, shouldn't do anything.\n"); +@@ -1685,7 +1687,6 @@ static int gmc_v9_0_hw_fini(void *handle) + + amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0); + amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0); +- gmc_v9_0_gart_disable(adev); + + return 0; + } +diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c +index 6b8f0d004d345..5c1d33cda863b 100644 +--- a/drivers/hid/hid-apple.c ++++ b/drivers/hid/hid-apple.c +@@ -322,12 +322,19 @@ static int apple_event(struct hid_device *hdev, struct hid_field *field, + + /* + * MacBook JIS keyboard has wrong logical maximum ++ * Magic Keyboard JIS has wrong logical maximum + */ + static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int *rsize) + { + struct apple_sc *asc = hid_get_drvdata(hdev); + ++ if(*rsize >=71 && rdesc[70] == 0x65 && rdesc[64] == 0x65) { ++ hid_info(hdev, ++ "fixing up Magic Keyboard JIS report descriptor\n"); ++ rdesc[64] = rdesc[70] = 0xe7; ++ } ++ + if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 && + rdesc[53] == 0x65 && rdesc[59] == 0x65) { + hid_info(hdev, +diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c +index 4228ddc3df0e6..b2719cf37aa52 100644 +--- a/drivers/hid/wacom_wac.c ++++ b/drivers/hid/wacom_wac.c +@@ -4715,6 +4715,12 @@ static const struct wacom_features wacom_features_0x393 = + { "Wacom Intuos Pro S", 31920, 19950, 8191, 63, + INTUOSP2S_BT, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7, + .touch_max = 10 }; ++static const struct wacom_features wacom_features_0x3c6 = ++ { "Wacom Intuos BT S", 15200, 9500, 4095, 63, ++ INTUOSHT3_BT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4 }; ++static const struct wacom_features wacom_features_0x3c8 = ++ { "Wacom Intuos BT M", 21600, 13500, 4095, 63, ++ INTUOSHT3_BT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4 }; + + static const struct wacom_features wacom_features_HID_ANY_ID = + { "Wacom HID", .type = HID_GENERIC, .oVid = HID_ANY_ID, .oPid = HID_ANY_ID }; +@@ -4888,6 +4894,8 @@ const struct hid_device_id wacom_ids[] = { + { USB_DEVICE_WACOM(0x37A) }, + { USB_DEVICE_WACOM(0x37B) }, + { BT_DEVICE_WACOM(0x393) }, ++ { BT_DEVICE_WACOM(0x3c6) }, ++ { BT_DEVICE_WACOM(0x3c8) }, + { USB_DEVICE_WACOM(0x4001) }, + { USB_DEVICE_WACOM(0x4004) }, + { USB_DEVICE_WACOM(0x5000) }, +diff --git a/drivers/hwmon/ltc2947-core.c b/drivers/hwmon/ltc2947-core.c +index bb3f7749a0b00..5423466de697a 100644 +--- a/drivers/hwmon/ltc2947-core.c ++++ b/drivers/hwmon/ltc2947-core.c +@@ -989,8 +989,12 @@ static int ltc2947_setup(struct ltc2947_data *st) + return ret; + + /* check external clock presence */ +- extclk = devm_clk_get(st->dev, NULL); +- if (!IS_ERR(extclk)) { ++ extclk = devm_clk_get_optional(st->dev, NULL); ++ if (IS_ERR(extclk)) ++ return dev_err_probe(st->dev, PTR_ERR(extclk), ++ "Failed to get external clock\n"); ++ ++ if (extclk) { + unsigned long rate_hz; + u8 pre = 0, div, tbctl; + u64 aux; +diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c +index 79bc2032dcb2a..da261d32450d0 100644 +--- a/drivers/hwmon/pmbus/ibm-cffps.c ++++ b/drivers/hwmon/pmbus/ibm-cffps.c +@@ -171,8 +171,14 @@ static ssize_t ibm_cffps_debugfs_read(struct file *file, char __user *buf, + cmd = CFFPS_SN_CMD; + break; + case CFFPS_DEBUGFS_MAX_POWER_OUT: +- rc = i2c_smbus_read_word_swapped(psu->client, +- CFFPS_MAX_POWER_OUT_CMD); ++ if (psu->version == cffps1) { ++ rc = i2c_smbus_read_word_swapped(psu->client, ++ CFFPS_MAX_POWER_OUT_CMD); ++ } else { ++ rc = i2c_smbus_read_word_data(psu->client, ++ CFFPS_MAX_POWER_OUT_CMD); ++ } ++ + if (rc < 0) + return rc; + +diff --git a/drivers/net/ethernet/sun/Kconfig b/drivers/net/ethernet/sun/Kconfig +index 309de38a75304..b0d3f9a2950c0 100644 +--- a/drivers/net/ethernet/sun/Kconfig ++++ b/drivers/net/ethernet/sun/Kconfig +@@ -73,6 +73,7 @@ config CASSINI + config SUNVNET_COMMON + tristate "Common routines to support Sun Virtual Networking" + depends on SUN_LDOMS ++ depends on INET + default m + + config SUNVNET +diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c +index 43e682297fd5f..0a1734f34587d 100644 +--- a/drivers/scsi/ses.c ++++ b/drivers/scsi/ses.c +@@ -118,7 +118,7 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, + static int ses_send_diag(struct scsi_device *sdev, int page_code, + void *buf, int bufflen) + { +- u32 result; ++ int result; + + unsigned char cmd[] = { + SEND_DIAGNOSTIC, +diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c +index b9c86a7e3b97d..6dac58ae61206 100644 +--- a/drivers/scsi/virtio_scsi.c ++++ b/drivers/scsi/virtio_scsi.c +@@ -302,7 +302,7 @@ static void virtscsi_handle_transport_reset(struct virtio_scsi *vscsi, + } + break; + default: +- pr_info("Unsupport virtio scsi event reason %x\n", event->reason); ++ pr_info("Unsupported virtio scsi event reason %x\n", event->reason); + } + } + +@@ -394,7 +394,7 @@ static void virtscsi_handle_event(struct work_struct *work) + virtscsi_handle_param_change(vscsi, event); + break; + default: +- pr_err("Unsupport virtio scsi event %x\n", event->event); ++ pr_err("Unsupported virtio scsi event %x\n", event->event); + } + virtscsi_kick_event(vscsi, event_node); + } +diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c +index 0f7b53d5edea6..a96b688a0410f 100644 +--- a/fs/ext4/inline.c ++++ b/fs/ext4/inline.c +@@ -733,18 +733,13 @@ int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len, + void *kaddr; + struct ext4_iloc iloc; + +- if (unlikely(copied < len)) { +- if (!PageUptodate(page)) { +- copied = 0; +- goto out; +- } +- } ++ if (unlikely(copied < len) && !PageUptodate(page)) ++ return 0; + + ret = ext4_get_inode_loc(inode, &iloc); + if (ret) { + ext4_std_error(inode->i_sb, ret); +- copied = 0; +- goto out; ++ return ret; + } + + ext4_write_lock_xattr(inode, &no_expand); +@@ -757,7 +752,7 @@ int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len, + (void) ext4_find_inline_data_nolock(inode); + + kaddr = kmap_atomic(page); +- ext4_write_inline_data(inode, &iloc, kaddr, pos, len); ++ ext4_write_inline_data(inode, &iloc, kaddr, pos, copied); + kunmap_atomic(kaddr); + SetPageUptodate(page); + /* clear page dirty so that writepages wouldn't work for us. */ +@@ -766,7 +761,7 @@ int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len, + ext4_write_unlock_xattr(inode, &no_expand); + brelse(iloc.bh); + mark_inode_dirty(inode); +-out: ++ + return copied; + } + +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c +index 63a292db75877..317aa1b90fb95 100644 +--- a/fs/ext4/inode.c ++++ b/fs/ext4/inode.c +@@ -1296,6 +1296,7 @@ static int ext4_write_end(struct file *file, + goto errout; + } + copied = ret; ++ ret = 0; + } else + copied = block_write_end(file, mapping, pos, + len, copied, page, fsdata); +@@ -1322,13 +1323,14 @@ static int ext4_write_end(struct file *file, + if (i_size_changed || inline_data) + ret = ext4_mark_inode_dirty(handle, inode); + ++errout: + if (pos + len > inode->i_size && !verity && ext4_can_truncate(inode)) + /* if we have allocated more blocks and copied + * less. We will have blocks allocated outside + * inode->i_size. So truncate them + */ + ext4_orphan_add(handle, inode); +-errout: ++ + ret2 = ext4_journal_stop(handle); + if (!ret) + ret = ret2; +@@ -1411,6 +1413,7 @@ static int ext4_journalled_write_end(struct file *file, + goto errout; + } + copied = ret; ++ ret = 0; + } else if (unlikely(copied < len) && !PageUptodate(page)) { + copied = 0; + ext4_journalled_zero_new_buffers(handle, page, from, to); +@@ -1440,6 +1443,7 @@ static int ext4_journalled_write_end(struct file *file, + ret = ret2; + } + ++errout: + if (pos + len > inode->i_size && !verity && ext4_can_truncate(inode)) + /* if we have allocated more blocks and copied + * less. We will have blocks allocated outside +@@ -1447,7 +1451,6 @@ static int ext4_journalled_write_end(struct file *file, + */ + ext4_orphan_add(handle, inode); + +-errout: + ret2 = ext4_journal_stop(handle); + if (!ret) + ret = ret2; +@@ -3090,35 +3093,37 @@ static int ext4_da_write_end(struct file *file, + end = start + copied - 1; + + /* +- * generic_write_end() will run mark_inode_dirty() if i_size +- * changes. So let's piggyback the i_disksize mark_inode_dirty +- * into that. ++ * Since we are holding inode lock, we are sure i_disksize <= ++ * i_size. We also know that if i_disksize < i_size, there are ++ * delalloc writes pending in the range upto i_size. If the end of ++ * the current write is <= i_size, there's no need to touch ++ * i_disksize since writeback will push i_disksize upto i_size ++ * eventually. If the end of the current write is > i_size and ++ * inside an allocated block (ext4_da_should_update_i_disksize() ++ * check), we need to update i_disksize here as neither ++ * ext4_writepage() nor certain ext4_writepages() paths not ++ * allocating blocks update i_disksize. ++ * ++ * Note that we defer inode dirtying to generic_write_end() / ++ * ext4_da_write_inline_data_end(). + */ + new_i_size = pos + copied; +- if (copied && new_i_size > EXT4_I(inode)->i_disksize) { ++ if (copied && new_i_size > inode->i_size) { + if (ext4_has_inline_data(inode) || +- ext4_da_should_update_i_disksize(page, end)) { ++ ext4_da_should_update_i_disksize(page, end)) + ext4_update_i_disksize(inode, new_i_size); +- /* We need to mark inode dirty even if +- * new_i_size is less that inode->i_size +- * bu greater than i_disksize.(hint delalloc) +- */ +- ret = ext4_mark_inode_dirty(handle, inode); +- } + } + + if (write_mode != CONVERT_INLINE_DATA && + ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA) && + ext4_has_inline_data(inode)) +- ret2 = ext4_da_write_inline_data_end(inode, pos, len, copied, ++ ret = ext4_da_write_inline_data_end(inode, pos, len, copied, + page); + else +- ret2 = generic_write_end(file, mapping, pos, len, copied, ++ ret = generic_write_end(file, mapping, pos, len, copied, + page, fsdata); + +- copied = ret2; +- if (ret2 < 0) +- ret = ret2; ++ copied = ret; + ret2 = ext4_journal_stop(handle); + if (unlikely(ret2 && !ret)) + ret = ret2; +diff --git a/fs/vboxsf/super.c b/fs/vboxsf/super.c +index d7816c01a4f62..c578e772cbd58 100644 +--- a/fs/vboxsf/super.c ++++ b/fs/vboxsf/super.c +@@ -21,10 +21,7 @@ + + #define VBOXSF_SUPER_MAGIC 0x786f4256 /* 'VBox' little endian */ + +-#define VBSF_MOUNT_SIGNATURE_BYTE_0 ('\000') +-#define VBSF_MOUNT_SIGNATURE_BYTE_1 ('\377') +-#define VBSF_MOUNT_SIGNATURE_BYTE_2 ('\376') +-#define VBSF_MOUNT_SIGNATURE_BYTE_3 ('\375') ++static const unsigned char VBSF_MOUNT_SIGNATURE[4] = "\000\377\376\375"; + + static int follow_symlinks; + module_param(follow_symlinks, int, 0444); +@@ -386,12 +383,7 @@ fail_nomem: + + static int vboxsf_parse_monolithic(struct fs_context *fc, void *data) + { +- unsigned char *options = data; +- +- if (options && options[0] == VBSF_MOUNT_SIGNATURE_BYTE_0 && +- options[1] == VBSF_MOUNT_SIGNATURE_BYTE_1 && +- options[2] == VBSF_MOUNT_SIGNATURE_BYTE_2 && +- options[3] == VBSF_MOUNT_SIGNATURE_BYTE_3) { ++ if (data && !memcmp(data, VBSF_MOUNT_SIGNATURE, 4)) { + vbg_err("vboxsf: Old binary mount data not supported, remove obsolete mount.vboxsf and/or update your VBoxService.\n"); + return -EINVAL; + } +diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h +index 072ac6c1ef2b6..c095e713cf08f 100644 +--- a/include/linux/perf_event.h ++++ b/include/linux/perf_event.h +@@ -682,7 +682,9 @@ struct perf_event { + /* + * timestamp shadows the actual context timing but it can + * be safely used in NMI interrupt context. It reflects the +- * context time as it was when the event was last scheduled in. ++ * context time as it was when the event was last scheduled in, ++ * or when ctx_sched_in failed to schedule the event because we ++ * run out of PMC. + * + * ctx_time already accounts for ctx->timestamp. Therefore to + * compute ctx_time for a sample, simply add perf_clock(). +diff --git a/include/linux/sched.h b/include/linux/sched.h +index 29c7ccd5ae42e..b85b26d9ccefe 100644 +--- a/include/linux/sched.h ++++ b/include/linux/sched.h +@@ -1589,7 +1589,7 @@ extern struct pid *cad_pid; + #define tsk_used_math(p) ((p)->flags & PF_USED_MATH) + #define used_math() tsk_used_math(current) + +-static inline bool is_percpu_thread(void) ++static __always_inline bool is_percpu_thread(void) + { + #ifdef CONFIG_SMP + return (current->flags & PF_NO_SETAFFINITY) && +diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h +index 2be90a54a4044..7e58b44705705 100644 +--- a/include/net/pkt_sched.h ++++ b/include/net/pkt_sched.h +@@ -11,6 +11,7 @@ + #include + + #define DEFAULT_TX_QUEUE_LEN 1000 ++#define STAB_SIZE_LOG_MAX 30 + + struct qdisc_walker { + int stop; +diff --git a/kernel/events/core.c b/kernel/events/core.c +index c677f934353af..c811519261710 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -3695,6 +3695,29 @@ static noinline int visit_groups_merge(struct perf_cpu_context *cpuctx, + return 0; + } + ++static inline bool event_update_userpage(struct perf_event *event) ++{ ++ if (likely(!atomic_read(&event->mmap_count))) ++ return false; ++ ++ perf_event_update_time(event); ++ perf_set_shadow_time(event, event->ctx); ++ perf_event_update_userpage(event); ++ ++ return true; ++} ++ ++static inline void group_update_userpage(struct perf_event *group_event) ++{ ++ struct perf_event *event; ++ ++ if (!event_update_userpage(group_event)) ++ return; ++ ++ for_each_sibling_event(event, group_event) ++ event_update_userpage(event); ++} ++ + static int merge_sched_in(struct perf_event *event, void *data) + { + struct perf_event_context *ctx = event->ctx; +@@ -3713,14 +3736,15 @@ static int merge_sched_in(struct perf_event *event, void *data) + } + + if (event->state == PERF_EVENT_STATE_INACTIVE) { ++ *can_add_hw = 0; + if (event->attr.pinned) { + perf_cgroup_event_disable(event, ctx); + perf_event_set_state(event, PERF_EVENT_STATE_ERROR); ++ } else { ++ ctx->rotate_necessary = 1; ++ perf_mux_hrtimer_restart(cpuctx); ++ group_update_userpage(event); + } +- +- *can_add_hw = 0; +- ctx->rotate_necessary = 1; +- perf_mux_hrtimer_restart(cpuctx); + } + + return 0; +@@ -6239,6 +6263,8 @@ accounting: + + ring_buffer_attach(event, rb); + ++ perf_event_update_time(event); ++ perf_set_shadow_time(event, event->ctx); + perf_event_init_userpage(event); + perf_event_update_userpage(event); + } else { +diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c +index eb2b5404806c6..d36168baf6776 100644 +--- a/net/ipv6/netfilter/ip6_tables.c ++++ b/net/ipv6/netfilter/ip6_tables.c +@@ -273,6 +273,7 @@ ip6t_do_table(struct sk_buff *skb, + * things we don't know, ie. tcp syn flag or ports). If the + * rule is also a fragment-specific rule, non-fragments won't + * match it. */ ++ acpar.fragoff = 0; + acpar.hotdrop = false; + acpar.state = state; + +diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c +index 620ecf922408b..870c8eafef929 100644 +--- a/net/mac80211/mesh_pathtbl.c ++++ b/net/mac80211/mesh_pathtbl.c +@@ -60,7 +60,10 @@ static struct mesh_table *mesh_table_alloc(void) + atomic_set(&newtbl->entries, 0); + spin_lock_init(&newtbl->gates_lock); + spin_lock_init(&newtbl->walk_lock); +- rhashtable_init(&newtbl->rhead, &mesh_rht_params); ++ if (rhashtable_init(&newtbl->rhead, &mesh_rht_params)) { ++ kfree(newtbl); ++ return NULL; ++ } + + return newtbl; + } +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c +index 38b5695c2a0c8..b7979c0bffd0f 100644 +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -4064,7 +4064,8 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx) + if (!bssid) + return false; + if (ether_addr_equal(sdata->vif.addr, hdr->addr2) || +- ether_addr_equal(sdata->u.ibss.bssid, hdr->addr2)) ++ ether_addr_equal(sdata->u.ibss.bssid, hdr->addr2) || ++ !is_valid_ether_addr(hdr->addr2)) + return false; + if (ieee80211_is_beacon(hdr->frame_control)) + return true; +diff --git a/net/netfilter/nf_nat_masquerade.c b/net/netfilter/nf_nat_masquerade.c +index 8e8a65d46345b..acd73f717a088 100644 +--- a/net/netfilter/nf_nat_masquerade.c ++++ b/net/netfilter/nf_nat_masquerade.c +@@ -9,8 +9,19 @@ + + #include + ++struct masq_dev_work { ++ struct work_struct work; ++ struct net *net; ++ union nf_inet_addr addr; ++ int ifindex; ++ int (*iter)(struct nf_conn *i, void *data); ++}; ++ ++#define MAX_MASQ_WORKER_COUNT 16 ++ + static DEFINE_MUTEX(masq_mutex); + static unsigned int masq_refcnt __read_mostly; ++static atomic_t masq_worker_count __read_mostly; + + unsigned int + nf_nat_masquerade_ipv4(struct sk_buff *skb, unsigned int hooknum, +@@ -63,13 +74,71 @@ nf_nat_masquerade_ipv4(struct sk_buff *skb, unsigned int hooknum, + } + EXPORT_SYMBOL_GPL(nf_nat_masquerade_ipv4); + +-static int device_cmp(struct nf_conn *i, void *ifindex) ++static void iterate_cleanup_work(struct work_struct *work) ++{ ++ struct masq_dev_work *w; ++ ++ w = container_of(work, struct masq_dev_work, work); ++ ++ nf_ct_iterate_cleanup_net(w->net, w->iter, (void *)w, 0, 0); ++ ++ put_net(w->net); ++ kfree(w); ++ atomic_dec(&masq_worker_count); ++ module_put(THIS_MODULE); ++} ++ ++/* Iterate conntrack table in the background and remove conntrack entries ++ * that use the device/address being removed. ++ * ++ * In case too many work items have been queued already or memory allocation ++ * fails iteration is skipped, conntrack entries will time out eventually. ++ */ ++static void nf_nat_masq_schedule(struct net *net, union nf_inet_addr *addr, ++ int ifindex, ++ int (*iter)(struct nf_conn *i, void *data), ++ gfp_t gfp_flags) ++{ ++ struct masq_dev_work *w; ++ ++ if (atomic_read(&masq_worker_count) > MAX_MASQ_WORKER_COUNT) ++ return; ++ ++ net = maybe_get_net(net); ++ if (!net) ++ return; ++ ++ if (!try_module_get(THIS_MODULE)) ++ goto err_module; ++ ++ w = kzalloc(sizeof(*w), gfp_flags); ++ if (w) { ++ /* We can overshoot MAX_MASQ_WORKER_COUNT, no big deal */ ++ atomic_inc(&masq_worker_count); ++ ++ INIT_WORK(&w->work, iterate_cleanup_work); ++ w->ifindex = ifindex; ++ w->net = net; ++ w->iter = iter; ++ if (addr) ++ w->addr = *addr; ++ schedule_work(&w->work); ++ return; ++ } ++ ++ module_put(THIS_MODULE); ++ err_module: ++ put_net(net); ++} ++ ++static int device_cmp(struct nf_conn *i, void *arg) + { + const struct nf_conn_nat *nat = nfct_nat(i); ++ const struct masq_dev_work *w = arg; + + if (!nat) + return 0; +- return nat->masq_index == (int)(long)ifindex; ++ return nat->masq_index == w->ifindex; + } + + static int masq_device_event(struct notifier_block *this, +@@ -85,8 +154,8 @@ static int masq_device_event(struct notifier_block *this, + * and forget them. + */ + +- nf_ct_iterate_cleanup_net(net, device_cmp, +- (void *)(long)dev->ifindex, 0, 0); ++ nf_nat_masq_schedule(net, NULL, dev->ifindex, ++ device_cmp, GFP_KERNEL); + } + + return NOTIFY_DONE; +@@ -94,35 +163,45 @@ static int masq_device_event(struct notifier_block *this, + + static int inet_cmp(struct nf_conn *ct, void *ptr) + { +- struct in_ifaddr *ifa = (struct in_ifaddr *)ptr; +- struct net_device *dev = ifa->ifa_dev->dev; + struct nf_conntrack_tuple *tuple; ++ struct masq_dev_work *w = ptr; + +- if (!device_cmp(ct, (void *)(long)dev->ifindex)) ++ if (!device_cmp(ct, ptr)) + return 0; + + tuple = &ct->tuplehash[IP_CT_DIR_REPLY].tuple; + +- return ifa->ifa_address == tuple->dst.u3.ip; ++ return nf_inet_addr_cmp(&w->addr, &tuple->dst.u3); + } + + static int masq_inet_event(struct notifier_block *this, + unsigned long event, + void *ptr) + { +- struct in_device *idev = ((struct in_ifaddr *)ptr)->ifa_dev; +- struct net *net = dev_net(idev->dev); ++ const struct in_ifaddr *ifa = ptr; ++ const struct in_device *idev; ++ const struct net_device *dev; ++ union nf_inet_addr addr; ++ ++ if (event != NETDEV_DOWN) ++ return NOTIFY_DONE; + + /* The masq_dev_notifier will catch the case of the device going + * down. So if the inetdev is dead and being destroyed we have + * no work to do. Otherwise this is an individual address removal + * and we have to perform the flush. + */ ++ idev = ifa->ifa_dev; + if (idev->dead) + return NOTIFY_DONE; + +- if (event == NETDEV_DOWN) +- nf_ct_iterate_cleanup_net(net, inet_cmp, ptr, 0, 0); ++ memset(&addr, 0, sizeof(addr)); ++ ++ addr.ip = ifa->ifa_address; ++ ++ dev = idev->dev; ++ nf_nat_masq_schedule(dev_net(idev->dev), &addr, dev->ifindex, ++ inet_cmp, GFP_KERNEL); + + return NOTIFY_DONE; + } +@@ -136,8 +215,6 @@ static struct notifier_block masq_inet_notifier = { + }; + + #if IS_ENABLED(CONFIG_IPV6) +-static atomic_t v6_worker_count __read_mostly; +- + static int + nat_ipv6_dev_get_saddr(struct net *net, const struct net_device *dev, + const struct in6_addr *daddr, unsigned int srcprefs, +@@ -187,40 +264,6 @@ nf_nat_masquerade_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range, + } + EXPORT_SYMBOL_GPL(nf_nat_masquerade_ipv6); + +-struct masq_dev_work { +- struct work_struct work; +- struct net *net; +- struct in6_addr addr; +- int ifindex; +-}; +- +-static int inet6_cmp(struct nf_conn *ct, void *work) +-{ +- struct masq_dev_work *w = (struct masq_dev_work *)work; +- struct nf_conntrack_tuple *tuple; +- +- if (!device_cmp(ct, (void *)(long)w->ifindex)) +- return 0; +- +- tuple = &ct->tuplehash[IP_CT_DIR_REPLY].tuple; +- +- return ipv6_addr_equal(&w->addr, &tuple->dst.u3.in6); +-} +- +-static void iterate_cleanup_work(struct work_struct *work) +-{ +- struct masq_dev_work *w; +- +- w = container_of(work, struct masq_dev_work, work); +- +- nf_ct_iterate_cleanup_net(w->net, inet6_cmp, (void *)w, 0, 0); +- +- put_net(w->net); +- kfree(w); +- atomic_dec(&v6_worker_count); +- module_put(THIS_MODULE); +-} +- + /* atomic notifier; can't call nf_ct_iterate_cleanup_net (it can sleep). + * + * Defer it to the system workqueue. +@@ -233,36 +276,19 @@ static int masq_inet6_event(struct notifier_block *this, + { + struct inet6_ifaddr *ifa = ptr; + const struct net_device *dev; +- struct masq_dev_work *w; +- struct net *net; ++ union nf_inet_addr addr; + +- if (event != NETDEV_DOWN || atomic_read(&v6_worker_count) >= 16) ++ if (event != NETDEV_DOWN) + return NOTIFY_DONE; + + dev = ifa->idev->dev; +- net = maybe_get_net(dev_net(dev)); +- if (!net) +- return NOTIFY_DONE; + +- if (!try_module_get(THIS_MODULE)) +- goto err_module; ++ memset(&addr, 0, sizeof(addr)); + +- w = kmalloc(sizeof(*w), GFP_ATOMIC); +- if (w) { +- atomic_inc(&v6_worker_count); +- +- INIT_WORK(&w->work, iterate_cleanup_work); +- w->ifindex = dev->ifindex; +- w->net = net; +- w->addr = ifa->addr; +- schedule_work(&w->work); ++ addr.in6 = ifa->addr; + +- return NOTIFY_DONE; +- } +- +- module_put(THIS_MODULE); +- err_module: +- put_net(net); ++ nf_nat_masq_schedule(dev_net(dev), &addr, dev->ifindex, inet_cmp, ++ GFP_ATOMIC); + return NOTIFY_DONE; + } + +diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c +index 54a8c363bcdda..7b24582a8a164 100644 +--- a/net/sched/sch_api.c ++++ b/net/sched/sch_api.c +@@ -513,6 +513,12 @@ static struct qdisc_size_table *qdisc_get_stab(struct nlattr *opt, + return stab; + } + ++ if (s->size_log > STAB_SIZE_LOG_MAX || ++ s->cell_log > STAB_SIZE_LOG_MAX) { ++ NL_SET_ERR_MSG(extack, "Invalid logarithmic size of size table"); ++ return ERR_PTR(-EINVAL); ++ } ++ + stab = kmalloc(sizeof(*stab) + tsize * sizeof(u16), GFP_KERNEL); + if (!stab) + return ERR_PTR(-ENOMEM); +diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c +index 2770e8179983a..25548555d8d79 100644 +--- a/sound/soc/intel/boards/sof_sdw.c ++++ b/sound/soc/intel/boards/sof_sdw.c +@@ -847,6 +847,11 @@ static int create_sdw_dailink(struct device *dev, int *be_index, + cpus + *cpu_id, cpu_dai_num, + codecs, codec_num, + NULL, &sdw_ops); ++ /* ++ * SoundWire DAILINKs use 'stream' functions and Bank Switch operations ++ * based on wait_for_completion(), tag them as 'nonatomic'. ++ */ ++ dai_links[*be_index].nonatomic = true; + + ret = set_codec_init_func(link, dai_links + (*be_index)++, + playback, group_id); +diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c +index adc7c37145d64..feced9077dfe1 100644 +--- a/sound/soc/sof/core.c ++++ b/sound/soc/sof/core.c +@@ -354,7 +354,6 @@ int snd_sof_device_remove(struct device *dev) + dev_warn(dev, "error: %d failed to prepare DSP for device removal", + ret); + +- snd_sof_fw_unload(sdev); + snd_sof_ipc_free(sdev); + snd_sof_free_debug(sdev); + snd_sof_free_trace(sdev); +@@ -377,8 +376,7 @@ int snd_sof_device_remove(struct device *dev) + snd_sof_remove(sdev); + + /* release firmware */ +- release_firmware(pdata->fw); +- pdata->fw = NULL; ++ snd_sof_fw_unload(sdev); + + return 0; + } +diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c +index ba9ed66f98bc7..2d5c3fc93bc5c 100644 +--- a/sound/soc/sof/loader.c ++++ b/sound/soc/sof/loader.c +@@ -830,5 +830,7 @@ EXPORT_SYMBOL(snd_sof_run_firmware); + void snd_sof_fw_unload(struct snd_sof_dev *sdev) + { + /* TODO: support module unloading at runtime */ ++ release_firmware(sdev->pdata->fw); ++ sdev->pdata->fw = NULL; + } + EXPORT_SYMBOL(snd_sof_fw_unload); diff --git a/patch/kernel/archive/sunxi-5.10/patch-5.10.74-75.patch b/patch/kernel/archive/sunxi-5.10/patch-5.10.74-75.patch new file mode 100644 index 0000000000..8d9c3ca0dc --- /dev/null +++ b/patch/kernel/archive/sunxi-5.10/patch-5.10.74-75.patch @@ -0,0 +1,2564 @@ +diff --git a/Makefile b/Makefile +index 84d540aed24c9..74318cf964b89 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 10 +-SUBLEVEL = 74 ++SUBLEVEL = 75 + EXTRAVERSION = + NAME = Dare mighty things + +diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts +index 5395e8c2484e0..167538518a1ec 100644 +--- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts ++++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts +@@ -54,8 +54,8 @@ + regulator-always-on; + regulator-settling-time-us = <5000>; + gpios = <&expgpio 4 GPIO_ACTIVE_HIGH>; +- states = <1800000 0x1 +- 3300000 0x0>; ++ states = <1800000 0x1>, ++ <3300000 0x0>; + status = "okay"; + }; + +@@ -255,15 +255,16 @@ + }; + + &pcie0 { +- pci@1,0 { ++ pci@0,0 { ++ device_type = "pci"; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + reg = <0 0 0 0 0>; + +- usb@1,0 { +- reg = <0x10000 0 0 0 0>; ++ usb@0,0 { ++ reg = <0 0 0 0 0>; + resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi +index 3d040f6e2a20f..398ecd7b9b68b 100644 +--- a/arch/arm/boot/dts/bcm2711.dtsi ++++ b/arch/arm/boot/dts/bcm2711.dtsi +@@ -514,8 +514,8 @@ + compatible = "brcm,genet-mdio-v5"; + reg = <0xe14 0x8>; + reg-names = "mdio"; +- #address-cells = <0x0>; +- #size-cells = <0x1>; ++ #address-cells = <0x1>; ++ #size-cells = <0x0>; + }; + }; + }; +diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c +index 55ecf6de9ff77..99cd6e7184083 100644 +--- a/arch/arm64/mm/hugetlbpage.c ++++ b/arch/arm64/mm/hugetlbpage.c +@@ -43,7 +43,7 @@ void __init arm64_hugetlb_cma_reserve(void) + #ifdef CONFIG_ARM64_4K_PAGES + order = PUD_SHIFT - PAGE_SHIFT; + #else +- order = CONT_PMD_SHIFT + PMD_SHIFT - PAGE_SHIFT; ++ order = CONT_PMD_SHIFT - PAGE_SHIFT; + #endif + /* + * HugeTLB CMA reservation is required for gigantic +diff --git a/arch/csky/kernel/ptrace.c b/arch/csky/kernel/ptrace.c +index a4cf2e2ac15ac..ac07695bc5418 100644 +--- a/arch/csky/kernel/ptrace.c ++++ b/arch/csky/kernel/ptrace.c +@@ -98,7 +98,8 @@ static int gpr_set(struct task_struct *target, + if (ret) + return ret; + +- regs.sr = task_pt_regs(target)->sr; ++ /* BIT(0) of regs.sr is Condition Code/Carry bit */ ++ regs.sr = (regs.sr & BIT(0)) | (task_pt_regs(target)->sr & ~BIT(0)); + #ifdef CONFIG_CPU_HAS_HILO + regs.dcsr = task_pt_regs(target)->dcsr; + #endif +diff --git a/arch/csky/kernel/signal.c b/arch/csky/kernel/signal.c +index 8b068cf374478..0ca49b5e3dd37 100644 +--- a/arch/csky/kernel/signal.c ++++ b/arch/csky/kernel/signal.c +@@ -52,10 +52,14 @@ static long restore_sigcontext(struct pt_regs *regs, + struct sigcontext __user *sc) + { + int err = 0; ++ unsigned long sr = regs->sr; + + /* sc_pt_regs is structured the same as the start of pt_regs */ + err |= __copy_from_user(regs, &sc->sc_pt_regs, sizeof(struct pt_regs)); + ++ /* BIT(0) of regs->sr is Condition Code/Carry bit */ ++ regs->sr = (sr & ~1) | (regs->sr & 1); ++ + /* Restore the floating-point state. */ + err |= restore_fpu_state(sc); + +diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c +index 5b0f6b6278e3d..6018f73d947da 100644 +--- a/arch/powerpc/sysdev/xive/common.c ++++ b/arch/powerpc/sysdev/xive/common.c +@@ -997,7 +997,8 @@ static int xive_get_irqchip_state(struct irq_data *data, + * interrupt to be inactive in that case. + */ + *state = (pq != XIVE_ESB_INVALID) && !xd->stale_p && +- (xd->saved_p || !!(pq & XIVE_ESB_VAL_P)); ++ (xd->saved_p || (!!(pq & XIVE_ESB_VAL_P) && ++ !irqd_irq_disabled(data))); + return 0; + default: + return -EINVAL; +diff --git a/arch/s390/lib/string.c b/arch/s390/lib/string.c +index 93b3209b94a2f..db4e539d8c7fe 100644 +--- a/arch/s390/lib/string.c ++++ b/arch/s390/lib/string.c +@@ -246,14 +246,13 @@ EXPORT_SYMBOL(strcmp); + #ifdef __HAVE_ARCH_STRRCHR + char *strrchr(const char *s, int c) + { +- size_t len = __strend(s) - s; +- +- if (len) +- do { +- if (s[len] == (char) c) +- return (char *) s + len; +- } while (--len > 0); +- return NULL; ++ ssize_t len = __strend(s) - s; ++ ++ do { ++ if (s[len] == (char)c) ++ return (char *)s + len; ++ } while (--len >= 0); ++ return NULL; + } + EXPORT_SYMBOL(strrchr); + #endif +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig +index 4201d0cf5f835..c3d9f56c90186 100644 +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -1534,7 +1534,6 @@ config AMD_MEM_ENCRYPT + + config AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT + bool "Activate AMD Secure Memory Encryption (SME) by default" +- default y + depends on AMD_MEM_ENCRYPT + help + Say yes to have system memory encrypted by default if running on +diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c +index e8b5f1cf1ae8c..4ccb9039f5950 100644 +--- a/arch/x86/kernel/cpu/resctrl/core.c ++++ b/arch/x86/kernel/cpu/resctrl/core.c +@@ -590,6 +590,8 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r) + } + + if (r->mon_capable && domain_setup_mon_state(r, d)) { ++ kfree(d->ctrl_val); ++ kfree(d->mbps_val); + kfree(d); + return; + } +diff --git a/drivers/acpi/arm64/gtdt.c b/drivers/acpi/arm64/gtdt.c +index 0a0a982f9c28d..c0e77c1c8e09d 100644 +--- a/drivers/acpi/arm64/gtdt.c ++++ b/drivers/acpi/arm64/gtdt.c +@@ -36,7 +36,7 @@ struct acpi_gtdt_descriptor { + + static struct acpi_gtdt_descriptor acpi_gtdt_desc __initdata; + +-static inline void *next_platform_timer(void *platform_timer) ++static inline __init void *next_platform_timer(void *platform_timer) + { + struct acpi_gtdt_header *gh = platform_timer; + +diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c +index b2f5520882918..0910441321f72 100644 +--- a/drivers/ata/libahci_platform.c ++++ b/drivers/ata/libahci_platform.c +@@ -440,10 +440,7 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, + hpriv->phy_regulator = devm_regulator_get(dev, "phy"); + if (IS_ERR(hpriv->phy_regulator)) { + rc = PTR_ERR(hpriv->phy_regulator); +- if (rc == -EPROBE_DEFER) +- goto err_out; +- rc = 0; +- hpriv->phy_regulator = NULL; ++ goto err_out; + } + + if (flags & AHCI_PLATFORM_GET_RESETS) { +diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c +index 4fd12b20df239..d91ba47f2fc44 100644 +--- a/drivers/ata/pata_legacy.c ++++ b/drivers/ata/pata_legacy.c +@@ -315,7 +315,8 @@ static unsigned int pdc_data_xfer_vlb(struct ata_queued_cmd *qc, + iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); + + if (unlikely(slop)) { +- __le32 pad; ++ __le32 pad = 0; ++ + if (rw == READ) { + pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr)); + memcpy(buf + buflen - slop, &pad, slop); +@@ -705,7 +706,8 @@ static unsigned int vlb32_data_xfer(struct ata_queued_cmd *qc, + ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); + + if (unlikely(slop)) { +- __le32 pad; ++ __le32 pad = 0; ++ + if (rw == WRITE) { + memcpy(&pad, buf + buflen - slop, slop); + iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr); +diff --git a/drivers/base/core.c b/drivers/base/core.c +index a364fe565007c..2bc4db5ffe445 100644 +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -549,7 +549,8 @@ struct device_link *device_link_add(struct device *consumer, + { + struct device_link *link; + +- if (!consumer || !supplier || flags & ~DL_ADD_VALID_FLAGS || ++ if (!consumer || !supplier || consumer == supplier || ++ flags & ~DL_ADD_VALID_FLAGS || + (flags & DL_FLAG_STATELESS && flags & DL_MANAGED_LINK_FLAGS) || + (flags & DL_FLAG_SYNC_STATE_ONLY && + flags != DL_FLAG_SYNC_STATE_ONLY) || +diff --git a/drivers/bus/simple-pm-bus.c b/drivers/bus/simple-pm-bus.c +index c5eb46cbf388b..244b8f3b38b40 100644 +--- a/drivers/bus/simple-pm-bus.c ++++ b/drivers/bus/simple-pm-bus.c +@@ -16,7 +16,33 @@ + + static int simple_pm_bus_probe(struct platform_device *pdev) + { +- struct device_node *np = pdev->dev.of_node; ++ const struct device *dev = &pdev->dev; ++ struct device_node *np = dev->of_node; ++ const struct of_device_id *match; ++ ++ /* ++ * Allow user to use driver_override to bind this driver to a ++ * transparent bus device which has a different compatible string ++ * that's not listed in simple_pm_bus_of_match. We don't want to do any ++ * of the simple-pm-bus tasks for these devices, so return early. ++ */ ++ if (pdev->driver_override) ++ return 0; ++ ++ match = of_match_device(dev->driver->of_match_table, dev); ++ /* ++ * These are transparent bus devices (not simple-pm-bus matches) that ++ * have their child nodes populated automatically. So, don't need to ++ * do anything more. We only match with the device if this driver is ++ * the most specific match because we don't want to incorrectly bind to ++ * a device that has a more specific driver. ++ */ ++ if (match && match->data) { ++ if (of_property_match_string(np, "compatible", match->compatible) == 0) ++ return 0; ++ else ++ return -ENODEV; ++ } + + dev_dbg(&pdev->dev, "%s\n", __func__); + +@@ -30,14 +56,25 @@ static int simple_pm_bus_probe(struct platform_device *pdev) + + static int simple_pm_bus_remove(struct platform_device *pdev) + { ++ const void *data = of_device_get_match_data(&pdev->dev); ++ ++ if (pdev->driver_override || data) ++ return 0; ++ + dev_dbg(&pdev->dev, "%s\n", __func__); + + pm_runtime_disable(&pdev->dev); + return 0; + } + ++#define ONLY_BUS ((void *) 1) /* Match if the device is only a bus. */ ++ + static const struct of_device_id simple_pm_bus_of_match[] = { + { .compatible = "simple-pm-bus", }, ++ { .compatible = "simple-bus", .data = ONLY_BUS }, ++ { .compatible = "simple-mfd", .data = ONLY_BUS }, ++ { .compatible = "isa", .data = ONLY_BUS }, ++ { .compatible = "arm,amba-bus", .data = ONLY_BUS }, + { /* sentinel */ } + }; + MODULE_DEVICE_TABLE(of, simple_pm_bus_of_match); +diff --git a/drivers/clk/socfpga/clk-agilex.c b/drivers/clk/socfpga/clk-agilex.c +index 7182afb4258a7..225636c2b5696 100644 +--- a/drivers/clk/socfpga/clk-agilex.c ++++ b/drivers/clk/socfpga/clk-agilex.c +@@ -165,13 +165,6 @@ static const struct clk_parent_data mpu_mux[] = { + .name = "boot_clk", }, + }; + +-static const struct clk_parent_data s2f_usr0_mux[] = { +- { .fw_name = "f2s-free-clk", +- .name = "f2s-free-clk", }, +- { .fw_name = "boot_clk", +- .name = "boot_clk", }, +-}; +- + static const struct clk_parent_data emac_mux[] = { + { .fw_name = "emaca_free_clk", + .name = "emaca_free_clk", }, +@@ -299,8 +292,6 @@ static const struct stratix10_gate_clock agilex_gate_clks[] = { + 4, 0x44, 28, 1, 0, 0, 0}, + { AGILEX_CS_TIMER_CLK, "cs_timer_clk", NULL, noc_mux, ARRAY_SIZE(noc_mux), 0, 0x24, + 5, 0, 0, 0, 0x30, 1, 0}, +- { AGILEX_S2F_USER0_CLK, "s2f_user0_clk", NULL, s2f_usr0_mux, ARRAY_SIZE(s2f_usr0_mux), 0, 0x24, +- 6, 0, 0, 0, 0, 0, 0}, + { AGILEX_EMAC0_CLK, "emac0_clk", NULL, emac_mux, ARRAY_SIZE(emac_mux), 0, 0x7C, + 0, 0, 0, 0, 0x94, 26, 0}, + { AGILEX_EMAC1_CLK, "emac1_clk", NULL, emac_mux, ARRAY_SIZE(emac_mux), 0, 0x7C, +diff --git a/drivers/edac/armada_xp_edac.c b/drivers/edac/armada_xp_edac.c +index e3e757513d1bc..b1f46a974b9e0 100644 +--- a/drivers/edac/armada_xp_edac.c ++++ b/drivers/edac/armada_xp_edac.c +@@ -178,7 +178,7 @@ static void axp_mc_check(struct mem_ctl_info *mci) + "details unavailable (multiple errors)"); + if (cnt_dbe) + edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, +- cnt_sbe, /* error count */ ++ cnt_dbe, /* error count */ + 0, 0, 0, /* pfn, offset, syndrome */ + -1, -1, -1, /* top, mid, low layer */ + mci->ctl_name, +diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c +index ea7ca74fc1730..232c092c4c970 100644 +--- a/drivers/firmware/efi/cper.c ++++ b/drivers/firmware/efi/cper.c +@@ -25,8 +25,6 @@ + #include + #include + +-static char rcd_decode_str[CPER_REC_LEN]; +- + /* + * CPER record ID need to be unique even after reboot, because record + * ID is used as index for ERST storage, while CPER records from +@@ -313,6 +311,7 @@ const char *cper_mem_err_unpack(struct trace_seq *p, + struct cper_mem_err_compact *cmem) + { + const char *ret = trace_seq_buffer_ptr(p); ++ char rcd_decode_str[CPER_REC_LEN]; + + if (cper_mem_err_location(cmem, rcd_decode_str)) + trace_seq_printf(p, "%s", rcd_decode_str); +@@ -327,6 +326,7 @@ static void cper_print_mem(const char *pfx, const struct cper_sec_mem_err *mem, + int len) + { + struct cper_mem_err_compact cmem; ++ char rcd_decode_str[CPER_REC_LEN]; + + /* Don't trust UEFI 2.1/2.2 structure with bad validation bits */ + if (len == sizeof(struct cper_sec_mem_err_old) && +diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c +index 1410beaef5c30..f3e54f6616f02 100644 +--- a/drivers/firmware/efi/runtime-wrappers.c ++++ b/drivers/firmware/efi/runtime-wrappers.c +@@ -414,7 +414,7 @@ static void virt_efi_reset_system(int reset_type, + unsigned long data_size, + efi_char16_t *data) + { +- if (down_interruptible(&efi_runtime_lock)) { ++ if (down_trylock(&efi_runtime_lock)) { + pr_warn("failed to invoke the reset_system() runtime service:\n" + "could not get exclusive access to the firmware\n"); + return; +diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c +index 3a3aeef1017f5..a78167b2c9ca2 100644 +--- a/drivers/gpio/gpio-pca953x.c ++++ b/drivers/gpio/gpio-pca953x.c +@@ -558,21 +558,21 @@ static int pca953x_gpio_set_pull_up_down(struct pca953x_chip *chip, + + mutex_lock(&chip->i2c_lock); + +- /* Disable pull-up/pull-down */ +- ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, 0); +- if (ret) +- goto exit; +- + /* Configure pull-up/pull-down */ + if (config == PIN_CONFIG_BIAS_PULL_UP) + ret = regmap_write_bits(chip->regmap, pull_sel_reg, bit, bit); + else if (config == PIN_CONFIG_BIAS_PULL_DOWN) + ret = regmap_write_bits(chip->regmap, pull_sel_reg, bit, 0); ++ else ++ ret = 0; + if (ret) + goto exit; + +- /* Enable pull-up/pull-down */ +- ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, bit); ++ /* Disable/Enable pull-up/pull-down */ ++ if (config == PIN_CONFIG_BIAS_DISABLE) ++ ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, 0); ++ else ++ ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, bit); + + exit: + mutex_unlock(&chip->i2c_lock); +@@ -586,7 +586,9 @@ static int pca953x_gpio_set_config(struct gpio_chip *gc, unsigned int offset, + + switch (pinconf_to_config_param(config)) { + case PIN_CONFIG_BIAS_PULL_UP: ++ case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT: + case PIN_CONFIG_BIAS_PULL_DOWN: ++ case PIN_CONFIG_BIAS_DISABLE: + return pca953x_gpio_set_pull_up_down(chip, offset, config); + default: + return -ENOTSUPP; +diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c +index b7ddf504e0249..add317bd8d55c 100644 +--- a/drivers/gpu/drm/drm_edid.c ++++ b/drivers/gpu/drm/drm_edid.c +@@ -1835,11 +1835,20 @@ static void connector_bad_edid(struct drm_connector *connector, + u8 *edid, int num_blocks) + { + int i; +- u8 num_of_ext = edid[0x7e]; ++ u8 last_block; ++ ++ /* ++ * 0x7e in the EDID is the number of extension blocks. The EDID ++ * is 1 (base block) + num_ext_blocks big. That means we can think ++ * of 0x7e in the EDID of the _index_ of the last block in the ++ * combined chunk of memory. ++ */ ++ last_block = edid[0x7e]; + + /* Calculate real checksum for the last edid extension block data */ +- connector->real_edid_checksum = +- drm_edid_block_checksum(edid + num_of_ext * EDID_LENGTH); ++ if (last_block < num_blocks) ++ connector->real_edid_checksum = ++ drm_edid_block_checksum(edid + last_block * EDID_LENGTH); + + if (connector->bad_edid_counter++ && !drm_debug_enabled(DRM_UT_KMS)) + return; +diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +index 2dcbe02846cd9..9e09805575db4 100644 +--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c ++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +@@ -99,7 +99,7 @@ static void a6xx_set_pagetable(struct a6xx_gpu *a6xx_gpu, + u32 asid; + u64 memptr = rbmemptr(ring, ttbr0); + +- if (ctx == a6xx_gpu->cur_ctx) ++ if (ctx->seqno == a6xx_gpu->cur_ctx_seqno) + return; + + if (msm_iommu_pagetable_params(ctx->aspace->mmu, &ttbr, &asid)) +@@ -132,7 +132,7 @@ static void a6xx_set_pagetable(struct a6xx_gpu *a6xx_gpu, + OUT_PKT7(ring, CP_EVENT_WRITE, 1); + OUT_RING(ring, 0x31); + +- a6xx_gpu->cur_ctx = ctx; ++ a6xx_gpu->cur_ctx_seqno = ctx->seqno; + } + + static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) +@@ -887,7 +887,7 @@ static int a6xx_hw_init(struct msm_gpu *gpu) + /* Always come up on rb 0 */ + a6xx_gpu->cur_ring = gpu->rb[0]; + +- a6xx_gpu->cur_ctx = NULL; ++ a6xx_gpu->cur_ctx_seqno = 0; + + /* Enable the SQE_to start the CP engine */ + gpu_write(gpu, REG_A6XX_CP_SQE_CNTL, 1); +diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h +index 69765a722cae6..f923edbd5daaf 100644 +--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h ++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h +@@ -19,7 +19,16 @@ struct a6xx_gpu { + uint64_t sqe_iova; + + struct msm_ringbuffer *cur_ring; +- struct msm_file_private *cur_ctx; ++ ++ /** ++ * cur_ctx_seqno: ++ * ++ * The ctx->seqno value of the context with current pgtables ++ * installed. Tracked by seqno rather than pointer value to ++ * avoid dangling pointers, and cases where a ctx can be freed ++ * and a new one created with the same address. ++ */ ++ int cur_ctx_seqno; + + struct a6xx_gmu gmu; + +diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +index 7d7668998501a..a8fa084dfa494 100644 +--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c ++++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +@@ -1119,6 +1119,20 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc) + __drm_atomic_helper_crtc_reset(crtc, &mdp5_cstate->base); + } + ++static const struct drm_crtc_funcs mdp5_crtc_no_lm_cursor_funcs = { ++ .set_config = drm_atomic_helper_set_config, ++ .destroy = mdp5_crtc_destroy, ++ .page_flip = drm_atomic_helper_page_flip, ++ .reset = mdp5_crtc_reset, ++ .atomic_duplicate_state = mdp5_crtc_duplicate_state, ++ .atomic_destroy_state = mdp5_crtc_destroy_state, ++ .atomic_print_state = mdp5_crtc_atomic_print_state, ++ .get_vblank_counter = mdp5_crtc_get_vblank_counter, ++ .enable_vblank = msm_crtc_enable_vblank, ++ .disable_vblank = msm_crtc_disable_vblank, ++ .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, ++}; ++ + static const struct drm_crtc_funcs mdp5_crtc_funcs = { + .set_config = drm_atomic_helper_set_config, + .destroy = mdp5_crtc_destroy, +@@ -1307,6 +1321,8 @@ struct drm_crtc *mdp5_crtc_init(struct drm_device *dev, + mdp5_crtc->lm_cursor_enabled = cursor_plane ? false : true; + + drm_crtc_init_with_planes(dev, crtc, plane, cursor_plane, ++ cursor_plane ? ++ &mdp5_crtc_no_lm_cursor_funcs : + &mdp5_crtc_funcs, NULL); + + drm_flip_work_init(&mdp5_crtc->unref_cursor_work, +diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c +index 7e364b9c9f9e1..1adead764feed 100644 +--- a/drivers/gpu/drm/msm/dsi/dsi.c ++++ b/drivers/gpu/drm/msm/dsi/dsi.c +@@ -208,8 +208,10 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, + goto fail; + } + +- if (!msm_dsi_manager_validate_current_config(msm_dsi->id)) ++ if (!msm_dsi_manager_validate_current_config(msm_dsi->id)) { ++ ret = -EINVAL; + goto fail; ++ } + + msm_dsi->encoder = encoder; + +diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c +index b17ac6c275549..96b5dcf8e4540 100644 +--- a/drivers/gpu/drm/msm/dsi/dsi_host.c ++++ b/drivers/gpu/drm/msm/dsi/dsi_host.c +@@ -464,7 +464,7 @@ static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host) + + return 0; + err: +- for (; i > 0; i--) ++ while (--i >= 0) + clk_disable_unprepare(msm_host->bus_clks[i]); + + return ret; +diff --git a/drivers/gpu/drm/msm/edp/edp_ctrl.c b/drivers/gpu/drm/msm/edp/edp_ctrl.c +index 0d9657cc70dbb..937b4abb15526 100644 +--- a/drivers/gpu/drm/msm/edp/edp_ctrl.c ++++ b/drivers/gpu/drm/msm/edp/edp_ctrl.c +@@ -1116,7 +1116,7 @@ void msm_edp_ctrl_power(struct edp_ctrl *ctrl, bool on) + int msm_edp_ctrl_init(struct msm_edp *edp) + { + struct edp_ctrl *ctrl = NULL; +- struct device *dev = &edp->pdev->dev; ++ struct device *dev; + int ret; + + if (!edp) { +@@ -1124,6 +1124,7 @@ int msm_edp_ctrl_init(struct msm_edp *edp) + return -EINVAL; + } + ++ dev = &edp->pdev->dev; + ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + if (!ctrl) + return -ENOMEM; +diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c +index edee4c2a76ce4..33e42b2f9cfcb 100644 +--- a/drivers/gpu/drm/msm/msm_drv.c ++++ b/drivers/gpu/drm/msm/msm_drv.c +@@ -581,6 +581,7 @@ static void load_gpu(struct drm_device *dev) + + static int context_init(struct drm_device *dev, struct drm_file *file) + { ++ static atomic_t ident = ATOMIC_INIT(0); + struct msm_drm_private *priv = dev->dev_private; + struct msm_file_private *ctx; + +@@ -594,6 +595,8 @@ static int context_init(struct drm_device *dev, struct drm_file *file) + ctx->aspace = msm_gpu_create_private_address_space(priv->gpu, current); + file->driver_priv = ctx; + ++ ctx->seqno = atomic_inc_return(&ident); ++ + return 0; + } + +diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h +index 0b2686b060c73..1fe809add8f62 100644 +--- a/drivers/gpu/drm/msm/msm_drv.h ++++ b/drivers/gpu/drm/msm/msm_drv.h +@@ -58,6 +58,7 @@ struct msm_file_private { + int queueid; + struct msm_gem_address_space *aspace; + struct kref ref; ++ int seqno; + }; + + enum msm_mdp_plane_property { +@@ -543,7 +544,7 @@ static inline int align_pitch(int width, int bpp) + static inline unsigned long timeout_to_jiffies(const ktime_t *timeout) + { + ktime_t now = ktime_get(); +- unsigned long remaining_jiffies; ++ s64 remaining_jiffies; + + if (ktime_compare(*timeout, now) < 0) { + remaining_jiffies = 0; +@@ -552,7 +553,7 @@ static inline unsigned long timeout_to_jiffies(const ktime_t *timeout) + remaining_jiffies = ktime_divns(rem, NSEC_PER_SEC / HZ); + } + +- return remaining_jiffies; ++ return clamp(remaining_jiffies, 0LL, (s64)INT_MAX); + } + + #endif /* __MSM_DRV_H__ */ +diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig +index b9dbedf8f15e8..6153972e0127a 100644 +--- a/drivers/gpu/drm/panel/Kconfig ++++ b/drivers/gpu/drm/panel/Kconfig +@@ -233,6 +233,7 @@ config DRM_PANEL_OLIMEX_LCD_OLINUXINO + depends on OF + depends on I2C + depends on BACKLIGHT_CLASS_DEVICE ++ select CRC32 + help + The panel is used with different sizes LCDs, from 480x272 to + 1280x800, and 24 bit per pixel. +diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c +index 1141cc13a1249..1b8baba9d4d64 100644 +--- a/drivers/iio/adc/ad7192.c ++++ b/drivers/iio/adc/ad7192.c +@@ -293,6 +293,7 @@ static const struct ad_sigma_delta_info ad7192_sigma_delta_info = { + .has_registers = true, + .addr_shift = 3, + .read_mask = BIT(6), ++ .irq_flags = IRQF_TRIGGER_FALLING, + }; + + static const struct ad_sd_calib_data ad7192_calib_arr[8] = { +diff --git a/drivers/iio/adc/ad7780.c b/drivers/iio/adc/ad7780.c +index 42e7e8e595d18..c70048bc791bd 100644 +--- a/drivers/iio/adc/ad7780.c ++++ b/drivers/iio/adc/ad7780.c +@@ -203,7 +203,7 @@ static const struct ad_sigma_delta_info ad7780_sigma_delta_info = { + .set_mode = ad7780_set_mode, + .postprocess_sample = ad7780_postprocess_sample, + .has_registers = false, +- .irq_flags = IRQF_TRIGGER_LOW, ++ .irq_flags = IRQF_TRIGGER_FALLING, + }; + + #define _AD7780_CHANNEL(_bits, _wordsize, _mask_all) \ +diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c +index 440ef4c7be074..7c9c95c252cf8 100644 +--- a/drivers/iio/adc/ad7793.c ++++ b/drivers/iio/adc/ad7793.c +@@ -206,7 +206,7 @@ static const struct ad_sigma_delta_info ad7793_sigma_delta_info = { + .has_registers = true, + .addr_shift = 3, + .read_mask = BIT(6), +- .irq_flags = IRQF_TRIGGER_LOW, ++ .irq_flags = IRQF_TRIGGER_FALLING, + }; + + static const struct ad_sd_calib_data ad7793_calib_arr[6] = { +diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c +index 19efaa41bc344..34ec0c28b2dff 100644 +--- a/drivers/iio/adc/aspeed_adc.c ++++ b/drivers/iio/adc/aspeed_adc.c +@@ -183,6 +183,7 @@ static int aspeed_adc_probe(struct platform_device *pdev) + + data = iio_priv(indio_dev); + data->dev = &pdev->dev; ++ platform_set_drvdata(pdev, indio_dev); + + data->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(data->base)) +diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c +index ca1dff3924ff9..a08efaaf1a814 100644 +--- a/drivers/iio/adc/max1027.c ++++ b/drivers/iio/adc/max1027.c +@@ -103,7 +103,7 @@ MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids); + .sign = 'u', \ + .realbits = depth, \ + .storagebits = 16, \ +- .shift = 2, \ ++ .shift = (depth == 10) ? 2 : 0, \ + .endianness = IIO_BE, \ + }, \ + } +@@ -142,7 +142,6 @@ MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids); + MAX1027_V_CHAN(11, depth) + + #define MAX1X31_CHANNELS(depth) \ +- MAX1X27_CHANNELS(depth), \ + MAX1X29_CHANNELS(depth), \ + MAX1027_V_CHAN(12, depth), \ + MAX1027_V_CHAN(13, depth), \ +diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c +index 79c1dd68b9092..d4fccd52ef08b 100644 +--- a/drivers/iio/adc/mt6577_auxadc.c ++++ b/drivers/iio/adc/mt6577_auxadc.c +@@ -82,6 +82,10 @@ static const struct iio_chan_spec mt6577_auxadc_iio_channels[] = { + MT6577_AUXADC_CHANNEL(15), + }; + ++/* For Voltage calculation */ ++#define VOLTAGE_FULL_RANGE 1500 /* VA voltage */ ++#define AUXADC_PRECISE 4096 /* 12 bits */ ++ + static int mt_auxadc_get_cali_data(int rawdata, bool enable_cali) + { + return rawdata; +@@ -191,6 +195,10 @@ static int mt6577_auxadc_read_raw(struct iio_dev *indio_dev, + } + if (adc_dev->dev_comp->sample_data_cali) + *val = mt_auxadc_get_cali_data(*val, true); ++ ++ /* Convert adc raw data to voltage: 0 - 1500 mV */ ++ *val = *val * VOLTAGE_FULL_RANGE / AUXADC_PRECISE; ++ + return IIO_VAL_INT; + + default: +diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c +index 3143f35a6509a..83c1ae07b3e9a 100644 +--- a/drivers/iio/adc/ti-adc128s052.c ++++ b/drivers/iio/adc/ti-adc128s052.c +@@ -171,7 +171,13 @@ static int adc128_probe(struct spi_device *spi) + mutex_init(&adc->lock); + + ret = iio_device_register(indio_dev); ++ if (ret) ++ goto err_disable_regulator; + ++ return 0; ++ ++err_disable_regulator: ++ regulator_disable(adc->reg); + return ret; + } + +diff --git a/drivers/iio/common/ssp_sensors/ssp_spi.c b/drivers/iio/common/ssp_sensors/ssp_spi.c +index 4864c38b8d1c2..769bd9280524a 100644 +--- a/drivers/iio/common/ssp_sensors/ssp_spi.c ++++ b/drivers/iio/common/ssp_sensors/ssp_spi.c +@@ -137,7 +137,7 @@ static int ssp_print_mcu_debug(char *data_frame, int *data_index, + if (length > received_len - *data_index || length <= 0) { + ssp_dbg("[SSP]: MSG From MCU-invalid debug length(%d/%d)\n", + length, received_len); +- return length ? length : -EPROTO; ++ return -EPROTO; + } + + ssp_dbg("[SSP]: MSG From MCU - %s\n", &data_frame[*data_index]); +@@ -273,6 +273,8 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len) + for (idx = 0; idx < len;) { + switch (dataframe[idx++]) { + case SSP_MSG2AP_INST_BYPASS_DATA: ++ if (idx >= len) ++ return -EPROTO; + sd = dataframe[idx++]; + if (sd < 0 || sd >= SSP_SENSOR_MAX) { + dev_err(SSP_DEV, +@@ -282,10 +284,13 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len) + + if (indio_devs[sd]) { + spd = iio_priv(indio_devs[sd]); +- if (spd->process_data) ++ if (spd->process_data) { ++ if (idx >= len) ++ return -EPROTO; + spd->process_data(indio_devs[sd], + &dataframe[idx], + data->timestamp); ++ } + } else { + dev_err(SSP_DEV, "no client for frame\n"); + } +@@ -293,6 +298,8 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len) + idx += ssp_offset_map[sd]; + break; + case SSP_MSG2AP_INST_DEBUG_DATA: ++ if (idx >= len) ++ return -EPROTO; + sd = ssp_print_mcu_debug(dataframe, &idx, len); + if (sd) { + dev_err(SSP_DEV, +diff --git a/drivers/iio/dac/ti-dac5571.c b/drivers/iio/dac/ti-dac5571.c +index d3295767a079c..c0714cb1e164a 100644 +--- a/drivers/iio/dac/ti-dac5571.c ++++ b/drivers/iio/dac/ti-dac5571.c +@@ -350,6 +350,7 @@ static int dac5571_probe(struct i2c_client *client, + data->dac5571_pwrdwn = dac5571_pwrdwn_quad; + break; + default: ++ ret = -EINVAL; + goto err; + } + +diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c +index 2d48d61909a4d..ff776259734ad 100644 +--- a/drivers/iio/light/opt3001.c ++++ b/drivers/iio/light/opt3001.c +@@ -276,6 +276,8 @@ static int opt3001_get_lux(struct opt3001 *opt, int *val, int *val2) + ret = wait_event_timeout(opt->result_ready_queue, + opt->result_ready, + msecs_to_jiffies(OPT3001_RESULT_READY_LONG)); ++ if (ret == 0) ++ return -ETIMEDOUT; + } else { + /* Sleep for result ready time */ + timeout = (opt->int_time == OPT3001_INT_TIME_SHORT) ? +@@ -312,9 +314,7 @@ err: + /* Disallow IRQ to access the device while lock is active */ + opt->ok_to_ignore_lock = false; + +- if (ret == 0) +- return -ETIMEDOUT; +- else if (ret < 0) ++ if (ret < 0) + return ret; + + if (opt->use_irq) { +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index e5f1e3cf9179f..ba101afcfc27f 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -331,6 +331,7 @@ static const struct xpad_device { + { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, + { 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, ++ { 0x3285, 0x0607, "Nacon GC-100", 0, XTYPE_XBOX360 }, + { 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX }, + { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, + { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } +@@ -447,6 +448,7 @@ static const struct usb_device_id xpad_table[] = { + XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ + XPAD_XBOXONE_VENDOR(0x2e24), /* Hyperkin Duke X-Box One pad */ + XPAD_XBOX360_VENDOR(0x2f24), /* GameSir Controllers */ ++ XPAD_XBOX360_VENDOR(0x3285), /* Nacon GC-100 */ + { } + }; + +diff --git a/drivers/misc/cb710/sgbuf2.c b/drivers/misc/cb710/sgbuf2.c +index e5a4ed3701eb8..a798fad5f03c2 100644 +--- a/drivers/misc/cb710/sgbuf2.c ++++ b/drivers/misc/cb710/sgbuf2.c +@@ -47,7 +47,7 @@ static inline bool needs_unaligned_copy(const void *ptr) + #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS + return false; + #else +- return ((ptr - NULL) & 3) != 0; ++ return ((uintptr_t)ptr & 3) != 0; + #endif + } + +diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c +index 273d9c1591793..a9c9d86eef4bc 100644 +--- a/drivers/misc/fastrpc.c ++++ b/drivers/misc/fastrpc.c +@@ -812,10 +812,12 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx) + rpra[i].pv = (u64) ctx->args[i].ptr; + pages[i].addr = ctx->maps[i]->phys; + ++ mmap_read_lock(current->mm); + vma = find_vma(current->mm, ctx->args[i].ptr); + if (vma) + pages[i].addr += ctx->args[i].ptr - + vma->vm_start; ++ mmap_read_unlock(current->mm); + + pg_start = (ctx->args[i].ptr & PAGE_MASK) >> PAGE_SHIFT; + pg_end = ((ctx->args[i].ptr + len - 1) & PAGE_MASK) >> +diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h +index cb34925e10f15..67bb6a25fd0a0 100644 +--- a/drivers/misc/mei/hw-me-regs.h ++++ b/drivers/misc/mei/hw-me-regs.h +@@ -92,6 +92,7 @@ + #define MEI_DEV_ID_CDF 0x18D3 /* Cedar Fork */ + + #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */ ++#define MEI_DEV_ID_ICP_N 0x38E0 /* Ice Lake Point N */ + + #define MEI_DEV_ID_JSP_N 0x4DE0 /* Jasper Lake Point N */ + +diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c +index c3393b383e598..3a45aaf002ac8 100644 +--- a/drivers/misc/mei/pci-me.c ++++ b/drivers/misc/mei/pci-me.c +@@ -96,6 +96,7 @@ static const struct pci_device_id mei_me_pci_tbl[] = { + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_H_3, MEI_ME_PCH8_ITOUCH_CFG)}, + + {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)}, ++ {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_N, MEI_ME_PCH12_CFG)}, + + {MEI_PCI_DEVICE(MEI_DEV_ID_TGP_LP, MEI_ME_PCH15_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_TGP_H, MEI_ME_PCH15_SPS_CFG)}, +diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c +index 88fa0779e0bc9..e3c338624b95c 100644 +--- a/drivers/net/dsa/microchip/ksz_common.c ++++ b/drivers/net/dsa/microchip/ksz_common.c +@@ -460,8 +460,10 @@ EXPORT_SYMBOL(ksz_switch_register); + void ksz_switch_remove(struct ksz_device *dev) + { + /* timer started */ +- if (dev->mib_read_interval) ++ if (dev->mib_read_interval) { ++ dev->mib_read_interval = 0; + cancel_delayed_work_sync(&dev->mib_read); ++ } + + dev->dev_ops->exit(dev); + dsa_unregister_switch(dev->ds); +diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c +index 18388ea5ebd96..afc5500ef8ed9 100644 +--- a/drivers/net/dsa/mv88e6xxx/chip.c ++++ b/drivers/net/dsa/mv88e6xxx/chip.c +@@ -726,7 +726,11 @@ static void mv88e6xxx_mac_link_down(struct dsa_switch *ds, int port, + ops = chip->info->ops; + + mv88e6xxx_reg_lock(chip); +- if ((!mv88e6xxx_port_ppu_updates(chip, port) || ++ /* Internal PHYs propagate their configuration directly to the MAC. ++ * External PHYs depend on whether the PPU is enabled for this port. ++ */ ++ if (((!mv88e6xxx_phy_is_internal(ds, port) && ++ !mv88e6xxx_port_ppu_updates(chip, port)) || + mode == MLO_AN_FIXED) && ops->port_set_link) + err = ops->port_set_link(chip, port, LINK_FORCED_DOWN); + mv88e6xxx_reg_unlock(chip); +@@ -749,7 +753,12 @@ static void mv88e6xxx_mac_link_up(struct dsa_switch *ds, int port, + ops = chip->info->ops; + + mv88e6xxx_reg_lock(chip); +- if (!mv88e6xxx_port_ppu_updates(chip, port) || mode == MLO_AN_FIXED) { ++ /* Internal PHYs propagate their configuration directly to the MAC. ++ * External PHYs depend on whether the PPU is enabled for this port. ++ */ ++ if ((!mv88e6xxx_phy_is_internal(ds, port) && ++ !mv88e6xxx_port_ppu_updates(chip, port)) || ++ mode == MLO_AN_FIXED) { + /* FIXME: for an automedia port, should we force the link + * down here - what if the link comes up due to "other" media + * while we're bringing the port up, how is the exclusivity +diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig +index de50e8b9e6562..fad9a2c77fa7c 100644 +--- a/drivers/net/ethernet/Kconfig ++++ b/drivers/net/ethernet/Kconfig +@@ -99,6 +99,7 @@ config JME + config KORINA + tristate "Korina (IDT RC32434) Ethernet support" + depends on MIKROTIK_RB532 ++ select CRC32 + help + If you have a Mikrotik RouterBoard 500 or IDT RC32434 + based system say Y. Otherwise say N. +diff --git a/drivers/net/ethernet/arc/Kconfig b/drivers/net/ethernet/arc/Kconfig +index 37a41773dd435..92a79c4ffa2c7 100644 +--- a/drivers/net/ethernet/arc/Kconfig ++++ b/drivers/net/ethernet/arc/Kconfig +@@ -21,6 +21,7 @@ config ARC_EMAC_CORE + depends on ARC || ARCH_ROCKCHIP || COMPILE_TEST + select MII + select PHYLIB ++ select CRC32 + + config ARC_EMAC + tristate "ARC EMAC support" +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cq.c b/drivers/net/ethernet/mellanox/mlx5/core/cq.c +index 360e093874d4f..c74600be570ed 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/cq.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/cq.c +@@ -154,6 +154,8 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq) + u32 in[MLX5_ST_SZ_DW(destroy_cq_in)] = {}; + int err; + ++ mlx5_debug_cq_remove(dev, cq); ++ + mlx5_eq_del_cq(mlx5_get_async_eq(dev), cq); + mlx5_eq_del_cq(&cq->eq->core, cq); + +@@ -161,16 +163,13 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq) + MLX5_SET(destroy_cq_in, in, cqn, cq->cqn); + MLX5_SET(destroy_cq_in, in, uid, cq->uid); + err = mlx5_cmd_exec_in(dev, destroy_cq, in); +- if (err) +- return err; + + synchronize_irq(cq->irqn); + +- mlx5_debug_cq_remove(dev, cq); + mlx5_cq_put(cq); + wait_for_completion(&cq->free); + +- return 0; ++ return err; + } + EXPORT_SYMBOL(mlx5_core_destroy_cq); + +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +index 6974090a7efac..6ec4b96497ffb 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +@@ -3819,20 +3819,67 @@ static int set_feature_rx_all(struct net_device *netdev, bool enable) + return mlx5_set_port_fcs(mdev, !enable); + } + ++static int mlx5e_set_rx_port_ts(struct mlx5_core_dev *mdev, bool enable) ++{ ++ u32 in[MLX5_ST_SZ_DW(pcmr_reg)] = {}; ++ bool supported, curr_state; ++ int err; ++ ++ if (!MLX5_CAP_GEN(mdev, ports_check)) ++ return 0; ++ ++ err = mlx5_query_ports_check(mdev, in, sizeof(in)); ++ if (err) ++ return err; ++ ++ supported = MLX5_GET(pcmr_reg, in, rx_ts_over_crc_cap); ++ curr_state = MLX5_GET(pcmr_reg, in, rx_ts_over_crc); ++ ++ if (!supported || enable == curr_state) ++ return 0; ++ ++ MLX5_SET(pcmr_reg, in, local_port, 1); ++ MLX5_SET(pcmr_reg, in, rx_ts_over_crc, enable); ++ ++ return mlx5_set_ports_check(mdev, in, sizeof(in)); ++} ++ + static int set_feature_rx_fcs(struct net_device *netdev, bool enable) + { + struct mlx5e_priv *priv = netdev_priv(netdev); ++ struct mlx5e_channels *chs = &priv->channels; ++ struct mlx5_core_dev *mdev = priv->mdev; + int err; + + mutex_lock(&priv->state_lock); + +- priv->channels.params.scatter_fcs_en = enable; +- err = mlx5e_modify_channels_scatter_fcs(&priv->channels, enable); +- if (err) +- priv->channels.params.scatter_fcs_en = !enable; ++ if (enable) { ++ err = mlx5e_set_rx_port_ts(mdev, false); ++ if (err) ++ goto out; + +- mutex_unlock(&priv->state_lock); ++ chs->params.scatter_fcs_en = true; ++ err = mlx5e_modify_channels_scatter_fcs(chs, true); ++ if (err) { ++ chs->params.scatter_fcs_en = false; ++ mlx5e_set_rx_port_ts(mdev, true); ++ } ++ } else { ++ chs->params.scatter_fcs_en = false; ++ err = mlx5e_modify_channels_scatter_fcs(chs, false); ++ if (err) { ++ chs->params.scatter_fcs_en = true; ++ goto out; ++ } ++ err = mlx5e_set_rx_port_ts(mdev, true); ++ if (err) { ++ mlx5_core_warn(mdev, "Failed to set RX port timestamp %d\n", err); ++ err = 0; ++ } ++ } + ++out: ++ mutex_unlock(&priv->state_lock); + return err; + } + +diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +index 42e4437ac3c16..7ec1d0ee9beeb 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +@@ -25,16 +25,8 @@ + #define MLXSW_THERMAL_ZONE_MAX_NAME 16 + #define MLXSW_THERMAL_TEMP_SCORE_MAX GENMASK(31, 0) + #define MLXSW_THERMAL_MAX_STATE 10 ++#define MLXSW_THERMAL_MIN_STATE 2 + #define MLXSW_THERMAL_MAX_DUTY 255 +-/* Minimum and maximum fan allowed speed in percent: from 20% to 100%. Values +- * MLXSW_THERMAL_MAX_STATE + x, where x is between 2 and 10 are used for +- * setting fan speed dynamic minimum. For example, if value is set to 14 (40%) +- * cooling levels vector will be set to 4, 4, 4, 4, 4, 5, 6, 7, 8, 9, 10 to +- * introduce PWM speed in percent: 40, 40, 40, 40, 40, 50, 60. 70, 80, 90, 100. +- */ +-#define MLXSW_THERMAL_SPEED_MIN (MLXSW_THERMAL_MAX_STATE + 2) +-#define MLXSW_THERMAL_SPEED_MAX (MLXSW_THERMAL_MAX_STATE * 2) +-#define MLXSW_THERMAL_SPEED_MIN_LEVEL 2 /* 20% */ + + /* External cooling devices, allowed for binding to mlxsw thermal zones. */ + static char * const mlxsw_thermal_external_allowed_cdev[] = { +@@ -635,49 +627,16 @@ static int mlxsw_thermal_set_cur_state(struct thermal_cooling_device *cdev, + struct mlxsw_thermal *thermal = cdev->devdata; + struct device *dev = thermal->bus_info->dev; + char mfsc_pl[MLXSW_REG_MFSC_LEN]; +- unsigned long cur_state, i; + int idx; +- u8 duty; + int err; + ++ if (state > MLXSW_THERMAL_MAX_STATE) ++ return -EINVAL; ++ + idx = mlxsw_get_cooling_device_idx(thermal, cdev); + if (idx < 0) + return idx; + +- /* Verify if this request is for changing allowed fan dynamical +- * minimum. If it is - update cooling levels accordingly and update +- * state, if current state is below the newly requested minimum state. +- * For example, if current state is 5, and minimal state is to be +- * changed from 4 to 6, thermal->cooling_levels[0 to 5] will be changed +- * all from 4 to 6. And state 5 (thermal->cooling_levels[4]) should be +- * overwritten. +- */ +- if (state >= MLXSW_THERMAL_SPEED_MIN && +- state <= MLXSW_THERMAL_SPEED_MAX) { +- state -= MLXSW_THERMAL_MAX_STATE; +- for (i = 0; i <= MLXSW_THERMAL_MAX_STATE; i++) +- thermal->cooling_levels[i] = max(state, i); +- +- mlxsw_reg_mfsc_pack(mfsc_pl, idx, 0); +- err = mlxsw_reg_query(thermal->core, MLXSW_REG(mfsc), mfsc_pl); +- if (err) +- return err; +- +- duty = mlxsw_reg_mfsc_pwm_duty_cycle_get(mfsc_pl); +- cur_state = mlxsw_duty_to_state(duty); +- +- /* If current fan state is lower than requested dynamical +- * minimum, increase fan speed up to dynamical minimum. +- */ +- if (state < cur_state) +- return 0; +- +- state = cur_state; +- } +- +- if (state > MLXSW_THERMAL_MAX_STATE) +- return -EINVAL; +- + /* Normalize the state to the valid speed range. */ + state = thermal->cooling_levels[state]; + mlxsw_reg_mfsc_pack(mfsc_pl, idx, mlxsw_state_to_duty(state)); +@@ -980,8 +939,7 @@ int mlxsw_thermal_init(struct mlxsw_core *core, + + /* Initialize cooling levels per PWM state. */ + for (i = 0; i < MLXSW_THERMAL_MAX_STATE; i++) +- thermal->cooling_levels[i] = max(MLXSW_THERMAL_SPEED_MIN_LEVEL, +- i); ++ thermal->cooling_levels[i] = max(MLXSW_THERMAL_MIN_STATE, i); + + thermal->polling_delay = bus_info->low_frequency ? + MLXSW_THERMAL_SLOW_POLL_INT : +diff --git a/drivers/net/ethernet/microchip/encx24j600-regmap.c b/drivers/net/ethernet/microchip/encx24j600-regmap.c +index 796e46a539269..81a8ccca7e5e0 100644 +--- a/drivers/net/ethernet/microchip/encx24j600-regmap.c ++++ b/drivers/net/ethernet/microchip/encx24j600-regmap.c +@@ -497,13 +497,19 @@ static struct regmap_bus phymap_encx24j600 = { + .reg_read = regmap_encx24j600_phy_reg_read, + }; + +-void devm_regmap_init_encx24j600(struct device *dev, +- struct encx24j600_context *ctx) ++int devm_regmap_init_encx24j600(struct device *dev, ++ struct encx24j600_context *ctx) + { + mutex_init(&ctx->mutex); + regcfg.lock_arg = ctx; + ctx->regmap = devm_regmap_init(dev, ®map_encx24j600, ctx, ®cfg); ++ if (IS_ERR(ctx->regmap)) ++ return PTR_ERR(ctx->regmap); + ctx->phymap = devm_regmap_init(dev, &phymap_encx24j600, ctx, &phycfg); ++ if (IS_ERR(ctx->phymap)) ++ return PTR_ERR(ctx->phymap); ++ ++ return 0; + } + EXPORT_SYMBOL_GPL(devm_regmap_init_encx24j600); + +diff --git a/drivers/net/ethernet/microchip/encx24j600.c b/drivers/net/ethernet/microchip/encx24j600.c +index 2c0dcd7acf3fd..c95e29ae6f20c 100644 +--- a/drivers/net/ethernet/microchip/encx24j600.c ++++ b/drivers/net/ethernet/microchip/encx24j600.c +@@ -1024,10 +1024,13 @@ static int encx24j600_spi_probe(struct spi_device *spi) + priv->speed = SPEED_100; + + priv->ctx.spi = spi; +- devm_regmap_init_encx24j600(&spi->dev, &priv->ctx); + ndev->irq = spi->irq; + ndev->netdev_ops = &encx24j600_netdev_ops; + ++ ret = devm_regmap_init_encx24j600(&spi->dev, &priv->ctx); ++ if (ret) ++ goto out_free; ++ + mutex_init(&priv->lock); + + /* Reset device and check if it is connected */ +diff --git a/drivers/net/ethernet/microchip/encx24j600_hw.h b/drivers/net/ethernet/microchip/encx24j600_hw.h +index f604a260ede79..711147a159aa9 100644 +--- a/drivers/net/ethernet/microchip/encx24j600_hw.h ++++ b/drivers/net/ethernet/microchip/encx24j600_hw.h +@@ -15,8 +15,8 @@ struct encx24j600_context { + int bank; + }; + +-void devm_regmap_init_encx24j600(struct device *dev, +- struct encx24j600_context *ctx); ++int devm_regmap_init_encx24j600(struct device *dev, ++ struct encx24j600_context *ctx); + + /* Single-byte instructions */ + #define BANK_SELECT(bank) (0xC0 | ((bank & (BANK_MASK >> BANK_SHIFT)) << 1)) +diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c +index 5bfc7acfd13a9..8c45b236649a9 100644 +--- a/drivers/net/ethernet/mscc/ocelot.c ++++ b/drivers/net/ethernet/mscc/ocelot.c +@@ -594,12 +594,12 @@ void ocelot_get_txtstamp(struct ocelot *ocelot) + + spin_unlock_irqrestore(&port->tx_skbs.lock, flags); + ++ if (WARN_ON(!skb_match)) ++ continue; ++ + /* Get the h/w timestamp */ + ocelot_get_hwtimestamp(ocelot, &ts); + +- if (unlikely(!skb_match)) +- continue; +- + /* Set the timestamp into the skb */ + memset(&shhwtstamps, 0, sizeof(shhwtstamps)); + shhwtstamps.hwtstamp = ktime_set(ts.tv_sec, ts.tv_nsec); +diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c +index d13d92bf74478..3cae8449fadb7 100644 +--- a/drivers/net/ethernet/neterion/s2io.c ++++ b/drivers/net/ethernet/neterion/s2io.c +@@ -8555,7 +8555,7 @@ static void s2io_io_resume(struct pci_dev *pdev) + return; + } + +- if (s2io_set_mac_addr(netdev, netdev->dev_addr) == FAILURE) { ++ if (do_s2io_prog_unicast(netdev, netdev->dev_addr) == FAILURE) { + s2io_card_down(sp); + pr_err("Can't restore mac addr after reset.\n"); + return; +diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.c b/drivers/net/ethernet/netronome/nfp/flower/main.c +index c029950a81e20..ac1dcfa1d1790 100644 +--- a/drivers/net/ethernet/netronome/nfp/flower/main.c ++++ b/drivers/net/ethernet/netronome/nfp/flower/main.c +@@ -830,10 +830,6 @@ static int nfp_flower_init(struct nfp_app *app) + if (err) + goto err_cleanup; + +- err = flow_indr_dev_register(nfp_flower_indr_setup_tc_cb, app); +- if (err) +- goto err_cleanup; +- + if (app_priv->flower_ext_feats & NFP_FL_FEATS_VF_RLIM) + nfp_flower_qos_init(app); + +@@ -942,7 +938,20 @@ static int nfp_flower_start(struct nfp_app *app) + return err; + } + +- return nfp_tunnel_config_start(app); ++ err = flow_indr_dev_register(nfp_flower_indr_setup_tc_cb, app); ++ if (err) ++ return err; ++ ++ err = nfp_tunnel_config_start(app); ++ if (err) ++ goto err_tunnel_config; ++ ++ return 0; ++ ++err_tunnel_config: ++ flow_indr_dev_unregister(nfp_flower_indr_setup_tc_cb, app, ++ nfp_flower_setup_indr_tc_release); ++ return err; + } + + static void nfp_flower_stop(struct nfp_app *app) +diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c +index 6dc7ce6494488..1b44155fa24b2 100644 +--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c ++++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c +@@ -1096,6 +1096,10 @@ static int ionic_ndo_addr_add(struct net_device *netdev, const u8 *addr) + + static int ionic_addr_del(struct net_device *netdev, const u8 *addr) + { ++ /* Don't delete our own address from the uc list */ ++ if (ether_addr_equal(addr, netdev->dev_addr)) ++ return 0; ++ + return ionic_lif_addr(netdev_priv(netdev), addr, false, true); + } + +diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c +index 6bb9ec98a12b5..41bc31e3f9356 100644 +--- a/drivers/net/ethernet/qlogic/qed/qed_main.c ++++ b/drivers/net/ethernet/qlogic/qed/qed_main.c +@@ -1295,6 +1295,7 @@ static int qed_slowpath_start(struct qed_dev *cdev, + } else { + DP_NOTICE(cdev, + "Failed to acquire PTT for aRFS\n"); ++ rc = -EINVAL; + goto err; + } + } +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c +index 2bac49b49f739..fbf2deafe8ba3 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c +@@ -218,11 +218,18 @@ static void dwmac1000_dump_dma_regs(void __iomem *ioaddr, u32 *reg_space) + readl(ioaddr + DMA_BUS_MODE + i * 4); + } + +-static void dwmac1000_get_hw_feature(void __iomem *ioaddr, +- struct dma_features *dma_cap) ++static int dwmac1000_get_hw_feature(void __iomem *ioaddr, ++ struct dma_features *dma_cap) + { + u32 hw_cap = readl(ioaddr + DMA_HW_FEATURE); + ++ if (!hw_cap) { ++ /* 0x00000000 is the value read on old hardware that does not ++ * implement this register ++ */ ++ return -EOPNOTSUPP; ++ } ++ + dma_cap->mbps_10_100 = (hw_cap & DMA_HW_FEAT_MIISEL); + dma_cap->mbps_1000 = (hw_cap & DMA_HW_FEAT_GMIISEL) >> 1; + dma_cap->half_duplex = (hw_cap & DMA_HW_FEAT_HDSEL) >> 2; +@@ -252,6 +259,8 @@ static void dwmac1000_get_hw_feature(void __iomem *ioaddr, + dma_cap->number_tx_channel = (hw_cap & DMA_HW_FEAT_TXCHCNT) >> 22; + /* Alternate (enhanced) DESC mode */ + dma_cap->enh_desc = (hw_cap & DMA_HW_FEAT_ENHDESSEL) >> 24; ++ ++ return 0; + } + + static void dwmac1000_rx_watchdog(void __iomem *ioaddr, u32 riwt, +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +index a7249e4071f16..935510cdc3ffd 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +@@ -337,8 +337,8 @@ static void dwmac4_dma_tx_chan_op_mode(void __iomem *ioaddr, int mode, + writel(mtl_tx_op, ioaddr + MTL_CHAN_TX_OP_MODE(channel)); + } + +-static void dwmac4_get_hw_feature(void __iomem *ioaddr, +- struct dma_features *dma_cap) ++static int dwmac4_get_hw_feature(void __iomem *ioaddr, ++ struct dma_features *dma_cap) + { + u32 hw_cap = readl(ioaddr + GMAC_HW_FEATURE0); + +@@ -425,6 +425,8 @@ static void dwmac4_get_hw_feature(void __iomem *ioaddr, + dma_cap->frpbs = (hw_cap & GMAC_HW_FEAT_FRPBS) >> 11; + dma_cap->frpsel = (hw_cap & GMAC_HW_FEAT_FRPSEL) >> 10; + dma_cap->dvlan = (hw_cap & GMAC_HW_FEAT_DVLAN) >> 5; ++ ++ return 0; + } + + /* Enable/disable TSO feature and set MSS */ +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +index 77308c5c5d294..a5583d706b9f2 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +@@ -365,8 +365,8 @@ static int dwxgmac2_dma_interrupt(void __iomem *ioaddr, + return ret; + } + +-static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, +- struct dma_features *dma_cap) ++static int dwxgmac2_get_hw_feature(void __iomem *ioaddr, ++ struct dma_features *dma_cap) + { + u32 hw_cap; + +@@ -439,6 +439,8 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, + dma_cap->frpes = (hw_cap & XGMAC_HWFEAT_FRPES) >> 11; + dma_cap->frpbs = (hw_cap & XGMAC_HWFEAT_FRPPB) >> 9; + dma_cap->frpsel = (hw_cap & XGMAC_HWFEAT_FRPSEL) >> 3; ++ ++ return 0; + } + + static void dwxgmac2_rx_watchdog(void __iomem *ioaddr, u32 riwt, u32 nchan) +diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h +index b0b84244ef107..8b7ec2457eba2 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h ++++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h +@@ -203,8 +203,8 @@ struct stmmac_dma_ops { + int (*dma_interrupt) (void __iomem *ioaddr, + struct stmmac_extra_stats *x, u32 chan); + /* If supported then get the optional core features */ +- void (*get_hw_feature)(void __iomem *ioaddr, +- struct dma_features *dma_cap); ++ int (*get_hw_feature)(void __iomem *ioaddr, ++ struct dma_features *dma_cap); + /* Program the HW RX Watchdog */ + void (*rx_watchdog)(void __iomem *ioaddr, u32 riwt, u32 number_chan); + void (*set_tx_ring_len)(void __iomem *ioaddr, u32 len, u32 chan); +@@ -255,7 +255,7 @@ struct stmmac_dma_ops { + #define stmmac_dma_interrupt_status(__priv, __args...) \ + stmmac_do_callback(__priv, dma, dma_interrupt, __args) + #define stmmac_get_hw_feature(__priv, __args...) \ +- stmmac_do_void_callback(__priv, dma, get_hw_feature, __args) ++ stmmac_do_callback(__priv, dma, get_hw_feature, __args) + #define stmmac_rx_watchdog(__priv, __args...) \ + stmmac_do_void_callback(__priv, dma, rx_watchdog, __args) + #define stmmac_set_tx_ring_len(__priv, __args...) \ +diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig +index b46993d5f9978..4efad42b9aa97 100644 +--- a/drivers/net/usb/Kconfig ++++ b/drivers/net/usb/Kconfig +@@ -99,6 +99,10 @@ config USB_RTL8150 + config USB_RTL8152 + tristate "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters" + select MII ++ select CRC32 ++ select CRYPTO ++ select CRYPTO_HASH ++ select CRYPTO_SHA256 + help + This option adds support for Realtek RTL8152 based USB 2.0 + 10/100 Ethernet adapters and RTL8153 based USB 3.0 10/100/1000 +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c +index d79abb88a0c62..1b85349f57af0 100644 +--- a/drivers/nvme/host/pci.c ++++ b/drivers/nvme/host/pci.c +@@ -1342,7 +1342,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved) + + memset(&cmd, 0, sizeof(cmd)); + cmd.abort.opcode = nvme_admin_abort_cmd; +- cmd.abort.cid = req->tag; ++ cmd.abort.cid = nvme_cid(req); + cmd.abort.sqid = cpu_to_le16(nvmeq->qid); + + dev_warn(nvmeq->dev->ctrl.device, +diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c +index bb8fb2b3711d4..6b170083cd248 100644 +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -1229,7 +1229,8 @@ static void nvmem_shift_read_buffer_in_place(struct nvmem_cell *cell, void *buf) + *p-- = 0; + + /* clear msb bits if any leftover in the last byte */ +- *p &= GENMASK((cell->nbits%BITS_PER_BYTE) - 1, 0); ++ if (cell->nbits % BITS_PER_BYTE) ++ *p &= GENMASK((cell->nbits % BITS_PER_BYTE) - 1, 0); + } + + static int __nvmem_cell_read(struct nvmem_device *nvmem, +diff --git a/drivers/platform/mellanox/mlxreg-io.c b/drivers/platform/mellanox/mlxreg-io.c +index 7646708d57e42..a916cd89cbbed 100644 +--- a/drivers/platform/mellanox/mlxreg-io.c ++++ b/drivers/platform/mellanox/mlxreg-io.c +@@ -98,7 +98,7 @@ mlxreg_io_get_reg(void *regmap, struct mlxreg_core_data *data, u32 in_val, + if (ret) + goto access_error; + +- *regval |= rol32(val, regsize * i); ++ *regval |= rol32(val, regsize * i * 8); + } + } + +@@ -141,7 +141,7 @@ mlxreg_io_attr_store(struct device *dev, struct device_attribute *attr, + return -EINVAL; + + /* Convert buffer to input value. */ +- ret = kstrtou32(buf, len, &input_val); ++ ret = kstrtou32(buf, 0, &input_val); + if (ret) + return ret; + +diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c +index d9cf7f7602b0b..425d2064148f9 100644 +--- a/drivers/platform/x86/intel_scu_ipc.c ++++ b/drivers/platform/x86/intel_scu_ipc.c +@@ -232,7 +232,7 @@ static inline u32 ipc_data_readl(struct intel_scu_ipc_dev *scu, u32 offset) + /* Wait till scu status is busy */ + static inline int busy_loop(struct intel_scu_ipc_dev *scu) + { +- unsigned long end = jiffies + msecs_to_jiffies(IPC_TIMEOUT); ++ unsigned long end = jiffies + IPC_TIMEOUT; + + do { + u32 status; +diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c +index c028446c74604..b4d5930be2a95 100644 +--- a/drivers/spi/spi-bcm-qspi.c ++++ b/drivers/spi/spi-bcm-qspi.c +@@ -1250,10 +1250,14 @@ static void bcm_qspi_hw_init(struct bcm_qspi *qspi) + + static void bcm_qspi_hw_uninit(struct bcm_qspi *qspi) + { ++ u32 status = bcm_qspi_read(qspi, MSPI, MSPI_MSPI_STATUS); ++ + bcm_qspi_write(qspi, MSPI, MSPI_SPCR2, 0); + if (has_bspi(qspi)) + bcm_qspi_write(qspi, MSPI, MSPI_WRITE_LOCK, 0); + ++ /* clear interrupt */ ++ bcm_qspi_write(qspi, MSPI, MSPI_MSPI_STATUS, status & ~1); + } + + static const struct spi_controller_mem_ops bcm_qspi_mem_ops = { +@@ -1397,6 +1401,47 @@ int bcm_qspi_probe(struct platform_device *pdev, + if (!qspi->dev_ids) + return -ENOMEM; + ++ /* ++ * Some SoCs integrate spi controller (e.g., its interrupt bits) ++ * in specific ways ++ */ ++ if (soc_intc) { ++ qspi->soc_intc = soc_intc; ++ soc_intc->bcm_qspi_int_set(soc_intc, MSPI_DONE, true); ++ } else { ++ qspi->soc_intc = NULL; ++ } ++ ++ if (qspi->clk) { ++ ret = clk_prepare_enable(qspi->clk); ++ if (ret) { ++ dev_err(dev, "failed to prepare clock\n"); ++ goto qspi_probe_err; ++ } ++ qspi->base_clk = clk_get_rate(qspi->clk); ++ } else { ++ qspi->base_clk = MSPI_BASE_FREQ; ++ } ++ ++ if (data->has_mspi_rev) { ++ rev = bcm_qspi_read(qspi, MSPI, MSPI_REV); ++ /* some older revs do not have a MSPI_REV register */ ++ if ((rev & 0xff) == 0xff) ++ rev = 0; ++ } ++ ++ qspi->mspi_maj_rev = (rev >> 4) & 0xf; ++ qspi->mspi_min_rev = rev & 0xf; ++ qspi->mspi_spcr3_sysclk = data->has_spcr3_sysclk; ++ ++ qspi->max_speed_hz = qspi->base_clk / (bcm_qspi_spbr_min(qspi) * 2); ++ ++ /* ++ * On SW resets it is possible to have the mask still enabled ++ * Need to disable the mask and clear the status while we init ++ */ ++ bcm_qspi_hw_uninit(qspi); ++ + for (val = 0; val < num_irqs; val++) { + irq = -1; + name = qspi_irq_tab[val].irq_name; +@@ -1433,38 +1478,6 @@ int bcm_qspi_probe(struct platform_device *pdev, + goto qspi_probe_err; + } + +- /* +- * Some SoCs integrate spi controller (e.g., its interrupt bits) +- * in specific ways +- */ +- if (soc_intc) { +- qspi->soc_intc = soc_intc; +- soc_intc->bcm_qspi_int_set(soc_intc, MSPI_DONE, true); +- } else { +- qspi->soc_intc = NULL; +- } +- +- ret = clk_prepare_enable(qspi->clk); +- if (ret) { +- dev_err(dev, "failed to prepare clock\n"); +- goto qspi_probe_err; +- } +- +- qspi->base_clk = clk_get_rate(qspi->clk); +- +- if (data->has_mspi_rev) { +- rev = bcm_qspi_read(qspi, MSPI, MSPI_REV); +- /* some older revs do not have a MSPI_REV register */ +- if ((rev & 0xff) == 0xff) +- rev = 0; +- } +- +- qspi->mspi_maj_rev = (rev >> 4) & 0xf; +- qspi->mspi_min_rev = rev & 0xf; +- qspi->mspi_spcr3_sysclk = data->has_spcr3_sysclk; +- +- qspi->max_speed_hz = qspi->base_clk / (bcm_qspi_spbr_min(qspi) * 2); +- + bcm_qspi_hw_init(qspi); + init_completion(&qspi->mspi_done); + init_completion(&qspi->bspi_done); +diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c +index 823a81d8ff0ed..f255a96ae5a48 100644 +--- a/drivers/tee/optee/core.c ++++ b/drivers/tee/optee/core.c +@@ -585,6 +585,9 @@ static int optee_remove(struct platform_device *pdev) + { + struct optee *optee = platform_get_drvdata(pdev); + ++ /* Unregister OP-TEE specific client devices on TEE bus */ ++ optee_unregister_devices(); ++ + /* + * Ask OP-TEE to free all cached shared memory objects to decrease + * reference counters and also avoid wild pointers in secure world +diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c +index 7a897d51969fc..031806468af48 100644 +--- a/drivers/tee/optee/device.c ++++ b/drivers/tee/optee/device.c +@@ -53,6 +53,13 @@ static int get_devices(struct tee_context *ctx, u32 session, + return 0; + } + ++static void optee_release_device(struct device *dev) ++{ ++ struct tee_client_device *optee_device = to_tee_client_device(dev); ++ ++ kfree(optee_device); ++} ++ + static int optee_register_device(const uuid_t *device_uuid) + { + struct tee_client_device *optee_device = NULL; +@@ -63,6 +70,7 @@ static int optee_register_device(const uuid_t *device_uuid) + return -ENOMEM; + + optee_device->dev.bus = &tee_bus_type; ++ optee_device->dev.release = optee_release_device; + if (dev_set_name(&optee_device->dev, "optee-ta-%pUb", device_uuid)) { + kfree(optee_device); + return -ENOMEM; +@@ -154,3 +162,17 @@ int optee_enumerate_devices(u32 func) + { + return __optee_enumerate_devices(func); + } ++ ++static int __optee_unregister_device(struct device *dev, void *data) ++{ ++ if (!strncmp(dev_name(dev), "optee-ta", strlen("optee-ta"))) ++ device_unregister(dev); ++ ++ return 0; ++} ++ ++void optee_unregister_devices(void) ++{ ++ bus_for_each_dev(&tee_bus_type, NULL, NULL, ++ __optee_unregister_device); ++} +diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h +index dbdd367be1568..f6bb4a763ba94 100644 +--- a/drivers/tee/optee/optee_private.h ++++ b/drivers/tee/optee/optee_private.h +@@ -184,6 +184,7 @@ void optee_fill_pages_list(u64 *dst, struct page **pages, int num_pages, + #define PTA_CMD_GET_DEVICES 0x0 + #define PTA_CMD_GET_DEVICES_SUPP 0x1 + int optee_enumerate_devices(u32 func); ++void optee_unregister_devices(void); + + /* + * Small helpers +diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c +index ae4e4ab638b55..2a53b28319999 100644 +--- a/drivers/usb/host/xhci-dbgtty.c ++++ b/drivers/usb/host/xhci-dbgtty.c +@@ -408,40 +408,38 @@ static int xhci_dbc_tty_register_device(struct xhci_dbc *dbc) + return -EBUSY; + + xhci_dbc_tty_init_port(dbc, port); +- tty_dev = tty_port_register_device(&port->port, +- dbc_tty_driver, 0, NULL); +- if (IS_ERR(tty_dev)) { +- ret = PTR_ERR(tty_dev); +- goto register_fail; +- } + + ret = kfifo_alloc(&port->write_fifo, DBC_WRITE_BUF_SIZE, GFP_KERNEL); + if (ret) +- goto buf_alloc_fail; ++ goto err_exit_port; + + ret = xhci_dbc_alloc_requests(dbc, BULK_IN, &port->read_pool, + dbc_read_complete); + if (ret) +- goto request_fail; ++ goto err_free_fifo; + + ret = xhci_dbc_alloc_requests(dbc, BULK_OUT, &port->write_pool, + dbc_write_complete); + if (ret) +- goto request_fail; ++ goto err_free_requests; ++ ++ tty_dev = tty_port_register_device(&port->port, ++ dbc_tty_driver, 0, NULL); ++ if (IS_ERR(tty_dev)) { ++ ret = PTR_ERR(tty_dev); ++ goto err_free_requests; ++ } + + port->registered = true; + + return 0; + +-request_fail: ++err_free_requests: + xhci_dbc_free_requests(&port->read_pool); + xhci_dbc_free_requests(&port->write_pool); ++err_free_fifo: + kfifo_free(&port->write_fifo); +- +-buf_alloc_fail: +- tty_unregister_device(dbc_tty_driver, 0); +- +-register_fail: ++err_exit_port: + xhci_dbc_tty_exit_port(port); + + dev_err(dbc->dev, "can't register tty port, err %d\n", ret); +diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c +index 119d1a8fbb194..2299866dc82ff 100644 +--- a/drivers/usb/host/xhci-pci.c ++++ b/drivers/usb/host/xhci-pci.c +@@ -30,6 +30,7 @@ + #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 + #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 + #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1009 0x1009 ++#define PCI_DEVICE_ID_FRESCO_LOGIC_FL1100 0x1100 + #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1400 0x1400 + + #define PCI_VENDOR_ID_ETRON 0x1b6f +@@ -112,6 +113,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) + /* Look for vendor-specific quirks */ + if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && + (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK || ++ pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1100 || + pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1400)) { + if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK && + pdev->revision == 0x0) { +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c +index dc2068e3bedb7..ec8f2910faf97 100644 +--- a/drivers/usb/host/xhci-ring.c ++++ b/drivers/usb/host/xhci-ring.c +@@ -342,16 +342,22 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci, + /* Must be called with xhci->lock held, releases and aquires lock back */ + static int xhci_abort_cmd_ring(struct xhci_hcd *xhci, unsigned long flags) + { +- u64 temp_64; ++ u32 temp_32; + int ret; + + xhci_dbg(xhci, "Abort command ring\n"); + + reinit_completion(&xhci->cmd_ring_stop_completion); + +- temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); +- xhci_write_64(xhci, temp_64 | CMD_RING_ABORT, +- &xhci->op_regs->cmd_ring); ++ /* ++ * The control bits like command stop, abort are located in lower ++ * dword of the command ring control register. Limit the write ++ * to the lower dword to avoid corrupting the command ring pointer ++ * in case if the command ring is stopped by the time upper dword ++ * is written. ++ */ ++ temp_32 = readl(&xhci->op_regs->cmd_ring); ++ writel(temp_32 | CMD_RING_ABORT, &xhci->op_regs->cmd_ring); + + /* Section 4.6.1.2 of xHCI 1.0 spec says software should also time the + * completion of the Command Abort operation. If CRR is not negated in 5 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c +index 6389dc99bc9a4..0d6dc2e20f2aa 100644 +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -3173,10 +3173,13 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd, + return; + + /* Bail out if toggle is already being cleared by a endpoint reset */ ++ spin_lock_irqsave(&xhci->lock, flags); + if (ep->ep_state & EP_HARD_CLEAR_TOGGLE) { + ep->ep_state &= ~EP_HARD_CLEAR_TOGGLE; ++ spin_unlock_irqrestore(&xhci->lock, flags); + return; + } ++ spin_unlock_irqrestore(&xhci->lock, flags); + /* Only interrupt and bulk ep's use data toggle, USB2 spec 5.5.4-> */ + if (usb_endpoint_xfer_control(&host_ep->desc) || + usb_endpoint_xfer_isoc(&host_ep->desc)) +@@ -3262,8 +3265,10 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd, + xhci_free_command(xhci, cfg_cmd); + cleanup: + xhci_free_command(xhci, stop_cmd); ++ spin_lock_irqsave(&xhci->lock, flags); + if (ep->ep_state & EP_SOFT_CLEAR_TOGGLE) + ep->ep_state &= ~EP_SOFT_CLEAR_TOGGLE; ++ spin_unlock_irqrestore(&xhci->lock, flags); + } + + static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, +diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c +index ce9fc46c92661..b5935834f9d24 100644 +--- a/drivers/usb/musb/musb_dsps.c ++++ b/drivers/usb/musb/musb_dsps.c +@@ -899,11 +899,13 @@ static int dsps_probe(struct platform_device *pdev) + if (usb_get_dr_mode(&pdev->dev) == USB_DR_MODE_PERIPHERAL) { + ret = dsps_setup_optional_vbus_irq(pdev, glue); + if (ret) +- goto err; ++ goto unregister_pdev; + } + + return 0; + ++unregister_pdev: ++ platform_device_unregister(glue->musb); + err: + pm_runtime_disable(&pdev->dev); + iounmap(glue->usbss_base); +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c +index 1e990a8264a53..c7356718a7c66 100644 +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -246,11 +246,13 @@ static void option_instat_callback(struct urb *urb); + /* These Quectel products use Quectel's vendor ID */ + #define QUECTEL_PRODUCT_EC21 0x0121 + #define QUECTEL_PRODUCT_EC25 0x0125 ++#define QUECTEL_PRODUCT_EG91 0x0191 + #define QUECTEL_PRODUCT_EG95 0x0195 + #define QUECTEL_PRODUCT_BG96 0x0296 + #define QUECTEL_PRODUCT_EP06 0x0306 + #define QUECTEL_PRODUCT_EM12 0x0512 + #define QUECTEL_PRODUCT_RM500Q 0x0800 ++#define QUECTEL_PRODUCT_EC200S_CN 0x6002 + #define QUECTEL_PRODUCT_EC200T 0x6026 + + #define CMOTECH_VENDOR_ID 0x16d8 +@@ -1111,6 +1113,9 @@ static const struct usb_device_id option_ids[] = { + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0xff, 0xff), + .driver_info = NUMEP2 }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0, 0) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG91, 0xff, 0xff, 0xff), ++ .driver_info = NUMEP2 }, ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG91, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff), + .driver_info = NUMEP2 }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) }, +@@ -1128,6 +1133,7 @@ static const struct usb_device_id option_ids[] = { + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x10), + .driver_info = ZLP }, ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) }, + + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, +@@ -1227,6 +1233,8 @@ static const struct usb_device_id option_ids[] = { + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1203, 0xff), /* Telit LE910Cx (RNDIS) */ + .driver_info = NCTRL(2) | RSVD(3) }, ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1204, 0xff), /* Telit LE910Cx (MBIM) */ ++ .driver_info = NCTRL(0) | RSVD(1) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), +diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c +index 83da8236e3c8b..c18bf8164bc2e 100644 +--- a/drivers/usb/serial/qcserial.c ++++ b/drivers/usb/serial/qcserial.c +@@ -165,6 +165,7 @@ static const struct usb_device_id id_table[] = { + {DEVICE_SWI(0x1199, 0x907b)}, /* Sierra Wireless EM74xx */ + {DEVICE_SWI(0x1199, 0x9090)}, /* Sierra Wireless EM7565 QDL */ + {DEVICE_SWI(0x1199, 0x9091)}, /* Sierra Wireless EM7565 */ ++ {DEVICE_SWI(0x1199, 0x90d2)}, /* Sierra Wireless EM9191 QDL */ + {DEVICE_SWI(0x413c, 0x81a2)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ + {DEVICE_SWI(0x413c, 0x81a3)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ + {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ +diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c +index c4d53ff06bf85..fdeb20f2f174c 100644 +--- a/drivers/vhost/vdpa.c ++++ b/drivers/vhost/vdpa.c +@@ -325,7 +325,7 @@ static long vhost_vdpa_set_config_call(struct vhost_vdpa *v, u32 __user *argp) + struct eventfd_ctx *ctx; + + cb.callback = vhost_vdpa_config_cb; +- cb.private = v->vdpa; ++ cb.private = v; + if (copy_from_user(&fd, argp, sizeof(fd))) + return -EFAULT; + +diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c +index 84b5dec5d29cd..5c53098755a35 100644 +--- a/drivers/virtio/virtio.c ++++ b/drivers/virtio/virtio.c +@@ -240,6 +240,17 @@ static int virtio_dev_probe(struct device *_d) + driver_features_legacy = driver_features; + } + ++ /* ++ * Some devices detect legacy solely via F_VERSION_1. Write ++ * F_VERSION_1 to force LE config space accesses before FEATURES_OK for ++ * these when needed. ++ */ ++ if (drv->validate && !virtio_legacy_is_little_endian() ++ && device_features & BIT_ULL(VIRTIO_F_VERSION_1)) { ++ dev->features = BIT_ULL(VIRTIO_F_VERSION_1); ++ dev->config->finalize_features(dev); ++ } ++ + if (device_features & (1ULL << VIRTIO_F_VERSION_1)) + dev->features = driver_features & device_features; + else +diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c +index c346c46020e5e..284294620e9fa 100644 +--- a/fs/btrfs/extent-tree.c ++++ b/fs/btrfs/extent-tree.c +@@ -4715,6 +4715,7 @@ struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans, + out_free_delayed: + btrfs_free_delayed_extent_op(extent_op); + out_free_buf: ++ btrfs_tree_unlock(buf); + free_extent_buffer(buf); + out_free_reserved: + btrfs_free_reserved_extent(fs_info, ins.objectid, ins.offset, 0); +diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c +index 6ab91661cd261..f59ec55e5feb2 100644 +--- a/fs/btrfs/file.c ++++ b/fs/btrfs/file.c +@@ -710,8 +710,7 @@ int __btrfs_drop_extents(struct btrfs_trans_handle *trans, + if (start >= inode->disk_i_size && !replace_extent) + modify_tree = 0; + +- update_refs = (test_bit(BTRFS_ROOT_SHAREABLE, &root->state) || +- root == fs_info->tree_root); ++ update_refs = (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID); + while (1) { + recow = 0; + ret = btrfs_lookup_file_extent(trans, root, path, ino, +@@ -2662,14 +2661,16 @@ int btrfs_replace_file_extents(struct inode *inode, struct btrfs_path *path, + 1, 0, 0, NULL); + if (ret != -ENOSPC) { + /* +- * When cloning we want to avoid transaction aborts when +- * nothing was done and we are attempting to clone parts +- * of inline extents, in such cases -EOPNOTSUPP is +- * returned by __btrfs_drop_extents() without having +- * changed anything in the file. ++ * The only time we don't want to abort is if we are ++ * attempting to clone a partial inline extent, in which ++ * case we'll get EOPNOTSUPP. However if we aren't ++ * clone we need to abort no matter what, because if we ++ * got EOPNOTSUPP via prealloc then we messed up and ++ * need to abort. + */ +- if (extent_info && !extent_info->is_new_extent && +- ret && ret != -EOPNOTSUPP) ++ if (ret && ++ (ret != -EOPNOTSUPP || ++ (extent_info && extent_info->is_new_extent))) + btrfs_abort_transaction(trans, ret); + break; + } +diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c +index 7bf3936aceda2..c3bb5c4375ab0 100644 +--- a/fs/btrfs/tree-log.c ++++ b/fs/btrfs/tree-log.c +@@ -1137,7 +1137,10 @@ next: + /* look for a conflicting sequence number */ + di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(dir), + ref_index, name, namelen, 0); +- if (di && !IS_ERR(di)) { ++ if (IS_ERR(di)) { ++ if (PTR_ERR(di) != -ENOENT) ++ return PTR_ERR(di); ++ } else if (di) { + ret = drop_one_dir_item(trans, root, path, dir, di); + if (ret) + return ret; +@@ -1147,7 +1150,9 @@ next: + /* look for a conflicting name */ + di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(dir), + name, namelen, 0); +- if (di && !IS_ERR(di)) { ++ if (IS_ERR(di)) { ++ return PTR_ERR(di); ++ } else if (di) { + ret = drop_one_dir_item(trans, root, path, dir, di); + if (ret) + return ret; +@@ -1897,8 +1902,8 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, + struct btrfs_key log_key; + struct inode *dir; + u8 log_type; +- int exists; +- int ret = 0; ++ bool exists; ++ int ret; + bool update_size = (key->type == BTRFS_DIR_INDEX_KEY); + bool name_added = false; + +@@ -1918,12 +1923,12 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, + name_len); + + btrfs_dir_item_key_to_cpu(eb, di, &log_key); +- exists = btrfs_lookup_inode(trans, root, path, &log_key, 0); +- if (exists == 0) +- exists = 1; +- else +- exists = 0; ++ ret = btrfs_lookup_inode(trans, root, path, &log_key, 0); + btrfs_release_path(path); ++ if (ret < 0) ++ goto out; ++ exists = (ret == 0); ++ ret = 0; + + if (key->type == BTRFS_DIR_ITEM_KEY) { + dst_di = btrfs_lookup_dir_item(trans, root, path, key->objectid, +@@ -1938,7 +1943,14 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, + ret = -EINVAL; + goto out; + } +- if (IS_ERR_OR_NULL(dst_di)) { ++ ++ if (dst_di == ERR_PTR(-ENOENT)) ++ dst_di = NULL; ++ ++ if (IS_ERR(dst_di)) { ++ ret = PTR_ERR(dst_di); ++ goto out; ++ } else if (!dst_di) { + /* we need a sequence number to insert, so we only + * do inserts for the BTRFS_DIR_INDEX_KEY types + */ +diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h +index 70a3664785f80..f5e829e12a76d 100644 +--- a/include/linux/mlx5/mlx5_ifc.h ++++ b/include/linux/mlx5/mlx5_ifc.h +@@ -9274,16 +9274,22 @@ struct mlx5_ifc_pcmr_reg_bits { + u8 reserved_at_0[0x8]; + u8 local_port[0x8]; + u8 reserved_at_10[0x10]; ++ + u8 entropy_force_cap[0x1]; + u8 entropy_calc_cap[0x1]; + u8 entropy_gre_calc_cap[0x1]; +- u8 reserved_at_23[0x1b]; ++ u8 reserved_at_23[0xf]; ++ u8 rx_ts_over_crc_cap[0x1]; ++ u8 reserved_at_33[0xb]; + u8 fcs_cap[0x1]; + u8 reserved_at_3f[0x1]; ++ + u8 entropy_force[0x1]; + u8 entropy_calc[0x1]; + u8 entropy_gre_calc[0x1]; +- u8 reserved_at_43[0x1b]; ++ u8 reserved_at_43[0xf]; ++ u8 rx_ts_over_crc[0x1]; ++ u8 reserved_at_53[0xb]; + u8 fcs_chk[0x1]; + u8 reserved_at_5f[0x1]; + }; +diff --git a/net/nfc/af_nfc.c b/net/nfc/af_nfc.c +index 4a9e72073564a..581358dcbdf8d 100644 +--- a/net/nfc/af_nfc.c ++++ b/net/nfc/af_nfc.c +@@ -60,6 +60,9 @@ int nfc_proto_register(const struct nfc_protocol *nfc_proto) + proto_tab[nfc_proto->id] = nfc_proto; + write_unlock(&proto_tab_lock); + ++ if (rc) ++ proto_unregister(nfc_proto->proto); ++ + return rc; + } + EXPORT_SYMBOL(nfc_proto_register); +diff --git a/net/nfc/digital_core.c b/net/nfc/digital_core.c +index e3599ed4a7a87..9c9caa307cf16 100644 +--- a/net/nfc/digital_core.c ++++ b/net/nfc/digital_core.c +@@ -277,6 +277,7 @@ int digital_tg_configure_hw(struct nfc_digital_dev *ddev, int type, int param) + static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech) + { + struct digital_tg_mdaa_params *params; ++ int rc; + + params = kzalloc(sizeof(*params), GFP_KERNEL); + if (!params) +@@ -291,8 +292,12 @@ static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech) + get_random_bytes(params->nfcid2 + 2, NFC_NFCID2_MAXSIZE - 2); + params->sc = DIGITAL_SENSF_FELICA_SC; + +- return digital_send_cmd(ddev, DIGITAL_CMD_TG_LISTEN_MDAA, NULL, params, +- 500, digital_tg_recv_atr_req, NULL); ++ rc = digital_send_cmd(ddev, DIGITAL_CMD_TG_LISTEN_MDAA, NULL, params, ++ 500, digital_tg_recv_atr_req, NULL); ++ if (rc) ++ kfree(params); ++ ++ return rc; + } + + static int digital_tg_listen_md(struct nfc_digital_dev *ddev, u8 rf_tech) +diff --git a/net/nfc/digital_technology.c b/net/nfc/digital_technology.c +index 84d2345c75a3f..3adf4589852af 100644 +--- a/net/nfc/digital_technology.c ++++ b/net/nfc/digital_technology.c +@@ -465,8 +465,12 @@ static int digital_in_send_sdd_req(struct nfc_digital_dev *ddev, + skb_put_u8(skb, sel_cmd); + skb_put_u8(skb, DIGITAL_SDD_REQ_SEL_PAR); + +- return digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sdd_res, +- target); ++ rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sdd_res, ++ target); ++ if (rc) ++ kfree_skb(skb); ++ ++ return rc; + } + + static void digital_in_recv_sens_res(struct nfc_digital_dev *ddev, void *arg, +diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c +index 8766ab5b87880..5eb3b1b7ae5e7 100644 +--- a/net/sched/sch_mqprio.c ++++ b/net/sched/sch_mqprio.c +@@ -529,22 +529,28 @@ static int mqprio_dump_class_stats(struct Qdisc *sch, unsigned long cl, + for (i = tc.offset; i < tc.offset + tc.count; i++) { + struct netdev_queue *q = netdev_get_tx_queue(dev, i); + struct Qdisc *qdisc = rtnl_dereference(q->qdisc); +- struct gnet_stats_basic_cpu __percpu *cpu_bstats = NULL; +- struct gnet_stats_queue __percpu *cpu_qstats = NULL; + + spin_lock_bh(qdisc_lock(qdisc)); ++ + if (qdisc_is_percpu_stats(qdisc)) { +- cpu_bstats = qdisc->cpu_bstats; +- cpu_qstats = qdisc->cpu_qstats; ++ qlen = qdisc_qlen_sum(qdisc); ++ ++ __gnet_stats_copy_basic(NULL, &bstats, ++ qdisc->cpu_bstats, ++ &qdisc->bstats); ++ __gnet_stats_copy_queue(&qstats, ++ qdisc->cpu_qstats, ++ &qdisc->qstats, ++ qlen); ++ } else { ++ qlen += qdisc->q.qlen; ++ bstats.bytes += qdisc->bstats.bytes; ++ bstats.packets += qdisc->bstats.packets; ++ qstats.backlog += qdisc->qstats.backlog; ++ qstats.drops += qdisc->qstats.drops; ++ qstats.requeues += qdisc->qstats.requeues; ++ qstats.overlimits += qdisc->qstats.overlimits; + } +- +- qlen = qdisc_qlen_sum(qdisc); +- __gnet_stats_copy_basic(NULL, &sch->bstats, +- cpu_bstats, &qdisc->bstats); +- __gnet_stats_copy_queue(&sch->qstats, +- cpu_qstats, +- &qdisc->qstats, +- qlen); + spin_unlock_bh(qdisc_lock(qdisc)); + } + +diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c +index fa0d96320baae..64e0f4864b733 100644 +--- a/net/sctp/sm_make_chunk.c ++++ b/net/sctp/sm_make_chunk.c +@@ -3651,7 +3651,7 @@ struct sctp_chunk *sctp_make_strreset_req( + outlen = (sizeof(outreq) + stream_len) * out; + inlen = (sizeof(inreq) + stream_len) * in; + +- retval = sctp_make_reconf(asoc, outlen + inlen); ++ retval = sctp_make_reconf(asoc, SCTP_PAD4(outlen) + SCTP_PAD4(inlen)); + if (!retval) + return NULL; + +diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl +index 4f84657f55c23..f459ae883a0a6 100755 +--- a/scripts/recordmcount.pl ++++ b/scripts/recordmcount.pl +@@ -222,7 +222,7 @@ if ($arch =~ /(x86(_64)?)|(i386)/) { + $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)"; + $weak_regex = "^[0-9a-fA-F]+\\s+([wW])\\s+(\\S+)"; + $section_regex = "Disassembly of section\\s+(\\S+):"; +-$function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; ++$function_regex = "^([0-9a-fA-F]+)\\s+<([^^]*?)>:"; + $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s(mcount|__fentry__)\$"; + $section_type = '@progbits'; + $mcount_adjust = 0; +diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c +index 590a46a9e78de..a226d8f240287 100644 +--- a/sound/core/pcm_compat.c ++++ b/sound/core/pcm_compat.c +@@ -466,6 +466,76 @@ static int snd_pcm_ioctl_sync_ptr_x32(struct snd_pcm_substream *substream, + } + #endif /* CONFIG_X86_X32 */ + ++#ifdef __BIG_ENDIAN ++typedef char __pad_before_u32[4]; ++typedef char __pad_after_u32[0]; ++#else ++typedef char __pad_before_u32[0]; ++typedef char __pad_after_u32[4]; ++#endif ++ ++/* PCM 2.0.15 API definition had a bug in mmap control; it puts the avail_min ++ * at the wrong offset due to a typo in padding type. ++ * The bug hits only 32bit. ++ * A workaround for incorrect read/write is needed only in 32bit compat mode. ++ */ ++struct __snd_pcm_mmap_control64_buggy { ++ __pad_before_u32 __pad1; ++ __u32 appl_ptr; ++ __pad_before_u32 __pad2; /* SiC! here is the bug */ ++ __pad_before_u32 __pad3; ++ __u32 avail_min; ++ __pad_after_uframe __pad4; ++}; ++ ++static int snd_pcm_ioctl_sync_ptr_buggy(struct snd_pcm_substream *substream, ++ struct snd_pcm_sync_ptr __user *_sync_ptr) ++{ ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ struct snd_pcm_sync_ptr sync_ptr; ++ struct __snd_pcm_mmap_control64_buggy *sync_cp; ++ volatile struct snd_pcm_mmap_status *status; ++ volatile struct snd_pcm_mmap_control *control; ++ int err; ++ ++ memset(&sync_ptr, 0, sizeof(sync_ptr)); ++ sync_cp = (struct __snd_pcm_mmap_control64_buggy *)&sync_ptr.c.control; ++ if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags))) ++ return -EFAULT; ++ if (copy_from_user(sync_cp, &(_sync_ptr->c.control), sizeof(*sync_cp))) ++ return -EFAULT; ++ status = runtime->status; ++ control = runtime->control; ++ if (sync_ptr.flags & SNDRV_PCM_SYNC_PTR_HWSYNC) { ++ err = snd_pcm_hwsync(substream); ++ if (err < 0) ++ return err; ++ } ++ snd_pcm_stream_lock_irq(substream); ++ if (!(sync_ptr.flags & SNDRV_PCM_SYNC_PTR_APPL)) { ++ err = pcm_lib_apply_appl_ptr(substream, sync_cp->appl_ptr); ++ if (err < 0) { ++ snd_pcm_stream_unlock_irq(substream); ++ return err; ++ } ++ } else { ++ sync_cp->appl_ptr = control->appl_ptr; ++ } ++ if (!(sync_ptr.flags & SNDRV_PCM_SYNC_PTR_AVAIL_MIN)) ++ control->avail_min = sync_cp->avail_min; ++ else ++ sync_cp->avail_min = control->avail_min; ++ sync_ptr.s.status.state = status->state; ++ sync_ptr.s.status.hw_ptr = status->hw_ptr; ++ sync_ptr.s.status.tstamp = status->tstamp; ++ sync_ptr.s.status.suspended_state = status->suspended_state; ++ sync_ptr.s.status.audio_tstamp = status->audio_tstamp; ++ snd_pcm_stream_unlock_irq(substream); ++ if (copy_to_user(_sync_ptr, &sync_ptr, sizeof(sync_ptr))) ++ return -EFAULT; ++ return 0; ++} ++ + /* + */ + enum { +@@ -535,7 +605,7 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned l + if (in_x32_syscall()) + return snd_pcm_ioctl_sync_ptr_x32(substream, argp); + #endif /* CONFIG_X86_X32 */ +- return snd_pcm_common_ioctl(file, substream, cmd, argp); ++ return snd_pcm_ioctl_sync_ptr_buggy(substream, argp); + case SNDRV_PCM_IOCTL_HW_REFINE32: + return snd_pcm_ioctl_hw_params_compat(substream, 1, argp); + case SNDRV_PCM_IOCTL_HW_PARAMS32: +diff --git a/sound/core/seq_device.c b/sound/core/seq_device.c +index 7ed13cb32ef82..f22d3bbfcaa54 100644 +--- a/sound/core/seq_device.c ++++ b/sound/core/seq_device.c +@@ -147,6 +147,8 @@ static int snd_seq_device_dev_free(struct snd_device *device) + struct snd_seq_device *dev = device->device_data; + + cancel_autoload_drivers(); ++ if (dev->private_free) ++ dev->private_free(dev); + put_device(&dev->dev); + return 0; + } +@@ -174,11 +176,7 @@ static int snd_seq_device_dev_disconnect(struct snd_device *device) + + static void snd_seq_dev_release(struct device *dev) + { +- struct snd_seq_device *sdev = to_seq_dev(dev); +- +- if (sdev->private_free) +- sdev->private_free(sdev); +- kfree(sdev); ++ kfree(to_seq_dev(dev)); + } + + /* +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 9f37adb2b4d09..c36239cea474f 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -527,6 +527,8 @@ static void alc_shutup_pins(struct hda_codec *codec) + struct alc_spec *spec = codec->spec; + + switch (codec->core.vendor_id) { ++ case 0x10ec0236: ++ case 0x10ec0256: + case 0x10ec0283: + case 0x10ec0286: + case 0x10ec0288: +@@ -2549,7 +2551,8 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { + SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), + SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), + SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), +- SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED), + SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950), +@@ -3531,7 +3534,8 @@ static void alc256_shutup(struct hda_codec *codec) + /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly + * when booting with headset plugged. So skip setting it for the codec alc257 + */ +- if (codec->core.vendor_id != 0x10ec0257) ++ if (spec->codec_variant != ALC269_TYPE_ALC257 && ++ spec->codec_variant != ALC269_TYPE_ALC256) + alc_update_coef_idx(codec, 0x46, 0, 3 << 12); + + if (!spec->no_shutup_pins) +@@ -6395,6 +6399,24 @@ static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, + /* for alc285_fixup_ideapad_s740_coef() */ + #include "ideapad_s740_helper.c" + ++static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *codec, ++ const struct hda_fixup *fix, ++ int action) ++{ ++ /* ++ * A certain other OS sets these coeffs to different values. On at least one TongFang ++ * barebone these settings might survive even a cold reboot. So to restore a clean slate the ++ * values are explicitly reset to default here. Without this, the external microphone is ++ * always in a plugged-in state, while the internal microphone is always in an unplugged ++ * state, breaking the ability to use the internal microphone. ++ */ ++ alc_write_coef_idx(codec, 0x24, 0x0000); ++ alc_write_coef_idx(codec, 0x26, 0x0000); ++ alc_write_coef_idx(codec, 0x29, 0x3000); ++ alc_write_coef_idx(codec, 0x37, 0xfe05); ++ alc_write_coef_idx(codec, 0x45, 0x5089); ++} ++ + enum { + ALC269_FIXUP_GPIO2, + ALC269_FIXUP_SONY_VAIO, +@@ -6608,7 +6630,8 @@ enum { + ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS, + ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE, + ALC287_FIXUP_YOGA7_14ITL_SPEAKERS, +- ALC287_FIXUP_13S_GEN2_SPEAKERS ++ ALC287_FIXUP_13S_GEN2_SPEAKERS, ++ ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS, + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -8283,7 +8306,7 @@ static const struct hda_fixup alc269_fixups[] = { + .v.verbs = (const struct hda_verb[]) { + { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x41 }, +- { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, +@@ -8300,6 +8323,10 @@ static const struct hda_fixup alc269_fixups[] = { + .chained = true, + .chain_id = ALC269_FIXUP_HEADSET_MODE, + }, ++ [ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc256_fixup_tongfang_reset_persistent_settings, ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -8391,6 +8418,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC), + SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC), + SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK), ++ SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK), ++ SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE), ++ SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), +@@ -8726,6 +8756,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */ + SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802), + SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X), ++ SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS), + SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC), + SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC), +@@ -10098,6 +10129,9 @@ enum { + ALC671_FIXUP_HP_HEADSET_MIC2, + ALC662_FIXUP_ACER_X2660G_HEADSET_MODE, + ALC662_FIXUP_ACER_NITRO_HEADSET_MODE, ++ ALC668_FIXUP_ASUS_NO_HEADSET_MIC, ++ ALC668_FIXUP_HEADSET_MIC, ++ ALC668_FIXUP_MIC_DET_COEF, + }; + + static const struct hda_fixup alc662_fixups[] = { +@@ -10481,6 +10515,29 @@ static const struct hda_fixup alc662_fixups[] = { + .chained = true, + .chain_id = ALC662_FIXUP_USI_FUNC + }, ++ [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x1b, 0x04a1112c }, ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC668_FIXUP_HEADSET_MIC ++ }, ++ [ALC668_FIXUP_HEADSET_MIC] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc269_fixup_headset_mic, ++ .chained = true, ++ .chain_id = ALC668_FIXUP_MIC_DET_COEF ++ }, ++ [ALC668_FIXUP_MIC_DET_COEF] = { ++ .type = HDA_FIXUP_VERBS, ++ .v.verbs = (const struct hda_verb[]) { ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 }, ++ {} ++ }, ++ }, + }; + + static const struct snd_pci_quirk alc662_fixup_tbl[] = { +@@ -10516,6 +10573,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16), + SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51), + SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51), ++ SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC), + SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8), + SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16), + SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h +index 5728bf722c88a..7c649cd380493 100644 +--- a/sound/usb/quirks-table.h ++++ b/sound/usb/quirks-table.h +@@ -77,6 +77,48 @@ + /* E-Mu 0204 USB */ + { USB_DEVICE_VENDOR_SPEC(0x041e, 0x3f19) }, + ++/* ++ * Creative Technology, Ltd Live! Cam Sync HD [VF0770] ++ * The device advertises 8 formats, but only a rate of 48kHz is honored by the ++ * hardware and 24 bits give chopped audio, so only report the one working ++ * combination. ++ */ ++{ ++ USB_DEVICE(0x041e, 0x4095), ++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { ++ .ifnum = QUIRK_ANY_INTERFACE, ++ .type = QUIRK_COMPOSITE, ++ .data = &(const struct snd_usb_audio_quirk[]) { ++ { ++ .ifnum = 2, ++ .type = QUIRK_AUDIO_STANDARD_MIXER, ++ }, ++ { ++ .ifnum = 3, ++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, ++ .data = &(const struct audioformat) { ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, ++ .channels = 2, ++ .fmt_bits = 16, ++ .iface = 3, ++ .altsetting = 4, ++ .altset_idx = 4, ++ .endpoint = 0x82, ++ .ep_attr = 0x05, ++ .rates = SNDRV_PCM_RATE_48000, ++ .rate_min = 48000, ++ .rate_max = 48000, ++ .nr_rates = 1, ++ .rate_table = (unsigned int[]) { 48000 }, ++ }, ++ }, ++ { ++ .ifnum = -1 ++ }, ++ }, ++ }, ++}, ++ + /* + * HP Wireless Audio + * When not ignored, causes instability issues for some users, forcing them to diff --git a/patch/kernel/archive/sunxi-5.14/olimex_0018-net-dwmac-Apply-maximum-divider-for-clock-above-300M.patch b/patch/kernel/archive/sunxi-5.14/olimex_0018-net-dwmac-Apply-maximum-divider-for-clock-above-300M.patch deleted file mode 100644 index e3cd67d6b3..0000000000 --- a/patch/kernel/archive/sunxi-5.14/olimex_0018-net-dwmac-Apply-maximum-divider-for-clock-above-300M.patch +++ /dev/null @@ -1,26 +0,0 @@ -From a4aa5e03611fe24bef94b891716c2f11197b89ad Mon Sep 17 00:00:00 2001 -From: Mitko Gamishev -Date: Wed, 5 Feb 2020 15:30:38 +0200 -Subject: [PATCH 18/48] - net-dwmac-Apply-maximum-divider-for-clock-above-300MHz.patch - ---- - drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -index 7da18c9afa01..ea236cc11bf6 100644 ---- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c -@@ -252,7 +252,7 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv) - priv->clk_csr = STMMAC_CSR_100_150M; - else if ((clk_rate >= CSR_F_150M) && (clk_rate < CSR_F_250M)) - priv->clk_csr = STMMAC_CSR_150_250M; -- else if ((clk_rate >= CSR_F_250M) && (clk_rate < CSR_F_300M)) -+ else if (clk_rate >= CSR_F_250M) - priv->clk_csr = STMMAC_CSR_250_300M; - } - --- -2.25.1 - diff --git a/patch/kernel/archive/sunxi-5.14/patch-5.14.13-14.patch b/patch/kernel/archive/sunxi-5.14/patch-5.14.13-14.patch new file mode 100644 index 0000000000..f4e20f8764 --- /dev/null +++ b/patch/kernel/archive/sunxi-5.14/patch-5.14.13-14.patch @@ -0,0 +1,4421 @@ +diff --git a/Makefile b/Makefile +index 7bdca9dc0e61b..f05668e1ffaba 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 14 +-SUBLEVEL = 13 ++SUBLEVEL = 14 + EXTRAVERSION = + NAME = Opossums on Parade + +diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts +index f24bdd0870a52..72ce80fbf2662 100644 +--- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts ++++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts +@@ -40,8 +40,8 @@ + regulator-always-on; + regulator-settling-time-us = <5000>; + gpios = <&expgpio 4 GPIO_ACTIVE_HIGH>; +- states = <1800000 0x1 +- 3300000 0x0>; ++ states = <1800000 0x1>, ++ <3300000 0x0>; + status = "okay"; + }; + +@@ -217,15 +217,16 @@ + }; + + &pcie0 { +- pci@1,0 { ++ pci@0,0 { ++ device_type = "pci"; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + reg = <0 0 0 0 0>; + +- usb@1,0 { +- reg = <0x10000 0 0 0 0>; ++ usb@0,0 { ++ reg = <0 0 0 0 0>; + resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi +index b8a4096192aa9..3b60297af7f60 100644 +--- a/arch/arm/boot/dts/bcm2711.dtsi ++++ b/arch/arm/boot/dts/bcm2711.dtsi +@@ -300,6 +300,14 @@ + status = "disabled"; + }; + ++ vec: vec@7ec13000 { ++ compatible = "brcm,bcm2711-vec"; ++ reg = <0x7ec13000 0x1000>; ++ clocks = <&clocks BCM2835_CLOCK_VEC>; ++ interrupts = ; ++ status = "disabled"; ++ }; ++ + dvp: clock@7ef00000 { + compatible = "brcm,brcm2711-dvp"; + reg = <0x7ef00000 0x10>; +@@ -532,8 +540,8 @@ + compatible = "brcm,genet-mdio-v5"; + reg = <0xe14 0x8>; + reg-names = "mdio"; +- #address-cells = <0x0>; +- #size-cells = <0x1>; ++ #address-cells = <0x1>; ++ #size-cells = <0x0>; + }; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2835-common.dtsi b/arch/arm/boot/dts/bcm2835-common.dtsi +index 4119271c979d6..c25e797b90600 100644 +--- a/arch/arm/boot/dts/bcm2835-common.dtsi ++++ b/arch/arm/boot/dts/bcm2835-common.dtsi +@@ -106,6 +106,14 @@ + status = "okay"; + }; + ++ vec: vec@7e806000 { ++ compatible = "brcm,bcm2835-vec"; ++ reg = <0x7e806000 0x1000>; ++ clocks = <&clocks BCM2835_CLOCK_VEC>; ++ interrupts = <2 27>; ++ status = "disabled"; ++ }; ++ + pixelvalve@7e807000 { + compatible = "brcm,bcm2835-pixelvalve2"; + reg = <0x7e807000 0x100>; +diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi +index 0f3be55201a5b..a3e06b6809476 100644 +--- a/arch/arm/boot/dts/bcm283x.dtsi ++++ b/arch/arm/boot/dts/bcm283x.dtsi +@@ -464,14 +464,6 @@ + status = "disabled"; + }; + +- vec: vec@7e806000 { +- compatible = "brcm,bcm2835-vec"; +- reg = <0x7e806000 0x1000>; +- clocks = <&clocks BCM2835_CLOCK_VEC>; +- interrupts = <2 27>; +- status = "disabled"; +- }; +- + usb: usb@7e980000 { + compatible = "brcm,bcm2835-usb"; + reg = <0x7e980000 0x10000>; +diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c +index 23505fc353247..a8158c9489666 100644 +--- a/arch/arm64/mm/hugetlbpage.c ++++ b/arch/arm64/mm/hugetlbpage.c +@@ -43,7 +43,7 @@ void __init arm64_hugetlb_cma_reserve(void) + #ifdef CONFIG_ARM64_4K_PAGES + order = PUD_SHIFT - PAGE_SHIFT; + #else +- order = CONT_PMD_SHIFT + PMD_SHIFT - PAGE_SHIFT; ++ order = CONT_PMD_SHIFT - PAGE_SHIFT; + #endif + /* + * HugeTLB CMA reservation is required for gigantic +diff --git a/arch/csky/kernel/ptrace.c b/arch/csky/kernel/ptrace.c +index 0105ac81b4328..1a5f54e0d2726 100644 +--- a/arch/csky/kernel/ptrace.c ++++ b/arch/csky/kernel/ptrace.c +@@ -99,7 +99,8 @@ static int gpr_set(struct task_struct *target, + if (ret) + return ret; + +- regs.sr = task_pt_regs(target)->sr; ++ /* BIT(0) of regs.sr is Condition Code/Carry bit */ ++ regs.sr = (regs.sr & BIT(0)) | (task_pt_regs(target)->sr & ~BIT(0)); + #ifdef CONFIG_CPU_HAS_HILO + regs.dcsr = task_pt_regs(target)->dcsr; + #endif +diff --git a/arch/csky/kernel/signal.c b/arch/csky/kernel/signal.c +index 312f046d452d8..6ba3969ec175e 100644 +--- a/arch/csky/kernel/signal.c ++++ b/arch/csky/kernel/signal.c +@@ -52,10 +52,14 @@ static long restore_sigcontext(struct pt_regs *regs, + struct sigcontext __user *sc) + { + int err = 0; ++ unsigned long sr = regs->sr; + + /* sc_pt_regs is structured the same as the start of pt_regs */ + err |= __copy_from_user(regs, &sc->sc_pt_regs, sizeof(struct pt_regs)); + ++ /* BIT(0) of regs->sr is Condition Code/Carry bit */ ++ regs->sr = (sr & ~1) | (regs->sr & 1); ++ + /* Restore the floating-point state. */ + err |= restore_fpu_state(sc); + +diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c +index 8183ca343675a..1d2546ac6fbc3 100644 +--- a/arch/powerpc/sysdev/xive/common.c ++++ b/arch/powerpc/sysdev/xive/common.c +@@ -961,7 +961,8 @@ static int xive_get_irqchip_state(struct irq_data *data, + * interrupt to be inactive in that case. + */ + *state = (pq != XIVE_ESB_INVALID) && !xd->stale_p && +- (xd->saved_p || !!(pq & XIVE_ESB_VAL_P)); ++ (xd->saved_p || (!!(pq & XIVE_ESB_VAL_P) && ++ !irqd_irq_disabled(data))); + return 0; + default: + return -EINVAL; +diff --git a/arch/s390/lib/string.c b/arch/s390/lib/string.c +index cfcdf76d6a957..a95ca6df4e5e6 100644 +--- a/arch/s390/lib/string.c ++++ b/arch/s390/lib/string.c +@@ -259,14 +259,13 @@ EXPORT_SYMBOL(strcmp); + #ifdef __HAVE_ARCH_STRRCHR + char *strrchr(const char *s, int c) + { +- size_t len = __strend(s) - s; +- +- if (len) +- do { +- if (s[len] == (char) c) +- return (char *) s + len; +- } while (--len > 0); +- return NULL; ++ ssize_t len = __strend(s) - s; ++ ++ do { ++ if (s[len] == (char)c) ++ return (char *)s + len; ++ } while (--len >= 0); ++ return NULL; + } + EXPORT_SYMBOL(strrchr); + #endif +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig +index 51341f2e218de..551eaab376f31 100644 +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -1520,7 +1520,6 @@ config AMD_MEM_ENCRYPT + + config AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT + bool "Activate AMD Secure Memory Encryption (SME) by default" +- default y + depends on AMD_MEM_ENCRYPT + help + Say yes to have system memory encrypted by default if running on +diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c +index 23001ae03e82b..7afc2d72d8634 100644 +--- a/arch/x86/kernel/cpu/resctrl/core.c ++++ b/arch/x86/kernel/cpu/resctrl/core.c +@@ -590,6 +590,8 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r) + } + + if (r->mon_capable && domain_setup_mon_state(r, d)) { ++ kfree(d->ctrl_val); ++ kfree(d->mbps_val); + kfree(d); + return; + } +diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c +index fa17a27390ab0..831b25c5e7058 100644 +--- a/arch/x86/kernel/fpu/signal.c ++++ b/arch/x86/kernel/fpu/signal.c +@@ -385,7 +385,7 @@ static int __fpu_restore_sig(void __user *buf, void __user *buf_fx, + return -EINVAL; + } else { + /* Mask invalid bits out for historical reasons (broken hardware). */ +- fpu->state.fxsave.mxcsr &= ~mxcsr_feature_mask; ++ fpu->state.fxsave.mxcsr &= mxcsr_feature_mask; + } + + /* Enforce XFEATURE_MASK_FPSSE when XSAVE is enabled */ +diff --git a/drivers/acpi/arm64/gtdt.c b/drivers/acpi/arm64/gtdt.c +index 0a0a982f9c28d..c0e77c1c8e09d 100644 +--- a/drivers/acpi/arm64/gtdt.c ++++ b/drivers/acpi/arm64/gtdt.c +@@ -36,7 +36,7 @@ struct acpi_gtdt_descriptor { + + static struct acpi_gtdt_descriptor acpi_gtdt_desc __initdata; + +-static inline void *next_platform_timer(void *platform_timer) ++static inline __init void *next_platform_timer(void *platform_timer) + { + struct acpi_gtdt_header *gh = platform_timer; + +diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c +index bd92b549fd5a4..1c48358b43ba3 100644 +--- a/drivers/acpi/x86/s2idle.c ++++ b/drivers/acpi/x86/s2idle.c +@@ -371,7 +371,7 @@ static int lps0_device_attach(struct acpi_device *adev, + return 0; + + if (acpi_s2idle_vendor_amd()) { +- /* AMD0004, AMDI0005: ++ /* AMD0004, AMD0005, AMDI0005: + * - Should use rev_id 0x0 + * - function mask > 0x3: Should use AMD method, but has off by one bug + * - function mask = 0x3: Should use Microsoft method +@@ -390,6 +390,7 @@ static int lps0_device_attach(struct acpi_device *adev, + ACPI_LPS0_DSM_UUID_MICROSOFT, 0, + &lps0_dsm_guid_microsoft); + if (lps0_dsm_func_mask > 0x3 && (!strcmp(hid, "AMD0004") || ++ !strcmp(hid, "AMD0005") || + !strcmp(hid, "AMDI0005"))) { + lps0_dsm_func_mask = (lps0_dsm_func_mask << 1) | 0x1; + acpi_handle_debug(adev->handle, "_DSM UUID %s: Adjusted function mask: 0x%x\n", +diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c +index b2f5520882918..0910441321f72 100644 +--- a/drivers/ata/libahci_platform.c ++++ b/drivers/ata/libahci_platform.c +@@ -440,10 +440,7 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, + hpriv->phy_regulator = devm_regulator_get(dev, "phy"); + if (IS_ERR(hpriv->phy_regulator)) { + rc = PTR_ERR(hpriv->phy_regulator); +- if (rc == -EPROBE_DEFER) +- goto err_out; +- rc = 0; +- hpriv->phy_regulator = NULL; ++ goto err_out; + } + + if (flags & AHCI_PLATFORM_GET_RESETS) { +diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c +index c3e6592712c4b..0a8bf09a5c19e 100644 +--- a/drivers/ata/pata_legacy.c ++++ b/drivers/ata/pata_legacy.c +@@ -352,7 +352,8 @@ static unsigned int pdc_data_xfer_vlb(struct ata_queued_cmd *qc, + iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); + + if (unlikely(slop)) { +- __le32 pad; ++ __le32 pad = 0; ++ + if (rw == READ) { + pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr)); + memcpy(buf + buflen - slop, &pad, slop); +@@ -742,7 +743,8 @@ static unsigned int vlb32_data_xfer(struct ata_queued_cmd *qc, + ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); + + if (unlikely(slop)) { +- __le32 pad; ++ __le32 pad = 0; ++ + if (rw == WRITE) { + memcpy(&pad, buf + buflen - slop, slop); + iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr); +diff --git a/drivers/base/core.c b/drivers/base/core.c +index 56f54e6eb9874..f150ebebb3068 100644 +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -675,7 +675,8 @@ struct device_link *device_link_add(struct device *consumer, + { + struct device_link *link; + +- if (!consumer || !supplier || flags & ~DL_ADD_VALID_FLAGS || ++ if (!consumer || !supplier || consumer == supplier || ++ flags & ~DL_ADD_VALID_FLAGS || + (flags & DL_FLAG_STATELESS && flags & DL_MANAGED_LINK_FLAGS) || + (flags & DL_FLAG_SYNC_STATE_ONLY && + (flags & ~DL_FLAG_INFERRED) != DL_FLAG_SYNC_STATE_ONLY) || +diff --git a/drivers/block/rnbd/rnbd-clt-sysfs.c b/drivers/block/rnbd/rnbd-clt-sysfs.c +index 324afdd63a967..102c08ad4dd06 100644 +--- a/drivers/block/rnbd/rnbd-clt-sysfs.c ++++ b/drivers/block/rnbd/rnbd-clt-sysfs.c +@@ -71,8 +71,10 @@ static int rnbd_clt_parse_map_options(const char *buf, size_t max_path_cnt, + int opt_mask = 0; + int token; + int ret = -EINVAL; +- int i, dest_port, nr_poll_queues; ++ int nr_poll_queues = 0; ++ int dest_port = 0; + int p_cnt = 0; ++ int i; + + options = kstrdup(buf, GFP_KERNEL); + if (!options) +diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c +index afb37aac09e88..e870248d5c152 100644 +--- a/drivers/block/virtio_blk.c ++++ b/drivers/block/virtio_blk.c +@@ -692,28 +692,6 @@ static const struct blk_mq_ops virtio_mq_ops = { + static unsigned int virtblk_queue_depth; + module_param_named(queue_depth, virtblk_queue_depth, uint, 0444); + +-static int virtblk_validate(struct virtio_device *vdev) +-{ +- u32 blk_size; +- +- if (!vdev->config->get) { +- dev_err(&vdev->dev, "%s failure: config access disabled\n", +- __func__); +- return -EINVAL; +- } +- +- if (!virtio_has_feature(vdev, VIRTIO_BLK_F_BLK_SIZE)) +- return 0; +- +- blk_size = virtio_cread32(vdev, +- offsetof(struct virtio_blk_config, blk_size)); +- +- if (blk_size < SECTOR_SIZE || blk_size > PAGE_SIZE) +- __virtio_clear_bit(vdev, VIRTIO_BLK_F_BLK_SIZE); +- +- return 0; +-} +- + static int virtblk_probe(struct virtio_device *vdev) + { + struct virtio_blk *vblk; +@@ -725,6 +703,12 @@ static int virtblk_probe(struct virtio_device *vdev) + u8 physical_block_exp, alignment_offset; + unsigned int queue_depth; + ++ if (!vdev->config->get) { ++ dev_err(&vdev->dev, "%s failure: config access disabled\n", ++ __func__); ++ return -EINVAL; ++ } ++ + err = ida_simple_get(&vd_index_ida, 0, minor_to_index(1 << MINORBITS), + GFP_KERNEL); + if (err < 0) +@@ -765,7 +749,7 @@ static int virtblk_probe(struct virtio_device *vdev) + goto out_free_vblk; + + /* Default queue sizing is to fill the ring. */ +- if (likely(!virtblk_queue_depth)) { ++ if (!virtblk_queue_depth) { + queue_depth = vblk->vqs[0].vq->num_free; + /* ... but without indirect descs, we use 2 descs per req */ + if (!virtio_has_feature(vdev, VIRTIO_RING_F_INDIRECT_DESC)) +@@ -839,14 +823,6 @@ static int virtblk_probe(struct virtio_device *vdev) + else + blk_size = queue_logical_block_size(q); + +- if (unlikely(blk_size < SECTOR_SIZE || blk_size > PAGE_SIZE)) { +- dev_err(&vdev->dev, +- "block size is changed unexpectedly, now is %u\n", +- blk_size); +- err = -EINVAL; +- goto err_cleanup_disk; +- } +- + /* Use topology information if available */ + err = virtio_cread_feature(vdev, VIRTIO_BLK_F_TOPOLOGY, + struct virtio_blk_config, physical_block_exp, +@@ -905,8 +881,6 @@ static int virtblk_probe(struct virtio_device *vdev) + device_add_disk(&vdev->dev, vblk->disk, virtblk_attr_groups); + return 0; + +-err_cleanup_disk: +- blk_cleanup_disk(vblk->disk); + out_free_tags: + blk_mq_free_tag_set(&vblk->tag_set); + out_free_vq: +@@ -1009,7 +983,6 @@ static struct virtio_driver virtio_blk = { + .driver.name = KBUILD_MODNAME, + .driver.owner = THIS_MODULE, + .id_table = id_table, +- .validate = virtblk_validate, + .probe = virtblk_probe, + .remove = virtblk_remove, + .config_changed = virtblk_config_changed, +diff --git a/drivers/bus/simple-pm-bus.c b/drivers/bus/simple-pm-bus.c +index 01a3d0cd08edc..6b8d6257ed8a4 100644 +--- a/drivers/bus/simple-pm-bus.c ++++ b/drivers/bus/simple-pm-bus.c +@@ -13,11 +13,36 @@ + #include + #include + +- + static int simple_pm_bus_probe(struct platform_device *pdev) + { +- const struct of_dev_auxdata *lookup = dev_get_platdata(&pdev->dev); +- struct device_node *np = pdev->dev.of_node; ++ const struct device *dev = &pdev->dev; ++ const struct of_dev_auxdata *lookup = dev_get_platdata(dev); ++ struct device_node *np = dev->of_node; ++ const struct of_device_id *match; ++ ++ /* ++ * Allow user to use driver_override to bind this driver to a ++ * transparent bus device which has a different compatible string ++ * that's not listed in simple_pm_bus_of_match. We don't want to do any ++ * of the simple-pm-bus tasks for these devices, so return early. ++ */ ++ if (pdev->driver_override) ++ return 0; ++ ++ match = of_match_device(dev->driver->of_match_table, dev); ++ /* ++ * These are transparent bus devices (not simple-pm-bus matches) that ++ * have their child nodes populated automatically. So, don't need to ++ * do anything more. We only match with the device if this driver is ++ * the most specific match because we don't want to incorrectly bind to ++ * a device that has a more specific driver. ++ */ ++ if (match && match->data) { ++ if (of_property_match_string(np, "compatible", match->compatible) == 0) ++ return 0; ++ else ++ return -ENODEV; ++ } + + dev_dbg(&pdev->dev, "%s\n", __func__); + +@@ -31,14 +56,25 @@ static int simple_pm_bus_probe(struct platform_device *pdev) + + static int simple_pm_bus_remove(struct platform_device *pdev) + { ++ const void *data = of_device_get_match_data(&pdev->dev); ++ ++ if (pdev->driver_override || data) ++ return 0; ++ + dev_dbg(&pdev->dev, "%s\n", __func__); + + pm_runtime_disable(&pdev->dev); + return 0; + } + ++#define ONLY_BUS ((void *) 1) /* Match if the device is only a bus. */ ++ + static const struct of_device_id simple_pm_bus_of_match[] = { + { .compatible = "simple-pm-bus", }, ++ { .compatible = "simple-bus", .data = ONLY_BUS }, ++ { .compatible = "simple-mfd", .data = ONLY_BUS }, ++ { .compatible = "isa", .data = ONLY_BUS }, ++ { .compatible = "arm,amba-bus", .data = ONLY_BUS }, + { /* sentinel */ } + }; + MODULE_DEVICE_TABLE(of, simple_pm_bus_of_match); +diff --git a/drivers/clk/renesas/renesas-rzg2l-cpg.c b/drivers/clk/renesas/renesas-rzg2l-cpg.c +index f894a210de902..ab6149b2048b5 100644 +--- a/drivers/clk/renesas/renesas-rzg2l-cpg.c ++++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c +@@ -398,7 +398,7 @@ static int rzg2l_mod_clock_is_enabled(struct clk_hw *hw) + + value = readl(priv->base + CLK_MON_R(clock->off)); + +- return !(value & bitmask); ++ return value & bitmask; + } + + static const struct clk_ops rzg2l_mod_clock_ops = { +diff --git a/drivers/clk/socfpga/clk-agilex.c b/drivers/clk/socfpga/clk-agilex.c +index 242e94c0cf8a3..bf8cd928c2283 100644 +--- a/drivers/clk/socfpga/clk-agilex.c ++++ b/drivers/clk/socfpga/clk-agilex.c +@@ -165,13 +165,6 @@ static const struct clk_parent_data mpu_mux[] = { + .name = "boot_clk", }, + }; + +-static const struct clk_parent_data s2f_usr0_mux[] = { +- { .fw_name = "f2s-free-clk", +- .name = "f2s-free-clk", }, +- { .fw_name = "boot_clk", +- .name = "boot_clk", }, +-}; +- + static const struct clk_parent_data emac_mux[] = { + { .fw_name = "emaca_free_clk", + .name = "emaca_free_clk", }, +@@ -312,8 +305,6 @@ static const struct stratix10_gate_clock agilex_gate_clks[] = { + 4, 0x44, 28, 1, 0, 0, 0}, + { AGILEX_CS_TIMER_CLK, "cs_timer_clk", NULL, noc_mux, ARRAY_SIZE(noc_mux), 0, 0x24, + 5, 0, 0, 0, 0x30, 1, 0}, +- { AGILEX_S2F_USER0_CLK, "s2f_user0_clk", NULL, s2f_usr0_mux, ARRAY_SIZE(s2f_usr0_mux), 0, 0x24, +- 6, 0, 0, 0, 0, 0, 0}, + { AGILEX_EMAC0_CLK, "emac0_clk", NULL, emac_mux, ARRAY_SIZE(emac_mux), 0, 0x7C, + 0, 0, 0, 0, 0x94, 26, 0}, + { AGILEX_EMAC1_CLK, "emac1_clk", NULL, emac_mux, ARRAY_SIZE(emac_mux), 0, 0x7C, +diff --git a/drivers/edac/armada_xp_edac.c b/drivers/edac/armada_xp_edac.c +index e3e757513d1bc..b1f46a974b9e0 100644 +--- a/drivers/edac/armada_xp_edac.c ++++ b/drivers/edac/armada_xp_edac.c +@@ -178,7 +178,7 @@ static void axp_mc_check(struct mem_ctl_info *mci) + "details unavailable (multiple errors)"); + if (cnt_dbe) + edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, +- cnt_sbe, /* error count */ ++ cnt_dbe, /* error count */ + 0, 0, 0, /* pfn, offset, syndrome */ + -1, -1, -1, /* top, mid, low layer */ + mci->ctl_name, +diff --git a/drivers/firmware/arm_ffa/bus.c b/drivers/firmware/arm_ffa/bus.c +index 00fe595a5bc89..fca1e311ea6c7 100644 +--- a/drivers/firmware/arm_ffa/bus.c ++++ b/drivers/firmware/arm_ffa/bus.c +@@ -49,6 +49,15 @@ static int ffa_device_probe(struct device *dev) + return ffa_drv->probe(ffa_dev); + } + ++static int ffa_device_remove(struct device *dev) ++{ ++ struct ffa_driver *ffa_drv = to_ffa_driver(dev->driver); ++ ++ ffa_drv->remove(to_ffa_dev(dev)); ++ ++ return 0; ++} ++ + static int ffa_device_uevent(struct device *dev, struct kobj_uevent_env *env) + { + struct ffa_device *ffa_dev = to_ffa_dev(dev); +@@ -86,6 +95,7 @@ struct bus_type ffa_bus_type = { + .name = "arm_ffa", + .match = ffa_device_match, + .probe = ffa_device_probe, ++ .remove = ffa_device_remove, + .uevent = ffa_device_uevent, + .dev_groups = ffa_device_attributes_groups, + }; +@@ -127,7 +137,7 @@ static void ffa_release_device(struct device *dev) + + static int __ffa_devices_unregister(struct device *dev, void *data) + { +- ffa_release_device(dev); ++ device_unregister(dev); + + return 0; + } +diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c +index ea7ca74fc1730..232c092c4c970 100644 +--- a/drivers/firmware/efi/cper.c ++++ b/drivers/firmware/efi/cper.c +@@ -25,8 +25,6 @@ + #include + #include + +-static char rcd_decode_str[CPER_REC_LEN]; +- + /* + * CPER record ID need to be unique even after reboot, because record + * ID is used as index for ERST storage, while CPER records from +@@ -313,6 +311,7 @@ const char *cper_mem_err_unpack(struct trace_seq *p, + struct cper_mem_err_compact *cmem) + { + const char *ret = trace_seq_buffer_ptr(p); ++ char rcd_decode_str[CPER_REC_LEN]; + + if (cper_mem_err_location(cmem, rcd_decode_str)) + trace_seq_printf(p, "%s", rcd_decode_str); +@@ -327,6 +326,7 @@ static void cper_print_mem(const char *pfx, const struct cper_sec_mem_err *mem, + int len) + { + struct cper_mem_err_compact cmem; ++ char rcd_decode_str[CPER_REC_LEN]; + + /* Don't trust UEFI 2.1/2.2 structure with bad validation bits */ + if (len == sizeof(struct cper_sec_mem_err_old) && +diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c +index 1410beaef5c30..f3e54f6616f02 100644 +--- a/drivers/firmware/efi/runtime-wrappers.c ++++ b/drivers/firmware/efi/runtime-wrappers.c +@@ -414,7 +414,7 @@ static void virt_efi_reset_system(int reset_type, + unsigned long data_size, + efi_char16_t *data) + { +- if (down_interruptible(&efi_runtime_lock)) { ++ if (down_trylock(&efi_runtime_lock)) { + pr_warn("failed to invoke the reset_system() runtime service:\n" + "could not get exclusive access to the firmware\n"); + return; +diff --git a/drivers/fpga/ice40-spi.c b/drivers/fpga/ice40-spi.c +index 69dec5af23c36..029d3cdb918d1 100644 +--- a/drivers/fpga/ice40-spi.c ++++ b/drivers/fpga/ice40-spi.c +@@ -192,12 +192,19 @@ static const struct of_device_id ice40_fpga_of_match[] = { + }; + MODULE_DEVICE_TABLE(of, ice40_fpga_of_match); + ++static const struct spi_device_id ice40_fpga_spi_ids[] = { ++ { .name = "ice40-fpga-mgr", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(spi, ice40_fpga_spi_ids); ++ + static struct spi_driver ice40_fpga_driver = { + .probe = ice40_fpga_probe, + .driver = { + .name = "ice40spi", + .of_match_table = of_match_ptr(ice40_fpga_of_match), + }, ++ .id_table = ice40_fpga_spi_ids, + }; + + module_spi_driver(ice40_fpga_driver); +diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c +index 05637d5851526..4a55cdf089d62 100644 +--- a/drivers/gpio/gpio-74x164.c ++++ b/drivers/gpio/gpio-74x164.c +@@ -174,6 +174,13 @@ static int gen_74x164_remove(struct spi_device *spi) + return 0; + } + ++static const struct spi_device_id gen_74x164_spi_ids[] = { ++ { .name = "74hc595" }, ++ { .name = "74lvc594" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(spi, gen_74x164_spi_ids); ++ + static const struct of_device_id gen_74x164_dt_ids[] = { + { .compatible = "fairchild,74hc595" }, + { .compatible = "nxp,74lvc594" }, +@@ -188,6 +195,7 @@ static struct spi_driver gen_74x164_driver = { + }, + .probe = gen_74x164_probe, + .remove = gen_74x164_remove, ++ .id_table = gen_74x164_spi_ids, + }; + module_spi_driver(gen_74x164_driver); + +diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c +index 8ebf369b3ba0f..d2fe76f3f34fd 100644 +--- a/drivers/gpio/gpio-pca953x.c ++++ b/drivers/gpio/gpio-pca953x.c +@@ -559,21 +559,21 @@ static int pca953x_gpio_set_pull_up_down(struct pca953x_chip *chip, + + mutex_lock(&chip->i2c_lock); + +- /* Disable pull-up/pull-down */ +- ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, 0); +- if (ret) +- goto exit; +- + /* Configure pull-up/pull-down */ + if (config == PIN_CONFIG_BIAS_PULL_UP) + ret = regmap_write_bits(chip->regmap, pull_sel_reg, bit, bit); + else if (config == PIN_CONFIG_BIAS_PULL_DOWN) + ret = regmap_write_bits(chip->regmap, pull_sel_reg, bit, 0); ++ else ++ ret = 0; + if (ret) + goto exit; + +- /* Enable pull-up/pull-down */ +- ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, bit); ++ /* Disable/Enable pull-up/pull-down */ ++ if (config == PIN_CONFIG_BIAS_DISABLE) ++ ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, 0); ++ else ++ ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, bit); + + exit: + mutex_unlock(&chip->i2c_lock); +@@ -587,7 +587,9 @@ static int pca953x_gpio_set_config(struct gpio_chip *gc, unsigned int offset, + + switch (pinconf_to_config_param(config)) { + case PIN_CONFIG_BIAS_PULL_UP: ++ case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT: + case PIN_CONFIG_BIAS_PULL_DOWN: ++ case PIN_CONFIG_BIAS_DISABLE: + return pca953x_gpio_set_pull_up_down(chip, offset, config); + default: + return -ENOTSUPP; +diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c +index 81d5f25242469..1dfb2efac6c25 100644 +--- a/drivers/gpu/drm/drm_edid.c ++++ b/drivers/gpu/drm/drm_edid.c +@@ -1834,11 +1834,20 @@ static void connector_bad_edid(struct drm_connector *connector, + u8 *edid, int num_blocks) + { + int i; +- u8 num_of_ext = edid[0x7e]; ++ u8 last_block; ++ ++ /* ++ * 0x7e in the EDID is the number of extension blocks. The EDID ++ * is 1 (base block) + num_ext_blocks big. That means we can think ++ * of 0x7e in the EDID of the _index_ of the last block in the ++ * combined chunk of memory. ++ */ ++ last_block = edid[0x7e]; + + /* Calculate real checksum for the last edid extension block data */ +- connector->real_edid_checksum = +- drm_edid_block_checksum(edid + num_of_ext * EDID_LENGTH); ++ if (last_block < num_blocks) ++ connector->real_edid_checksum = ++ drm_edid_block_checksum(edid + last_block * EDID_LENGTH); + + if (connector->bad_edid_counter++ && !drm_debug_enabled(DRM_UT_KMS)) + return; +diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c +index d77a24507d309..c2257a761e38e 100644 +--- a/drivers/gpu/drm/drm_fb_helper.c ++++ b/drivers/gpu/drm/drm_fb_helper.c +@@ -1506,6 +1506,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, + { + struct drm_client_dev *client = &fb_helper->client; + struct drm_device *dev = fb_helper->dev; ++ struct drm_mode_config *config = &dev->mode_config; + int ret = 0; + int crtc_count = 0; + struct drm_connector_list_iter conn_iter; +@@ -1663,6 +1664,11 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, + /* Handle our overallocation */ + sizes.surface_height *= drm_fbdev_overalloc; + sizes.surface_height /= 100; ++ if (sizes.surface_height > config->max_height) { ++ drm_dbg_kms(dev, "Fbdev over-allocation too large; clamping height to %d\n", ++ config->max_height); ++ sizes.surface_height = config->max_height; ++ } + + /* push down into drivers */ + ret = (*fb_helper->funcs->fb_probe)(fb_helper, &sizes); +diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c +index 4534633fe7cdb..8fb847c174ff8 100644 +--- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c ++++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c +@@ -571,13 +571,14 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev) + } + + icc_path = devm_of_icc_get(&pdev->dev, "gfx-mem"); +- ret = IS_ERR(icc_path); +- if (ret) ++ if (IS_ERR(icc_path)) { ++ ret = PTR_ERR(icc_path); + goto fail; ++ } + + ocmem_icc_path = devm_of_icc_get(&pdev->dev, "ocmem"); +- ret = IS_ERR(ocmem_icc_path); +- if (ret) { ++ if (IS_ERR(ocmem_icc_path)) { ++ ret = PTR_ERR(ocmem_icc_path); + /* allow -ENODATA, ocmem icc is optional */ + if (ret != -ENODATA) + goto fail; +diff --git a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c +index 82bebb40234de..a96ee79cc5e08 100644 +--- a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c ++++ b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c +@@ -699,13 +699,14 @@ struct msm_gpu *a4xx_gpu_init(struct drm_device *dev) + } + + icc_path = devm_of_icc_get(&pdev->dev, "gfx-mem"); +- ret = IS_ERR(icc_path); +- if (ret) ++ if (IS_ERR(icc_path)) { ++ ret = PTR_ERR(icc_path); + goto fail; ++ } + + ocmem_icc_path = devm_of_icc_get(&pdev->dev, "ocmem"); +- ret = IS_ERR(ocmem_icc_path); +- if (ret) { ++ if (IS_ERR(ocmem_icc_path)) { ++ ret = PTR_ERR(ocmem_icc_path); + /* allow -ENODATA, ocmem icc is optional */ + if (ret != -ENODATA) + goto fail; +diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +index 183b9f9c1b315..1b3519b821a3f 100644 +--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c ++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +@@ -102,7 +102,7 @@ static void a6xx_set_pagetable(struct a6xx_gpu *a6xx_gpu, + u32 asid; + u64 memptr = rbmemptr(ring, ttbr0); + +- if (ctx == a6xx_gpu->cur_ctx) ++ if (ctx->seqno == a6xx_gpu->cur_ctx_seqno) + return; + + if (msm_iommu_pagetable_params(ctx->aspace->mmu, &ttbr, &asid)) +@@ -135,7 +135,7 @@ static void a6xx_set_pagetable(struct a6xx_gpu *a6xx_gpu, + OUT_PKT7(ring, CP_EVENT_WRITE, 1); + OUT_RING(ring, 0x31); + +- a6xx_gpu->cur_ctx = ctx; ++ a6xx_gpu->cur_ctx_seqno = ctx->seqno; + } + + static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) +@@ -1053,7 +1053,7 @@ static int a6xx_hw_init(struct msm_gpu *gpu) + /* Always come up on rb 0 */ + a6xx_gpu->cur_ring = gpu->rb[0]; + +- a6xx_gpu->cur_ctx = NULL; ++ a6xx_gpu->cur_ctx_seqno = 0; + + /* Enable the SQE_to start the CP engine */ + gpu_write(gpu, REG_A6XX_CP_SQE_CNTL, 1); +diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h +index 0bc2d062f54ab..8e5527c881b1e 100644 +--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h ++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h +@@ -19,7 +19,16 @@ struct a6xx_gpu { + uint64_t sqe_iova; + + struct msm_ringbuffer *cur_ring; +- struct msm_file_private *cur_ctx; ++ ++ /** ++ * cur_ctx_seqno: ++ * ++ * The ctx->seqno value of the context with current pgtables ++ * installed. Tracked by seqno rather than pointer value to ++ * avoid dangling pointers, and cases where a ctx can be freed ++ * and a new one created with the same address. ++ */ ++ int cur_ctx_seqno; + + struct a6xx_gmu gmu; + +diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +index f482e0911d039..bb7d066618e64 100644 +--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c ++++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +@@ -1125,6 +1125,20 @@ static void mdp5_crtc_reset(struct drm_crtc *crtc) + __drm_atomic_helper_crtc_reset(crtc, &mdp5_cstate->base); + } + ++static const struct drm_crtc_funcs mdp5_crtc_no_lm_cursor_funcs = { ++ .set_config = drm_atomic_helper_set_config, ++ .destroy = mdp5_crtc_destroy, ++ .page_flip = drm_atomic_helper_page_flip, ++ .reset = mdp5_crtc_reset, ++ .atomic_duplicate_state = mdp5_crtc_duplicate_state, ++ .atomic_destroy_state = mdp5_crtc_destroy_state, ++ .atomic_print_state = mdp5_crtc_atomic_print_state, ++ .get_vblank_counter = mdp5_crtc_get_vblank_counter, ++ .enable_vblank = msm_crtc_enable_vblank, ++ .disable_vblank = msm_crtc_disable_vblank, ++ .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, ++}; ++ + static const struct drm_crtc_funcs mdp5_crtc_funcs = { + .set_config = drm_atomic_helper_set_config, + .destroy = mdp5_crtc_destroy, +@@ -1313,6 +1327,8 @@ struct drm_crtc *mdp5_crtc_init(struct drm_device *dev, + mdp5_crtc->lm_cursor_enabled = cursor_plane ? false : true; + + drm_crtc_init_with_planes(dev, crtc, plane, cursor_plane, ++ cursor_plane ? ++ &mdp5_crtc_no_lm_cursor_funcs : + &mdp5_crtc_funcs, NULL); + + drm_flip_work_init(&mdp5_crtc->unref_cursor_work, +diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c +index 29d11f1cb79b0..4ccf27f66d025 100644 +--- a/drivers/gpu/drm/msm/dsi/dsi.c ++++ b/drivers/gpu/drm/msm/dsi/dsi.c +@@ -208,8 +208,10 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, + goto fail; + } + +- if (!msm_dsi_manager_validate_current_config(msm_dsi->id)) ++ if (!msm_dsi_manager_validate_current_config(msm_dsi->id)) { ++ ret = -EINVAL; + goto fail; ++ } + + msm_dsi->encoder = encoder; + +diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c +index ed504fe5074f6..52826ba350af7 100644 +--- a/drivers/gpu/drm/msm/dsi/dsi_host.c ++++ b/drivers/gpu/drm/msm/dsi/dsi_host.c +@@ -463,7 +463,7 @@ static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host) + + return 0; + err: +- for (; i > 0; i--) ++ while (--i >= 0) + clk_disable_unprepare(msm_host->bus_clks[i]); + + return ret; +diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c +index bb31230721bdd..3e1101451c8ac 100644 +--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c ++++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c +@@ -110,14 +110,13 @@ static struct dsi_pll_14nm *pll_14nm_list[DSI_MAX]; + static bool pll_14nm_poll_for_ready(struct dsi_pll_14nm *pll_14nm, + u32 nb_tries, u32 timeout_us) + { +- bool pll_locked = false; ++ bool pll_locked = false, pll_ready = false; + void __iomem *base = pll_14nm->phy->pll_base; + u32 tries, val; + + tries = nb_tries; + while (tries--) { +- val = dsi_phy_read(base + +- REG_DSI_14nm_PHY_PLL_RESET_SM_READY_STATUS); ++ val = dsi_phy_read(base + REG_DSI_14nm_PHY_PLL_RESET_SM_READY_STATUS); + pll_locked = !!(val & BIT(5)); + + if (pll_locked) +@@ -126,23 +125,24 @@ static bool pll_14nm_poll_for_ready(struct dsi_pll_14nm *pll_14nm, + udelay(timeout_us); + } + +- if (!pll_locked) { +- tries = nb_tries; +- while (tries--) { +- val = dsi_phy_read(base + +- REG_DSI_14nm_PHY_PLL_RESET_SM_READY_STATUS); +- pll_locked = !!(val & BIT(0)); ++ if (!pll_locked) ++ goto out; + +- if (pll_locked) +- break; ++ tries = nb_tries; ++ while (tries--) { ++ val = dsi_phy_read(base + REG_DSI_14nm_PHY_PLL_RESET_SM_READY_STATUS); ++ pll_ready = !!(val & BIT(0)); + +- udelay(timeout_us); +- } ++ if (pll_ready) ++ break; ++ ++ udelay(timeout_us); + } + +- DBG("DSI PLL is %slocked", pll_locked ? "" : "*not* "); ++out: ++ DBG("DSI PLL is %slocked, %sready", pll_locked ? "" : "*not* ", pll_ready ? "" : "*not* "); + +- return pll_locked; ++ return pll_locked && pll_ready; + } + + static void dsi_pll_14nm_config_init(struct dsi_pll_config *pconf) +diff --git a/drivers/gpu/drm/msm/edp/edp_ctrl.c b/drivers/gpu/drm/msm/edp/edp_ctrl.c +index 4fb397ee7c842..fe1366b4c49f5 100644 +--- a/drivers/gpu/drm/msm/edp/edp_ctrl.c ++++ b/drivers/gpu/drm/msm/edp/edp_ctrl.c +@@ -1116,7 +1116,7 @@ void msm_edp_ctrl_power(struct edp_ctrl *ctrl, bool on) + int msm_edp_ctrl_init(struct msm_edp *edp) + { + struct edp_ctrl *ctrl = NULL; +- struct device *dev = &edp->pdev->dev; ++ struct device *dev; + int ret; + + if (!edp) { +@@ -1124,6 +1124,7 @@ int msm_edp_ctrl_init(struct msm_edp *edp) + return -EINVAL; + } + ++ dev = &edp->pdev->dev; + ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + if (!ctrl) + return -ENOMEM; +diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c +index 729ab68d02034..bcb24810905fd 100644 +--- a/drivers/gpu/drm/msm/msm_drv.c ++++ b/drivers/gpu/drm/msm/msm_drv.c +@@ -566,10 +566,11 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) + if (ret) + goto err_msm_uninit; + +- ret = msm_disp_snapshot_init(ddev); +- if (ret) +- DRM_DEV_ERROR(dev, "msm_disp_snapshot_init failed ret = %d\n", ret); +- ++ if (kms) { ++ ret = msm_disp_snapshot_init(ddev); ++ if (ret) ++ DRM_DEV_ERROR(dev, "msm_disp_snapshot_init failed ret = %d\n", ret); ++ } + drm_mode_config_reset(ddev); + + #ifdef CONFIG_DRM_FBDEV_EMULATION +@@ -618,6 +619,7 @@ static void load_gpu(struct drm_device *dev) + + static int context_init(struct drm_device *dev, struct drm_file *file) + { ++ static atomic_t ident = ATOMIC_INIT(0); + struct msm_drm_private *priv = dev->dev_private; + struct msm_file_private *ctx; + +@@ -631,6 +633,8 @@ static int context_init(struct drm_device *dev, struct drm_file *file) + ctx->aspace = msm_gpu_create_private_address_space(priv->gpu, current); + file->driver_priv = ctx; + ++ ctx->seqno = atomic_inc_return(&ident); ++ + return 0; + } + +diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h +index 1a48a709ffb36..183d837dcea32 100644 +--- a/drivers/gpu/drm/msm/msm_drv.h ++++ b/drivers/gpu/drm/msm/msm_drv.h +@@ -59,6 +59,7 @@ struct msm_file_private { + int queueid; + struct msm_gem_address_space *aspace; + struct kref ref; ++ int seqno; + }; + + enum msm_mdp_plane_property { +@@ -535,7 +536,7 @@ static inline int align_pitch(int width, int bpp) + static inline unsigned long timeout_to_jiffies(const ktime_t *timeout) + { + ktime_t now = ktime_get(); +- unsigned long remaining_jiffies; ++ s64 remaining_jiffies; + + if (ktime_compare(*timeout, now) < 0) { + remaining_jiffies = 0; +@@ -544,7 +545,7 @@ static inline unsigned long timeout_to_jiffies(const ktime_t *timeout) + remaining_jiffies = ktime_divns(rem, NSEC_PER_SEC / HZ); + } + +- return remaining_jiffies; ++ return clamp(remaining_jiffies, 0LL, (s64)INT_MAX); + } + + #endif /* __MSM_DRV_H__ */ +diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c +index 44f84bfd0c0e7..a10b79f9729ef 100644 +--- a/drivers/gpu/drm/msm/msm_gem_submit.c ++++ b/drivers/gpu/drm/msm/msm_gem_submit.c +@@ -161,7 +161,8 @@ out: + static int submit_lookup_cmds(struct msm_gem_submit *submit, + struct drm_msm_gem_submit *args, struct drm_file *file) + { +- unsigned i, sz; ++ unsigned i; ++ size_t sz; + int ret = 0; + + for (i = 0; i < args->nr_cmds; i++) { +diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/chang84.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/chang84.c +index 353b77d9b3dcf..3492c561f2cfc 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/chang84.c ++++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/chang84.c +@@ -82,7 +82,7 @@ g84_fifo_chan_engine_fini(struct nvkm_fifo_chan *base, + if (offset < 0) + return 0; + +- engn = fifo->base.func->engine_id(&fifo->base, engine); ++ engn = fifo->base.func->engine_id(&fifo->base, engine) - 1; + save = nvkm_mask(device, 0x002520, 0x0000003f, 1 << engn); + nvkm_wr32(device, 0x0032fc, chan->base.inst->addr >> 12); + done = nvkm_msec(device, 2000, +diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig +index ef87d92cdf496..a9c8e05355aa6 100644 +--- a/drivers/gpu/drm/panel/Kconfig ++++ b/drivers/gpu/drm/panel/Kconfig +@@ -273,6 +273,7 @@ config DRM_PANEL_OLIMEX_LCD_OLINUXINO + depends on OF + depends on I2C + depends on BACKLIGHT_CLASS_DEVICE ++ select CRC32 + help + The panel is used with different sizes LCDs, from 480x272 to + 1280x800, and 24 bit per pixel. +diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c +index 0019f1ea7df27..f41db9e0249a7 100644 +--- a/drivers/iio/accel/fxls8962af-core.c ++++ b/drivers/iio/accel/fxls8962af-core.c +@@ -738,7 +738,7 @@ static irqreturn_t fxls8962af_interrupt(int irq, void *p) + + if (reg & FXLS8962AF_INT_STATUS_SRC_BUF) { + ret = fxls8962af_fifo_flush(indio_dev); +- if (ret) ++ if (ret < 0) + return IRQ_NONE; + + return IRQ_HANDLED; +diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c +index ee8ed9481025d..2121a812b0c31 100644 +--- a/drivers/iio/adc/ad7192.c ++++ b/drivers/iio/adc/ad7192.c +@@ -293,6 +293,7 @@ static const struct ad_sigma_delta_info ad7192_sigma_delta_info = { + .has_registers = true, + .addr_shift = 3, + .read_mask = BIT(6), ++ .irq_flags = IRQF_TRIGGER_FALLING, + }; + + static const struct ad_sd_calib_data ad7192_calib_arr[8] = { +diff --git a/drivers/iio/adc/ad7780.c b/drivers/iio/adc/ad7780.c +index 42bb952f47388..b6e8c8abf6f4c 100644 +--- a/drivers/iio/adc/ad7780.c ++++ b/drivers/iio/adc/ad7780.c +@@ -203,7 +203,7 @@ static const struct ad_sigma_delta_info ad7780_sigma_delta_info = { + .set_mode = ad7780_set_mode, + .postprocess_sample = ad7780_postprocess_sample, + .has_registers = false, +- .irq_flags = IRQF_TRIGGER_LOW, ++ .irq_flags = IRQF_TRIGGER_FALLING, + }; + + #define _AD7780_CHANNEL(_bits, _wordsize, _mask_all) \ +diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c +index ef3e2d3ecb0c6..0e7ab3fb072a9 100644 +--- a/drivers/iio/adc/ad7793.c ++++ b/drivers/iio/adc/ad7793.c +@@ -206,7 +206,7 @@ static const struct ad_sigma_delta_info ad7793_sigma_delta_info = { + .has_registers = true, + .addr_shift = 3, + .read_mask = BIT(6), +- .irq_flags = IRQF_TRIGGER_LOW, ++ .irq_flags = IRQF_TRIGGER_FALLING, + }; + + static const struct ad_sd_calib_data ad7793_calib_arr[6] = { +diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c +index 19efaa41bc344..34ec0c28b2dff 100644 +--- a/drivers/iio/adc/aspeed_adc.c ++++ b/drivers/iio/adc/aspeed_adc.c +@@ -183,6 +183,7 @@ static int aspeed_adc_probe(struct platform_device *pdev) + + data = iio_priv(indio_dev); + data->dev = &pdev->dev; ++ platform_set_drvdata(pdev, indio_dev); + + data->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(data->base)) +diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c +index 655ab02d03d84..b753658bb41ec 100644 +--- a/drivers/iio/adc/max1027.c ++++ b/drivers/iio/adc/max1027.c +@@ -103,7 +103,7 @@ MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids); + .sign = 'u', \ + .realbits = depth, \ + .storagebits = 16, \ +- .shift = 2, \ ++ .shift = (depth == 10) ? 2 : 0, \ + .endianness = IIO_BE, \ + }, \ + } +@@ -142,7 +142,6 @@ MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids); + MAX1027_V_CHAN(11, depth) + + #define MAX1X31_CHANNELS(depth) \ +- MAX1X27_CHANNELS(depth), \ + MAX1X29_CHANNELS(depth), \ + MAX1027_V_CHAN(12, depth), \ + MAX1027_V_CHAN(13, depth), \ +diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c +index 79c1dd68b9092..d4fccd52ef08b 100644 +--- a/drivers/iio/adc/mt6577_auxadc.c ++++ b/drivers/iio/adc/mt6577_auxadc.c +@@ -82,6 +82,10 @@ static const struct iio_chan_spec mt6577_auxadc_iio_channels[] = { + MT6577_AUXADC_CHANNEL(15), + }; + ++/* For Voltage calculation */ ++#define VOLTAGE_FULL_RANGE 1500 /* VA voltage */ ++#define AUXADC_PRECISE 4096 /* 12 bits */ ++ + static int mt_auxadc_get_cali_data(int rawdata, bool enable_cali) + { + return rawdata; +@@ -191,6 +195,10 @@ static int mt6577_auxadc_read_raw(struct iio_dev *indio_dev, + } + if (adc_dev->dev_comp->sample_data_cali) + *val = mt_auxadc_get_cali_data(*val, true); ++ ++ /* Convert adc raw data to voltage: 0 - 1500 mV */ ++ *val = *val * VOLTAGE_FULL_RANGE / AUXADC_PRECISE; ++ + return IIO_VAL_INT; + + default: +diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c +index 3143f35a6509a..83c1ae07b3e9a 100644 +--- a/drivers/iio/adc/ti-adc128s052.c ++++ b/drivers/iio/adc/ti-adc128s052.c +@@ -171,7 +171,13 @@ static int adc128_probe(struct spi_device *spi) + mutex_init(&adc->lock); + + ret = iio_device_register(indio_dev); ++ if (ret) ++ goto err_disable_regulator; + ++ return 0; ++ ++err_disable_regulator: ++ regulator_disable(adc->reg); + return ret; + } + +diff --git a/drivers/iio/common/ssp_sensors/ssp_spi.c b/drivers/iio/common/ssp_sensors/ssp_spi.c +index 4864c38b8d1c2..769bd9280524a 100644 +--- a/drivers/iio/common/ssp_sensors/ssp_spi.c ++++ b/drivers/iio/common/ssp_sensors/ssp_spi.c +@@ -137,7 +137,7 @@ static int ssp_print_mcu_debug(char *data_frame, int *data_index, + if (length > received_len - *data_index || length <= 0) { + ssp_dbg("[SSP]: MSG From MCU-invalid debug length(%d/%d)\n", + length, received_len); +- return length ? length : -EPROTO; ++ return -EPROTO; + } + + ssp_dbg("[SSP]: MSG From MCU - %s\n", &data_frame[*data_index]); +@@ -273,6 +273,8 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len) + for (idx = 0; idx < len;) { + switch (dataframe[idx++]) { + case SSP_MSG2AP_INST_BYPASS_DATA: ++ if (idx >= len) ++ return -EPROTO; + sd = dataframe[idx++]; + if (sd < 0 || sd >= SSP_SENSOR_MAX) { + dev_err(SSP_DEV, +@@ -282,10 +284,13 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len) + + if (indio_devs[sd]) { + spd = iio_priv(indio_devs[sd]); +- if (spd->process_data) ++ if (spd->process_data) { ++ if (idx >= len) ++ return -EPROTO; + spd->process_data(indio_devs[sd], + &dataframe[idx], + data->timestamp); ++ } + } else { + dev_err(SSP_DEV, "no client for frame\n"); + } +@@ -293,6 +298,8 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len) + idx += ssp_offset_map[sd]; + break; + case SSP_MSG2AP_INST_DEBUG_DATA: ++ if (idx >= len) ++ return -EPROTO; + sd = ssp_print_mcu_debug(dataframe, &idx, len); + if (sd) { + dev_err(SSP_DEV, +diff --git a/drivers/iio/dac/ti-dac5571.c b/drivers/iio/dac/ti-dac5571.c +index 2a5ba1b08a1d0..546a4cf6c5ef8 100644 +--- a/drivers/iio/dac/ti-dac5571.c ++++ b/drivers/iio/dac/ti-dac5571.c +@@ -350,6 +350,7 @@ static int dac5571_probe(struct i2c_client *client, + data->dac5571_pwrdwn = dac5571_pwrdwn_quad; + break; + default: ++ ret = -EINVAL; + goto err; + } + +diff --git a/drivers/iio/imu/adis16475.c b/drivers/iio/imu/adis16475.c +index eb48102f94243..287fff39a927a 100644 +--- a/drivers/iio/imu/adis16475.c ++++ b/drivers/iio/imu/adis16475.c +@@ -353,10 +353,11 @@ static int adis16475_set_freq(struct adis16475 *st, const u32 freq) + if (dec > st->info->max_dec) + dec = st->info->max_dec; + +- ret = adis_write_reg_16(&st->adis, ADIS16475_REG_DEC_RATE, dec); ++ ret = __adis_write_reg_16(&st->adis, ADIS16475_REG_DEC_RATE, dec); + if (ret) + goto error; + ++ adis_dev_unlock(&st->adis); + /* + * If decimation is used, then gyro and accel data will have meaningful + * bits on the LSB registers. This info is used on the trigger handler. +diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c +index a869a6e52a16b..ed129321a14da 100644 +--- a/drivers/iio/imu/adis16480.c ++++ b/drivers/iio/imu/adis16480.c +@@ -144,6 +144,7 @@ struct adis16480_chip_info { + unsigned int max_dec_rate; + const unsigned int *filter_freqs; + bool has_pps_clk_mode; ++ bool has_sleep_cnt; + const struct adis_data adis_data; + }; + +@@ -939,6 +940,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { + .temp_scale = 5650, /* 5.65 milli degree Celsius */ + .int_clk = 2460000, + .max_dec_rate = 2048, ++ .has_sleep_cnt = true, + .filter_freqs = adis16480_def_filter_freqs, + .adis_data = ADIS16480_DATA(16375, &adis16485_timeouts, 0), + }, +@@ -952,6 +954,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { + .temp_scale = 5650, /* 5.65 milli degree Celsius */ + .int_clk = 2460000, + .max_dec_rate = 2048, ++ .has_sleep_cnt = true, + .filter_freqs = adis16480_def_filter_freqs, + .adis_data = ADIS16480_DATA(16480, &adis16480_timeouts, 0), + }, +@@ -965,6 +968,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { + .temp_scale = 5650, /* 5.65 milli degree Celsius */ + .int_clk = 2460000, + .max_dec_rate = 2048, ++ .has_sleep_cnt = true, + .filter_freqs = adis16480_def_filter_freqs, + .adis_data = ADIS16480_DATA(16485, &adis16485_timeouts, 0), + }, +@@ -978,6 +982,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { + .temp_scale = 5650, /* 5.65 milli degree Celsius */ + .int_clk = 2460000, + .max_dec_rate = 2048, ++ .has_sleep_cnt = true, + .filter_freqs = adis16480_def_filter_freqs, + .adis_data = ADIS16480_DATA(16488, &adis16485_timeouts, 0), + }, +@@ -1425,9 +1430,12 @@ static int adis16480_probe(struct spi_device *spi) + if (ret) + return ret; + +- ret = devm_add_action_or_reset(&spi->dev, adis16480_stop, indio_dev); +- if (ret) +- return ret; ++ if (st->chip_info->has_sleep_cnt) { ++ ret = devm_add_action_or_reset(&spi->dev, adis16480_stop, ++ indio_dev); ++ if (ret) ++ return ret; ++ } + + ret = adis16480_config_irq_pin(spi->dev.of_node, st); + if (ret) +diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c +index 52963da401a78..1880bd5bb2586 100644 +--- a/drivers/iio/light/opt3001.c ++++ b/drivers/iio/light/opt3001.c +@@ -276,6 +276,8 @@ static int opt3001_get_lux(struct opt3001 *opt, int *val, int *val2) + ret = wait_event_timeout(opt->result_ready_queue, + opt->result_ready, + msecs_to_jiffies(OPT3001_RESULT_READY_LONG)); ++ if (ret == 0) ++ return -ETIMEDOUT; + } else { + /* Sleep for result ready time */ + timeout = (opt->int_time == OPT3001_INT_TIME_SHORT) ? +@@ -312,9 +314,7 @@ err: + /* Disallow IRQ to access the device while lock is active */ + opt->ok_to_ignore_lock = false; + +- if (ret == 0) +- return -ETIMEDOUT; +- else if (ret < 0) ++ if (ret < 0) + return ret; + + if (opt->use_irq) { +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c +index 29de8412e4165..4c914f75a9027 100644 +--- a/drivers/input/joystick/xpad.c ++++ b/drivers/input/joystick/xpad.c +@@ -334,6 +334,7 @@ static const struct xpad_device { + { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, + { 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, ++ { 0x3285, 0x0607, "Nacon GC-100", 0, XTYPE_XBOX360 }, + { 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX }, + { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, + { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } +@@ -451,6 +452,7 @@ static const struct usb_device_id xpad_table[] = { + XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ + XPAD_XBOXONE_VENDOR(0x2e24), /* Hyperkin Duke X-Box One pad */ + XPAD_XBOX360_VENDOR(0x2f24), /* GameSir Controllers */ ++ XPAD_XBOX360_VENDOR(0x3285), /* Nacon GC-100 */ + { } + }; + +diff --git a/drivers/input/touchscreen/resistive-adc-touch.c b/drivers/input/touchscreen/resistive-adc-touch.c +index 744544a723b77..6f754a8d30b11 100644 +--- a/drivers/input/touchscreen/resistive-adc-touch.c ++++ b/drivers/input/touchscreen/resistive-adc-touch.c +@@ -71,19 +71,22 @@ static int grts_cb(const void *data, void *private) + unsigned int z2 = touch_info[st->ch_map[GRTS_CH_Z2]]; + unsigned int Rt; + +- Rt = z2; +- Rt -= z1; +- Rt *= st->x_plate_ohms; +- Rt = DIV_ROUND_CLOSEST(Rt, 16); +- Rt *= x; +- Rt /= z1; +- Rt = DIV_ROUND_CLOSEST(Rt, 256); +- /* +- * On increased pressure the resistance (Rt) is decreasing +- * so, convert values to make it looks as real pressure. +- */ +- if (Rt < GRTS_DEFAULT_PRESSURE_MAX) +- press = GRTS_DEFAULT_PRESSURE_MAX - Rt; ++ if (likely(x && z1)) { ++ Rt = z2; ++ Rt -= z1; ++ Rt *= st->x_plate_ohms; ++ Rt = DIV_ROUND_CLOSEST(Rt, 16); ++ Rt *= x; ++ Rt /= z1; ++ Rt = DIV_ROUND_CLOSEST(Rt, 256); ++ /* ++ * On increased pressure the resistance (Rt) is ++ * decreasing so, convert values to make it looks as ++ * real pressure. ++ */ ++ if (Rt < GRTS_DEFAULT_PRESSURE_MAX) ++ press = GRTS_DEFAULT_PRESSURE_MAX - Rt; ++ } + } + + if ((!x && !y) || (st->pressure && (press < st->pressure_min))) { +diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c +index 0dbd48cbdff95..231efbe38c214 100644 +--- a/drivers/md/dm-rq.c ++++ b/drivers/md/dm-rq.c +@@ -490,6 +490,14 @@ static blk_status_t dm_mq_queue_rq(struct blk_mq_hw_ctx *hctx, + struct mapped_device *md = tio->md; + struct dm_target *ti = md->immutable_target; + ++ /* ++ * blk-mq's unquiesce may come from outside events, such as ++ * elevator switch, updating nr_requests or others, and request may ++ * come during suspend, so simply ask for blk-mq to requeue it. ++ */ ++ if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags))) ++ return BLK_STS_RESOURCE; ++ + if (unlikely(!ti)) { + int srcu_idx; + struct dm_table *map = dm_get_live_table(md, &srcu_idx); +diff --git a/drivers/md/dm.c b/drivers/md/dm.c +index 2c5f9e5852117..bb895430981f2 100644 +--- a/drivers/md/dm.c ++++ b/drivers/md/dm.c +@@ -492,18 +492,17 @@ static void start_io_acct(struct dm_io *io) + false, 0, &io->stats_aux); + } + +-static void end_io_acct(struct dm_io *io) ++static void end_io_acct(struct mapped_device *md, struct bio *bio, ++ unsigned long start_time, struct dm_stats_aux *stats_aux) + { +- struct mapped_device *md = io->md; +- struct bio *bio = io->orig_bio; +- unsigned long duration = jiffies - io->start_time; ++ unsigned long duration = jiffies - start_time; + +- bio_end_io_acct(bio, io->start_time); ++ bio_end_io_acct(bio, start_time); + + if (unlikely(dm_stats_used(&md->stats))) + dm_stats_account_io(&md->stats, bio_data_dir(bio), + bio->bi_iter.bi_sector, bio_sectors(bio), +- true, duration, &io->stats_aux); ++ true, duration, stats_aux); + + /* nudge anyone waiting on suspend queue */ + if (unlikely(wq_has_sleeper(&md->wait))) +@@ -786,6 +785,8 @@ void dm_io_dec_pending(struct dm_io *io, blk_status_t error) + blk_status_t io_error; + struct bio *bio; + struct mapped_device *md = io->md; ++ unsigned long start_time = 0; ++ struct dm_stats_aux stats_aux; + + /* Push-back supersedes any I/O errors */ + if (unlikely(error)) { +@@ -817,8 +818,10 @@ void dm_io_dec_pending(struct dm_io *io, blk_status_t error) + } + + io_error = io->status; +- end_io_acct(io); ++ start_time = io->start_time; ++ stats_aux = io->stats_aux; + free_io(md, io); ++ end_io_acct(md, bio, start_time, &stats_aux); + + if (io_error == BLK_STS_DM_REQUEUE) + return; +diff --git a/drivers/misc/cb710/sgbuf2.c b/drivers/misc/cb710/sgbuf2.c +index e5a4ed3701eb8..a798fad5f03c2 100644 +--- a/drivers/misc/cb710/sgbuf2.c ++++ b/drivers/misc/cb710/sgbuf2.c +@@ -47,7 +47,7 @@ static inline bool needs_unaligned_copy(const void *ptr) + #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS + return false; + #else +- return ((ptr - NULL) & 3) != 0; ++ return ((uintptr_t)ptr & 3) != 0; + #endif + } + +diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c +index 4d09b672ac3c8..632325474233a 100644 +--- a/drivers/misc/eeprom/at25.c ++++ b/drivers/misc/eeprom/at25.c +@@ -366,6 +366,13 @@ static const struct of_device_id at25_of_match[] = { + }; + MODULE_DEVICE_TABLE(of, at25_of_match); + ++static const struct spi_device_id at25_spi_ids[] = { ++ { .name = "at25",}, ++ { .name = "fm25",}, ++ { } ++}; ++MODULE_DEVICE_TABLE(spi, at25_spi_ids); ++ + static int at25_probe(struct spi_device *spi) + { + struct at25_data *at25 = NULL; +@@ -491,6 +498,7 @@ static struct spi_driver at25_driver = { + .dev_groups = sernum_groups, + }, + .probe = at25_probe, ++ .id_table = at25_spi_ids, + }; + + module_spi_driver(at25_driver); +diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c +index 29d8971ec558b..1f15399e5cb49 100644 +--- a/drivers/misc/eeprom/eeprom_93xx46.c ++++ b/drivers/misc/eeprom/eeprom_93xx46.c +@@ -406,6 +406,23 @@ static const struct of_device_id eeprom_93xx46_of_table[] = { + }; + MODULE_DEVICE_TABLE(of, eeprom_93xx46_of_table); + ++static const struct spi_device_id eeprom_93xx46_spi_ids[] = { ++ { .name = "eeprom-93xx46", ++ .driver_data = (kernel_ulong_t)&at93c46_data, }, ++ { .name = "at93c46", ++ .driver_data = (kernel_ulong_t)&at93c46_data, }, ++ { .name = "at93c46d", ++ .driver_data = (kernel_ulong_t)&atmel_at93c46d_data, }, ++ { .name = "at93c56", ++ .driver_data = (kernel_ulong_t)&at93c56_data, }, ++ { .name = "at93c66", ++ .driver_data = (kernel_ulong_t)&at93c66_data, }, ++ { .name = "93lc46b", ++ .driver_data = (kernel_ulong_t)µchip_93lc46b_data, }, ++ {} ++}; ++MODULE_DEVICE_TABLE(spi, eeprom_93xx46_spi_ids); ++ + static int eeprom_93xx46_probe_dt(struct spi_device *spi) + { + const struct of_device_id *of_id = +@@ -555,6 +572,7 @@ static struct spi_driver eeprom_93xx46_driver = { + }, + .probe = eeprom_93xx46_probe, + .remove = eeprom_93xx46_remove, ++ .id_table = eeprom_93xx46_spi_ids, + }; + + module_spi_driver(eeprom_93xx46_driver); +diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c +index beda610e6b30d..ad6ced4546556 100644 +--- a/drivers/misc/fastrpc.c ++++ b/drivers/misc/fastrpc.c +@@ -814,10 +814,12 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx) + rpra[i].pv = (u64) ctx->args[i].ptr; + pages[i].addr = ctx->maps[i]->phys; + ++ mmap_read_lock(current->mm); + vma = find_vma(current->mm, ctx->args[i].ptr); + if (vma) + pages[i].addr += ctx->args[i].ptr - + vma->vm_start; ++ mmap_read_unlock(current->mm); + + pg_start = (ctx->args[i].ptr & PAGE_MASK) >> PAGE_SHIFT; + pg_end = ((ctx->args[i].ptr + len - 1) & PAGE_MASK) >> +diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c +index 99b5c1ecc4441..be41843df75bc 100644 +--- a/drivers/misc/mei/hbm.c ++++ b/drivers/misc/mei/hbm.c +@@ -1298,7 +1298,8 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) + + if (dev->dev_state != MEI_DEV_INIT_CLIENTS || + dev->hbm_state != MEI_HBM_STARTING) { +- if (dev->dev_state == MEI_DEV_POWER_DOWN) { ++ if (dev->dev_state == MEI_DEV_POWER_DOWN || ++ dev->dev_state == MEI_DEV_POWERING_DOWN) { + dev_dbg(dev->dev, "hbm: start: on shutdown, ignoring\n"); + return 0; + } +@@ -1381,7 +1382,8 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) + + if (dev->dev_state != MEI_DEV_INIT_CLIENTS || + dev->hbm_state != MEI_HBM_DR_SETUP) { +- if (dev->dev_state == MEI_DEV_POWER_DOWN) { ++ if (dev->dev_state == MEI_DEV_POWER_DOWN || ++ dev->dev_state == MEI_DEV_POWERING_DOWN) { + dev_dbg(dev->dev, "hbm: dma setup response: on shutdown, ignoring\n"); + return 0; + } +@@ -1448,7 +1450,8 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) + + if (dev->dev_state != MEI_DEV_INIT_CLIENTS || + dev->hbm_state != MEI_HBM_CLIENT_PROPERTIES) { +- if (dev->dev_state == MEI_DEV_POWER_DOWN) { ++ if (dev->dev_state == MEI_DEV_POWER_DOWN || ++ dev->dev_state == MEI_DEV_POWERING_DOWN) { + dev_dbg(dev->dev, "hbm: properties response: on shutdown, ignoring\n"); + return 0; + } +@@ -1490,7 +1493,8 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) + + if (dev->dev_state != MEI_DEV_INIT_CLIENTS || + dev->hbm_state != MEI_HBM_ENUM_CLIENTS) { +- if (dev->dev_state == MEI_DEV_POWER_DOWN) { ++ if (dev->dev_state == MEI_DEV_POWER_DOWN || ++ dev->dev_state == MEI_DEV_POWERING_DOWN) { + dev_dbg(dev->dev, "hbm: enumeration response: on shutdown, ignoring\n"); + return 0; + } +diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h +index cb34925e10f15..67bb6a25fd0a0 100644 +--- a/drivers/misc/mei/hw-me-regs.h ++++ b/drivers/misc/mei/hw-me-regs.h +@@ -92,6 +92,7 @@ + #define MEI_DEV_ID_CDF 0x18D3 /* Cedar Fork */ + + #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */ ++#define MEI_DEV_ID_ICP_N 0x38E0 /* Ice Lake Point N */ + + #define MEI_DEV_ID_JSP_N 0x4DE0 /* Jasper Lake Point N */ + +diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c +index c3393b383e598..3a45aaf002ac8 100644 +--- a/drivers/misc/mei/pci-me.c ++++ b/drivers/misc/mei/pci-me.c +@@ -96,6 +96,7 @@ static const struct pci_device_id mei_me_pci_tbl[] = { + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_H_3, MEI_ME_PCH8_ITOUCH_CFG)}, + + {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)}, ++ {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_N, MEI_ME_PCH12_CFG)}, + + {MEI_PCI_DEVICE(MEI_DEV_ID_TGP_LP, MEI_ME_PCH15_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_TGP_H, MEI_ME_PCH15_SPS_CFG)}, +diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c +index ef0badea4f415..04e6f7b267064 100644 +--- a/drivers/mtd/nand/raw/qcom_nandc.c ++++ b/drivers/mtd/nand/raw/qcom_nandc.c +@@ -1676,13 +1676,17 @@ qcom_nandc_read_cw_raw(struct mtd_info *mtd, struct nand_chip *chip, + struct nand_ecc_ctrl *ecc = &chip->ecc; + int data_size1, data_size2, oob_size1, oob_size2; + int ret, reg_off = FLASH_BUF_ACC, read_loc = 0; ++ int raw_cw = cw; + + nand_read_page_op(chip, page, 0, NULL, 0); + host->use_ecc = false; + ++ if (nandc->props->qpic_v2) ++ raw_cw = ecc->steps - 1; ++ + clear_bam_transaction(nandc); + set_address(host, host->cw_size * cw, page); +- update_rw_regs(host, 1, true, cw); ++ update_rw_regs(host, 1, true, raw_cw); + config_nand_page_read(chip); + + data_size1 = mtd->writesize - host->cw_size * (ecc->steps - 1); +@@ -1711,7 +1715,7 @@ qcom_nandc_read_cw_raw(struct mtd_info *mtd, struct nand_chip *chip, + nandc_set_read_loc(chip, cw, 3, read_loc, oob_size2, 1); + } + +- config_nand_cw_read(chip, false, cw); ++ config_nand_cw_read(chip, false, raw_cw); + + read_data_dma(nandc, reg_off, data_buf, data_size1, 0); + reg_off += data_size1; +diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c +index 1542bfb8b5e54..7c2968a639eba 100644 +--- a/drivers/net/dsa/microchip/ksz_common.c ++++ b/drivers/net/dsa/microchip/ksz_common.c +@@ -449,8 +449,10 @@ EXPORT_SYMBOL(ksz_switch_register); + void ksz_switch_remove(struct ksz_device *dev) + { + /* timer started */ +- if (dev->mib_read_interval) ++ if (dev->mib_read_interval) { ++ dev->mib_read_interval = 0; + cancel_delayed_work_sync(&dev->mib_read); ++ } + + dev->dev_ops->exit(dev); + dsa_unregister_switch(dev->ds); +diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c +index 66b4f4a9832a4..f5b2e5e87da43 100644 +--- a/drivers/net/dsa/mv88e6xxx/chip.c ++++ b/drivers/net/dsa/mv88e6xxx/chip.c +@@ -749,7 +749,11 @@ static void mv88e6xxx_mac_link_down(struct dsa_switch *ds, int port, + ops = chip->info->ops; + + mv88e6xxx_reg_lock(chip); +- if ((!mv88e6xxx_port_ppu_updates(chip, port) || ++ /* Internal PHYs propagate their configuration directly to the MAC. ++ * External PHYs depend on whether the PPU is enabled for this port. ++ */ ++ if (((!mv88e6xxx_phy_is_internal(ds, port) && ++ !mv88e6xxx_port_ppu_updates(chip, port)) || + mode == MLO_AN_FIXED) && ops->port_sync_link) + err = ops->port_sync_link(chip, port, mode, false); + mv88e6xxx_reg_unlock(chip); +@@ -772,7 +776,12 @@ static void mv88e6xxx_mac_link_up(struct dsa_switch *ds, int port, + ops = chip->info->ops; + + mv88e6xxx_reg_lock(chip); +- if (!mv88e6xxx_port_ppu_updates(chip, port) || mode == MLO_AN_FIXED) { ++ /* Internal PHYs propagate their configuration directly to the MAC. ++ * External PHYs depend on whether the PPU is enabled for this port. ++ */ ++ if ((!mv88e6xxx_phy_is_internal(ds, port) && ++ !mv88e6xxx_port_ppu_updates(chip, port)) || ++ mode == MLO_AN_FIXED) { + /* FIXME: for an automedia port, should we force the link + * down here - what if the link comes up due to "other" media + * while we're bringing the port up, how is the exclusivity +diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c +index a2a15919b9606..0ba3762d5c219 100644 +--- a/drivers/net/dsa/ocelot/felix.c ++++ b/drivers/net/dsa/ocelot/felix.c +@@ -271,12 +271,12 @@ static void felix_8021q_cpu_port_deinit(struct ocelot *ocelot, int port) + */ + static int felix_setup_mmio_filtering(struct felix *felix) + { +- unsigned long user_ports = 0, cpu_ports = 0; ++ unsigned long user_ports = dsa_user_ports(felix->ds); + struct ocelot_vcap_filter *redirect_rule; + struct ocelot_vcap_filter *tagging_rule; + struct ocelot *ocelot = &felix->ocelot; + struct dsa_switch *ds = felix->ds; +- int port, ret; ++ int cpu = -1, port, ret; + + tagging_rule = kzalloc(sizeof(struct ocelot_vcap_filter), GFP_KERNEL); + if (!tagging_rule) +@@ -289,12 +289,15 @@ static int felix_setup_mmio_filtering(struct felix *felix) + } + + for (port = 0; port < ocelot->num_phys_ports; port++) { +- if (dsa_is_user_port(ds, port)) +- user_ports |= BIT(port); +- if (dsa_is_cpu_port(ds, port)) +- cpu_ports |= BIT(port); ++ if (dsa_is_cpu_port(ds, port)) { ++ cpu = port; ++ break; ++ } + } + ++ if (cpu < 0) ++ return -EINVAL; ++ + tagging_rule->key_type = OCELOT_VCAP_KEY_ETYPE; + *(__be16 *)tagging_rule->key.etype.etype.value = htons(ETH_P_1588); + *(__be16 *)tagging_rule->key.etype.etype.mask = htons(0xffff); +@@ -330,7 +333,7 @@ static int felix_setup_mmio_filtering(struct felix *felix) + * the CPU port module + */ + redirect_rule->action.mask_mode = OCELOT_MASK_MODE_REDIRECT; +- redirect_rule->action.port_mask = cpu_ports; ++ redirect_rule->action.port_mask = BIT(cpu); + } else { + /* Trap PTP packets only to the CPU port module (which is + * redirected to the NPI port) +@@ -1241,6 +1244,7 @@ static int felix_setup(struct dsa_switch *ds) + * there's no real point in checking for errors. + */ + felix_set_tag_protocol(ds, port, felix->tag_proto); ++ break; + } + + ds->mtu_enforcement_ingress = true; +@@ -1277,6 +1281,7 @@ static void felix_teardown(struct dsa_switch *ds) + continue; + + felix_del_tag_protocol(ds, port, felix->tag_proto); ++ break; + } + + ocelot_devlink_sb_unregister(ocelot); +@@ -1406,8 +1411,12 @@ static void felix_txtstamp(struct dsa_switch *ds, int port, + if (!ocelot->ptp) + return; + +- if (ocelot_port_txtstamp_request(ocelot, port, skb, &clone)) ++ if (ocelot_port_txtstamp_request(ocelot, port, skb, &clone)) { ++ dev_err_ratelimited(ds->dev, ++ "port %d delivering skb without TX timestamp\n", ++ port); + return; ++ } + + if (clone) + OCELOT_SKB_CB(skb)->clone = clone; +diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig +index 1cdff1dca790c..17d3da4605ec0 100644 +--- a/drivers/net/ethernet/Kconfig ++++ b/drivers/net/ethernet/Kconfig +@@ -100,6 +100,7 @@ config JME + config KORINA + tristate "Korina (IDT RC32434) Ethernet support" + depends on MIKROTIK_RB532 || COMPILE_TEST ++ select CRC32 + select MII + help + If you have a Mikrotik RouterBoard 500 or IDT RC32434 +diff --git a/drivers/net/ethernet/arc/Kconfig b/drivers/net/ethernet/arc/Kconfig +index 37a41773dd435..92a79c4ffa2c7 100644 +--- a/drivers/net/ethernet/arc/Kconfig ++++ b/drivers/net/ethernet/arc/Kconfig +@@ -21,6 +21,7 @@ config ARC_EMAC_CORE + depends on ARC || ARCH_ROCKCHIP || COMPILE_TEST + select MII + select PHYLIB ++ select CRC32 + + config ARC_EMAC + tristate "ARC EMAC support" +diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c +index 234bc68e79f96..c2465b9d80567 100644 +--- a/drivers/net/ethernet/intel/ice/ice_ptp.c ++++ b/drivers/net/ethernet/intel/ice/ice_ptp.c +@@ -1324,22 +1324,21 @@ ice_ptp_flush_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx) + { + u8 idx; + +- spin_lock(&tx->lock); +- + for (idx = 0; idx < tx->len; idx++) { + u8 phy_idx = idx + tx->quad_offset; + +- /* Clear any potential residual timestamp in the PHY block */ +- if (!pf->hw.reset_ongoing) +- ice_clear_phy_tstamp(&pf->hw, tx->quad, phy_idx); +- ++ spin_lock(&tx->lock); + if (tx->tstamps[idx].skb) { + dev_kfree_skb_any(tx->tstamps[idx].skb); + tx->tstamps[idx].skb = NULL; + } +- } ++ clear_bit(idx, tx->in_use); ++ spin_unlock(&tx->lock); + +- spin_unlock(&tx->lock); ++ /* Clear any potential residual timestamp in the PHY block */ ++ if (!pf->hw.reset_ongoing) ++ ice_clear_phy_tstamp(&pf->hw, tx->quad, phy_idx); ++ } + } + + /** +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cq.c b/drivers/net/ethernet/mellanox/mlx5/core/cq.c +index 360e093874d4f..c74600be570ed 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/cq.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/cq.c +@@ -154,6 +154,8 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq) + u32 in[MLX5_ST_SZ_DW(destroy_cq_in)] = {}; + int err; + ++ mlx5_debug_cq_remove(dev, cq); ++ + mlx5_eq_del_cq(mlx5_get_async_eq(dev), cq); + mlx5_eq_del_cq(&cq->eq->core, cq); + +@@ -161,16 +163,13 @@ int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq) + MLX5_SET(destroy_cq_in, in, cqn, cq->cqn); + MLX5_SET(destroy_cq_in, in, uid, cq->uid); + err = mlx5_cmd_exec_in(dev, destroy_cq, in); +- if (err) +- return err; + + synchronize_irq(cq->irqn); + +- mlx5_debug_cq_remove(dev, cq); + mlx5_cq_put(cq); + wait_for_completion(&cq->free); + +- return 0; ++ return err; + } + EXPORT_SYMBOL(mlx5_core_destroy_cq); + +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +index 548e8e7fc956e..56fdcd487b9d7 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +@@ -3724,20 +3724,67 @@ static int set_feature_rx_all(struct net_device *netdev, bool enable) + return mlx5_set_port_fcs(mdev, !enable); + } + ++static int mlx5e_set_rx_port_ts(struct mlx5_core_dev *mdev, bool enable) ++{ ++ u32 in[MLX5_ST_SZ_DW(pcmr_reg)] = {}; ++ bool supported, curr_state; ++ int err; ++ ++ if (!MLX5_CAP_GEN(mdev, ports_check)) ++ return 0; ++ ++ err = mlx5_query_ports_check(mdev, in, sizeof(in)); ++ if (err) ++ return err; ++ ++ supported = MLX5_GET(pcmr_reg, in, rx_ts_over_crc_cap); ++ curr_state = MLX5_GET(pcmr_reg, in, rx_ts_over_crc); ++ ++ if (!supported || enable == curr_state) ++ return 0; ++ ++ MLX5_SET(pcmr_reg, in, local_port, 1); ++ MLX5_SET(pcmr_reg, in, rx_ts_over_crc, enable); ++ ++ return mlx5_set_ports_check(mdev, in, sizeof(in)); ++} ++ + static int set_feature_rx_fcs(struct net_device *netdev, bool enable) + { + struct mlx5e_priv *priv = netdev_priv(netdev); ++ struct mlx5e_channels *chs = &priv->channels; ++ struct mlx5_core_dev *mdev = priv->mdev; + int err; + + mutex_lock(&priv->state_lock); + +- priv->channels.params.scatter_fcs_en = enable; +- err = mlx5e_modify_channels_scatter_fcs(&priv->channels, enable); +- if (err) +- priv->channels.params.scatter_fcs_en = !enable; ++ if (enable) { ++ err = mlx5e_set_rx_port_ts(mdev, false); ++ if (err) ++ goto out; + +- mutex_unlock(&priv->state_lock); ++ chs->params.scatter_fcs_en = true; ++ err = mlx5e_modify_channels_scatter_fcs(chs, true); ++ if (err) { ++ chs->params.scatter_fcs_en = false; ++ mlx5e_set_rx_port_ts(mdev, true); ++ } ++ } else { ++ chs->params.scatter_fcs_en = false; ++ err = mlx5e_modify_channels_scatter_fcs(chs, false); ++ if (err) { ++ chs->params.scatter_fcs_en = true; ++ goto out; ++ } ++ err = mlx5e_set_rx_port_ts(mdev, true); ++ if (err) { ++ mlx5_core_warn(mdev, "Failed to set RX port timestamp %d\n", err); ++ err = 0; ++ } ++ } + ++out: ++ mutex_unlock(&priv->state_lock); + return err; + } + +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +index bec1d344481cd..8b757d790f560 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +@@ -611,7 +611,6 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev, + netdev->hw_features |= NETIF_F_RXCSUM; + + netdev->features |= netdev->hw_features; +- netdev->features |= NETIF_F_VLAN_CHALLENGED; + netdev->features |= NETIF_F_NETNS_LOCAL; + } + +diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +index 0998dcc9cac04..b29824448aa85 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +@@ -24,16 +24,8 @@ + #define MLXSW_THERMAL_ZONE_MAX_NAME 16 + #define MLXSW_THERMAL_TEMP_SCORE_MAX GENMASK(31, 0) + #define MLXSW_THERMAL_MAX_STATE 10 ++#define MLXSW_THERMAL_MIN_STATE 2 + #define MLXSW_THERMAL_MAX_DUTY 255 +-/* Minimum and maximum fan allowed speed in percent: from 20% to 100%. Values +- * MLXSW_THERMAL_MAX_STATE + x, where x is between 2 and 10 are used for +- * setting fan speed dynamic minimum. For example, if value is set to 14 (40%) +- * cooling levels vector will be set to 4, 4, 4, 4, 4, 5, 6, 7, 8, 9, 10 to +- * introduce PWM speed in percent: 40, 40, 40, 40, 40, 50, 60. 70, 80, 90, 100. +- */ +-#define MLXSW_THERMAL_SPEED_MIN (MLXSW_THERMAL_MAX_STATE + 2) +-#define MLXSW_THERMAL_SPEED_MAX (MLXSW_THERMAL_MAX_STATE * 2) +-#define MLXSW_THERMAL_SPEED_MIN_LEVEL 2 /* 20% */ + + /* External cooling devices, allowed for binding to mlxsw thermal zones. */ + static char * const mlxsw_thermal_external_allowed_cdev[] = { +@@ -646,49 +638,16 @@ static int mlxsw_thermal_set_cur_state(struct thermal_cooling_device *cdev, + struct mlxsw_thermal *thermal = cdev->devdata; + struct device *dev = thermal->bus_info->dev; + char mfsc_pl[MLXSW_REG_MFSC_LEN]; +- unsigned long cur_state, i; + int idx; +- u8 duty; + int err; + ++ if (state > MLXSW_THERMAL_MAX_STATE) ++ return -EINVAL; ++ + idx = mlxsw_get_cooling_device_idx(thermal, cdev); + if (idx < 0) + return idx; + +- /* Verify if this request is for changing allowed fan dynamical +- * minimum. If it is - update cooling levels accordingly and update +- * state, if current state is below the newly requested minimum state. +- * For example, if current state is 5, and minimal state is to be +- * changed from 4 to 6, thermal->cooling_levels[0 to 5] will be changed +- * all from 4 to 6. And state 5 (thermal->cooling_levels[4]) should be +- * overwritten. +- */ +- if (state >= MLXSW_THERMAL_SPEED_MIN && +- state <= MLXSW_THERMAL_SPEED_MAX) { +- state -= MLXSW_THERMAL_MAX_STATE; +- for (i = 0; i <= MLXSW_THERMAL_MAX_STATE; i++) +- thermal->cooling_levels[i] = max(state, i); +- +- mlxsw_reg_mfsc_pack(mfsc_pl, idx, 0); +- err = mlxsw_reg_query(thermal->core, MLXSW_REG(mfsc), mfsc_pl); +- if (err) +- return err; +- +- duty = mlxsw_reg_mfsc_pwm_duty_cycle_get(mfsc_pl); +- cur_state = mlxsw_duty_to_state(duty); +- +- /* If current fan state is lower than requested dynamical +- * minimum, increase fan speed up to dynamical minimum. +- */ +- if (state < cur_state) +- return 0; +- +- state = cur_state; +- } +- +- if (state > MLXSW_THERMAL_MAX_STATE) +- return -EINVAL; +- + /* Normalize the state to the valid speed range. */ + state = thermal->cooling_levels[state]; + mlxsw_reg_mfsc_pack(mfsc_pl, idx, mlxsw_state_to_duty(state)); +@@ -998,8 +957,7 @@ int mlxsw_thermal_init(struct mlxsw_core *core, + + /* Initialize cooling levels per PWM state. */ + for (i = 0; i < MLXSW_THERMAL_MAX_STATE; i++) +- thermal->cooling_levels[i] = max(MLXSW_THERMAL_SPEED_MIN_LEVEL, +- i); ++ thermal->cooling_levels[i] = max(MLXSW_THERMAL_MIN_STATE, i); + + thermal->polling_delay = bus_info->low_frequency ? + MLXSW_THERMAL_SLOW_POLL_INT : +diff --git a/drivers/net/ethernet/microchip/encx24j600-regmap.c b/drivers/net/ethernet/microchip/encx24j600-regmap.c +index 796e46a539269..81a8ccca7e5e0 100644 +--- a/drivers/net/ethernet/microchip/encx24j600-regmap.c ++++ b/drivers/net/ethernet/microchip/encx24j600-regmap.c +@@ -497,13 +497,19 @@ static struct regmap_bus phymap_encx24j600 = { + .reg_read = regmap_encx24j600_phy_reg_read, + }; + +-void devm_regmap_init_encx24j600(struct device *dev, +- struct encx24j600_context *ctx) ++int devm_regmap_init_encx24j600(struct device *dev, ++ struct encx24j600_context *ctx) + { + mutex_init(&ctx->mutex); + regcfg.lock_arg = ctx; + ctx->regmap = devm_regmap_init(dev, ®map_encx24j600, ctx, ®cfg); ++ if (IS_ERR(ctx->regmap)) ++ return PTR_ERR(ctx->regmap); + ctx->phymap = devm_regmap_init(dev, &phymap_encx24j600, ctx, &phycfg); ++ if (IS_ERR(ctx->phymap)) ++ return PTR_ERR(ctx->phymap); ++ ++ return 0; + } + EXPORT_SYMBOL_GPL(devm_regmap_init_encx24j600); + +diff --git a/drivers/net/ethernet/microchip/encx24j600.c b/drivers/net/ethernet/microchip/encx24j600.c +index ee921a99e439a..0bc6b3176fbf0 100644 +--- a/drivers/net/ethernet/microchip/encx24j600.c ++++ b/drivers/net/ethernet/microchip/encx24j600.c +@@ -1023,10 +1023,13 @@ static int encx24j600_spi_probe(struct spi_device *spi) + priv->speed = SPEED_100; + + priv->ctx.spi = spi; +- devm_regmap_init_encx24j600(&spi->dev, &priv->ctx); + ndev->irq = spi->irq; + ndev->netdev_ops = &encx24j600_netdev_ops; + ++ ret = devm_regmap_init_encx24j600(&spi->dev, &priv->ctx); ++ if (ret) ++ goto out_free; ++ + mutex_init(&priv->lock); + + /* Reset device and check if it is connected */ +diff --git a/drivers/net/ethernet/microchip/encx24j600_hw.h b/drivers/net/ethernet/microchip/encx24j600_hw.h +index fac61a8fbd020..34c5a289898c9 100644 +--- a/drivers/net/ethernet/microchip/encx24j600_hw.h ++++ b/drivers/net/ethernet/microchip/encx24j600_hw.h +@@ -15,8 +15,8 @@ struct encx24j600_context { + int bank; + }; + +-void devm_regmap_init_encx24j600(struct device *dev, +- struct encx24j600_context *ctx); ++int devm_regmap_init_encx24j600(struct device *dev, ++ struct encx24j600_context *ctx); + + /* Single-byte instructions */ + #define BANK_SELECT(bank) (0xC0 | ((bank & (BANK_MASK >> BANK_SHIFT)) << 1)) +diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c +index 512dff9551669..acfbe94b52918 100644 +--- a/drivers/net/ethernet/mscc/ocelot.c ++++ b/drivers/net/ethernet/mscc/ocelot.c +@@ -536,20 +536,36 @@ void ocelot_port_disable(struct ocelot *ocelot, int port) + } + EXPORT_SYMBOL(ocelot_port_disable); + +-static void ocelot_port_add_txtstamp_skb(struct ocelot *ocelot, int port, +- struct sk_buff *clone) ++static int ocelot_port_add_txtstamp_skb(struct ocelot *ocelot, int port, ++ struct sk_buff *clone) + { + struct ocelot_port *ocelot_port = ocelot->ports[port]; ++ unsigned long flags; + +- spin_lock(&ocelot_port->ts_id_lock); ++ spin_lock_irqsave(&ocelot->ts_id_lock, flags); ++ ++ if (ocelot_port->ptp_skbs_in_flight == OCELOT_MAX_PTP_ID || ++ ocelot->ptp_skbs_in_flight == OCELOT_PTP_FIFO_SIZE) { ++ spin_unlock_irqrestore(&ocelot->ts_id_lock, flags); ++ return -EBUSY; ++ } + + skb_shinfo(clone)->tx_flags |= SKBTX_IN_PROGRESS; + /* Store timestamp ID in OCELOT_SKB_CB(clone)->ts_id */ + OCELOT_SKB_CB(clone)->ts_id = ocelot_port->ts_id; +- ocelot_port->ts_id = (ocelot_port->ts_id + 1) % 4; ++ ++ ocelot_port->ts_id++; ++ if (ocelot_port->ts_id == OCELOT_MAX_PTP_ID) ++ ocelot_port->ts_id = 0; ++ ++ ocelot_port->ptp_skbs_in_flight++; ++ ocelot->ptp_skbs_in_flight++; ++ + skb_queue_tail(&ocelot_port->tx_skbs, clone); + +- spin_unlock(&ocelot_port->ts_id_lock); ++ spin_unlock_irqrestore(&ocelot->ts_id_lock, flags); ++ ++ return 0; + } + + u32 ocelot_ptp_rew_op(struct sk_buff *skb) +@@ -569,16 +585,12 @@ u32 ocelot_ptp_rew_op(struct sk_buff *skb) + } + EXPORT_SYMBOL(ocelot_ptp_rew_op); + +-static bool ocelot_ptp_is_onestep_sync(struct sk_buff *skb) ++static bool ocelot_ptp_is_onestep_sync(struct sk_buff *skb, ++ unsigned int ptp_class) + { + struct ptp_header *hdr; +- unsigned int ptp_class; + u8 msgtype, twostep; + +- ptp_class = ptp_classify_raw(skb); +- if (ptp_class == PTP_CLASS_NONE) +- return false; +- + hdr = ptp_parse_header(skb, ptp_class); + if (!hdr) + return false; +@@ -598,10 +610,20 @@ int ocelot_port_txtstamp_request(struct ocelot *ocelot, int port, + { + struct ocelot_port *ocelot_port = ocelot->ports[port]; + u8 ptp_cmd = ocelot_port->ptp_cmd; ++ unsigned int ptp_class; ++ int err; ++ ++ /* Don't do anything if PTP timestamping not enabled */ ++ if (!ptp_cmd) ++ return 0; ++ ++ ptp_class = ptp_classify_raw(skb); ++ if (ptp_class == PTP_CLASS_NONE) ++ return -EINVAL; + + /* Store ptp_cmd in OCELOT_SKB_CB(skb)->ptp_cmd */ + if (ptp_cmd == IFH_REW_OP_ORIGIN_PTP) { +- if (ocelot_ptp_is_onestep_sync(skb)) { ++ if (ocelot_ptp_is_onestep_sync(skb, ptp_class)) { + OCELOT_SKB_CB(skb)->ptp_cmd = ptp_cmd; + return 0; + } +@@ -615,8 +637,12 @@ int ocelot_port_txtstamp_request(struct ocelot *ocelot, int port, + if (!(*clone)) + return -ENOMEM; + +- ocelot_port_add_txtstamp_skb(ocelot, port, *clone); ++ err = ocelot_port_add_txtstamp_skb(ocelot, port, *clone); ++ if (err) ++ return err; ++ + OCELOT_SKB_CB(skb)->ptp_cmd = ptp_cmd; ++ OCELOT_SKB_CB(*clone)->ptp_class = ptp_class; + } + + return 0; +@@ -650,6 +676,17 @@ static void ocelot_get_hwtimestamp(struct ocelot *ocelot, + spin_unlock_irqrestore(&ocelot->ptp_clock_lock, flags); + } + ++static bool ocelot_validate_ptp_skb(struct sk_buff *clone, u16 seqid) ++{ ++ struct ptp_header *hdr; ++ ++ hdr = ptp_parse_header(clone, OCELOT_SKB_CB(clone)->ptp_class); ++ if (WARN_ON(!hdr)) ++ return false; ++ ++ return seqid == ntohs(hdr->sequence_id); ++} ++ + void ocelot_get_txtstamp(struct ocelot *ocelot) + { + int budget = OCELOT_PTP_QUEUE_SZ; +@@ -657,10 +694,10 @@ void ocelot_get_txtstamp(struct ocelot *ocelot) + while (budget--) { + struct sk_buff *skb, *skb_tmp, *skb_match = NULL; + struct skb_shared_hwtstamps shhwtstamps; ++ u32 val, id, seqid, txport; + struct ocelot_port *port; + struct timespec64 ts; + unsigned long flags; +- u32 val, id, txport; + + val = ocelot_read(ocelot, SYS_PTP_STATUS); + +@@ -673,10 +710,17 @@ void ocelot_get_txtstamp(struct ocelot *ocelot) + /* Retrieve the ts ID and Tx port */ + id = SYS_PTP_STATUS_PTP_MESS_ID_X(val); + txport = SYS_PTP_STATUS_PTP_MESS_TXPORT_X(val); ++ seqid = SYS_PTP_STATUS_PTP_MESS_SEQ_ID(val); + +- /* Retrieve its associated skb */ + port = ocelot->ports[txport]; + ++ spin_lock(&ocelot->ts_id_lock); ++ port->ptp_skbs_in_flight--; ++ ocelot->ptp_skbs_in_flight--; ++ spin_unlock(&ocelot->ts_id_lock); ++ ++ /* Retrieve its associated skb */ ++try_again: + spin_lock_irqsave(&port->tx_skbs.lock, flags); + + skb_queue_walk_safe(&port->tx_skbs, skb, skb_tmp) { +@@ -689,12 +733,20 @@ void ocelot_get_txtstamp(struct ocelot *ocelot) + + spin_unlock_irqrestore(&port->tx_skbs.lock, flags); + ++ if (WARN_ON(!skb_match)) ++ continue; ++ ++ if (!ocelot_validate_ptp_skb(skb_match, seqid)) { ++ dev_err_ratelimited(ocelot->dev, ++ "port %d received stale TX timestamp for seqid %d, discarding\n", ++ txport, seqid); ++ dev_kfree_skb_any(skb); ++ goto try_again; ++ } ++ + /* Get the h/w timestamp */ + ocelot_get_hwtimestamp(ocelot, &ts); + +- if (unlikely(!skb_match)) +- continue; +- + /* Set the timestamp into the skb */ + memset(&shhwtstamps, 0, sizeof(shhwtstamps)); + shhwtstamps.hwtstamp = ktime_set(ts.tv_sec, ts.tv_nsec); +@@ -1915,7 +1967,6 @@ void ocelot_init_port(struct ocelot *ocelot, int port) + struct ocelot_port *ocelot_port = ocelot->ports[port]; + + skb_queue_head_init(&ocelot_port->tx_skbs); +- spin_lock_init(&ocelot_port->ts_id_lock); + + /* Basic L2 initialization */ + +@@ -2039,6 +2090,7 @@ int ocelot_init(struct ocelot *ocelot) + mutex_init(&ocelot->stats_lock); + mutex_init(&ocelot->ptp_lock); + spin_lock_init(&ocelot->ptp_clock_lock); ++ spin_lock_init(&ocelot->ts_id_lock); + snprintf(queue_name, sizeof(queue_name), "%s-stats", + dev_name(ocelot->dev)); + ocelot->stats_queue = create_singlethread_workqueue(queue_name); +diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c +index 0b017d4f5c085..a988ed360185b 100644 +--- a/drivers/net/ethernet/neterion/s2io.c ++++ b/drivers/net/ethernet/neterion/s2io.c +@@ -8566,7 +8566,7 @@ static void s2io_io_resume(struct pci_dev *pdev) + return; + } + +- if (s2io_set_mac_addr(netdev, netdev->dev_addr) == FAILURE) { ++ if (do_s2io_prog_unicast(netdev, netdev->dev_addr) == FAILURE) { + s2io_card_down(sp); + pr_err("Can't restore mac addr after reset.\n"); + return; +diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.c b/drivers/net/ethernet/netronome/nfp/flower/main.c +index c029950a81e20..ac1dcfa1d1790 100644 +--- a/drivers/net/ethernet/netronome/nfp/flower/main.c ++++ b/drivers/net/ethernet/netronome/nfp/flower/main.c +@@ -830,10 +830,6 @@ static int nfp_flower_init(struct nfp_app *app) + if (err) + goto err_cleanup; + +- err = flow_indr_dev_register(nfp_flower_indr_setup_tc_cb, app); +- if (err) +- goto err_cleanup; +- + if (app_priv->flower_ext_feats & NFP_FL_FEATS_VF_RLIM) + nfp_flower_qos_init(app); + +@@ -942,7 +938,20 @@ static int nfp_flower_start(struct nfp_app *app) + return err; + } + +- return nfp_tunnel_config_start(app); ++ err = flow_indr_dev_register(nfp_flower_indr_setup_tc_cb, app); ++ if (err) ++ return err; ++ ++ err = nfp_tunnel_config_start(app); ++ if (err) ++ goto err_tunnel_config; ++ ++ return 0; ++ ++err_tunnel_config: ++ flow_indr_dev_unregister(nfp_flower_indr_setup_tc_cb, app, ++ nfp_flower_setup_indr_tc_release); ++ return err; + } + + static void nfp_flower_stop(struct nfp_app *app) +diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c +index e795fa63ca12e..14429d2900f2f 100644 +--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c ++++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c +@@ -1357,6 +1357,10 @@ static int ionic_addr_add(struct net_device *netdev, const u8 *addr) + + static int ionic_addr_del(struct net_device *netdev, const u8 *addr) + { ++ /* Don't delete our own address from the uc list */ ++ if (ether_addr_equal(addr, netdev->dev_addr)) ++ return 0; ++ + return ionic_lif_addr(netdev_priv(netdev), addr, DEL_ADDR); + } + +diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c +index 6bb9ec98a12b5..41bc31e3f9356 100644 +--- a/drivers/net/ethernet/qlogic/qed/qed_main.c ++++ b/drivers/net/ethernet/qlogic/qed/qed_main.c +@@ -1295,6 +1295,7 @@ static int qed_slowpath_start(struct qed_dev *cdev, + } else { + DP_NOTICE(cdev, + "Failed to acquire PTT for aRFS\n"); ++ rc = -EINVAL; + goto err; + } + } +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c +index 90383abafa66a..f5581db0ba9ba 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c +@@ -218,11 +218,18 @@ static void dwmac1000_dump_dma_regs(void __iomem *ioaddr, u32 *reg_space) + readl(ioaddr + DMA_BUS_MODE + i * 4); + } + +-static void dwmac1000_get_hw_feature(void __iomem *ioaddr, +- struct dma_features *dma_cap) ++static int dwmac1000_get_hw_feature(void __iomem *ioaddr, ++ struct dma_features *dma_cap) + { + u32 hw_cap = readl(ioaddr + DMA_HW_FEATURE); + ++ if (!hw_cap) { ++ /* 0x00000000 is the value read on old hardware that does not ++ * implement this register ++ */ ++ return -EOPNOTSUPP; ++ } ++ + dma_cap->mbps_10_100 = (hw_cap & DMA_HW_FEAT_MIISEL); + dma_cap->mbps_1000 = (hw_cap & DMA_HW_FEAT_GMIISEL) >> 1; + dma_cap->half_duplex = (hw_cap & DMA_HW_FEAT_HDSEL) >> 2; +@@ -252,6 +259,8 @@ static void dwmac1000_get_hw_feature(void __iomem *ioaddr, + dma_cap->number_tx_channel = (hw_cap & DMA_HW_FEAT_TXCHCNT) >> 22; + /* Alternate (enhanced) DESC mode */ + dma_cap->enh_desc = (hw_cap & DMA_HW_FEAT_ENHDESSEL) >> 24; ++ ++ return 0; + } + + static void dwmac1000_rx_watchdog(void __iomem *ioaddr, u32 riwt, +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +index 5be8e6a631d9b..d99fa028c6468 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +@@ -347,8 +347,8 @@ static void dwmac4_dma_tx_chan_op_mode(void __iomem *ioaddr, int mode, + writel(mtl_tx_op, ioaddr + MTL_CHAN_TX_OP_MODE(channel)); + } + +-static void dwmac4_get_hw_feature(void __iomem *ioaddr, +- struct dma_features *dma_cap) ++static int dwmac4_get_hw_feature(void __iomem *ioaddr, ++ struct dma_features *dma_cap) + { + u32 hw_cap = readl(ioaddr + GMAC_HW_FEATURE0); + +@@ -437,6 +437,8 @@ static void dwmac4_get_hw_feature(void __iomem *ioaddr, + dma_cap->frpbs = (hw_cap & GMAC_HW_FEAT_FRPBS) >> 11; + dma_cap->frpsel = (hw_cap & GMAC_HW_FEAT_FRPSEL) >> 10; + dma_cap->dvlan = (hw_cap & GMAC_HW_FEAT_DVLAN) >> 5; ++ ++ return 0; + } + + /* Enable/disable TSO feature and set MSS */ +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +index 906e985441a93..5e98355f422b3 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +@@ -371,8 +371,8 @@ static int dwxgmac2_dma_interrupt(void __iomem *ioaddr, + return ret; + } + +-static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, +- struct dma_features *dma_cap) ++static int dwxgmac2_get_hw_feature(void __iomem *ioaddr, ++ struct dma_features *dma_cap) + { + u32 hw_cap; + +@@ -445,6 +445,8 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr, + dma_cap->frpes = (hw_cap & XGMAC_HWFEAT_FRPES) >> 11; + dma_cap->frpbs = (hw_cap & XGMAC_HWFEAT_FRPPB) >> 9; + dma_cap->frpsel = (hw_cap & XGMAC_HWFEAT_FRPSEL) >> 3; ++ ++ return 0; + } + + static void dwxgmac2_rx_watchdog(void __iomem *ioaddr, u32 riwt, u32 queue) +diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h +index 6dc1c98ebec82..fe2660d5694d7 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h ++++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h +@@ -203,8 +203,8 @@ struct stmmac_dma_ops { + int (*dma_interrupt) (void __iomem *ioaddr, + struct stmmac_extra_stats *x, u32 chan, u32 dir); + /* If supported then get the optional core features */ +- void (*get_hw_feature)(void __iomem *ioaddr, +- struct dma_features *dma_cap); ++ int (*get_hw_feature)(void __iomem *ioaddr, ++ struct dma_features *dma_cap); + /* Program the HW RX Watchdog */ + void (*rx_watchdog)(void __iomem *ioaddr, u32 riwt, u32 queue); + void (*set_tx_ring_len)(void __iomem *ioaddr, u32 len, u32 chan); +@@ -255,7 +255,7 @@ struct stmmac_dma_ops { + #define stmmac_dma_interrupt_status(__priv, __args...) \ + stmmac_do_callback(__priv, dma, dma_interrupt, __args) + #define stmmac_get_hw_feature(__priv, __args...) \ +- stmmac_do_void_callback(__priv, dma, get_hw_feature, __args) ++ stmmac_do_callback(__priv, dma, get_hw_feature, __args) + #define stmmac_rx_watchdog(__priv, __args...) \ + stmmac_do_void_callback(__priv, dma, rx_watchdog, __args) + #define stmmac_set_tx_ring_len(__priv, __args...) \ +diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c +index 5d5f9a9ee768a..787462310aae3 100644 +--- a/drivers/net/phy/phy_device.c ++++ b/drivers/net/phy/phy_device.c +@@ -3112,6 +3112,9 @@ static void phy_shutdown(struct device *dev) + { + struct phy_device *phydev = to_phy_device(dev); + ++ if (phydev->state == PHY_READY || !phydev->attached_dev) ++ return; ++ + phy_disable_interrupts(phydev); + } + +diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig +index 4c5d69732a7e1..f87f175033731 100644 +--- a/drivers/net/usb/Kconfig ++++ b/drivers/net/usb/Kconfig +@@ -99,6 +99,10 @@ config USB_RTL8150 + config USB_RTL8152 + tristate "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters" + select MII ++ select CRC32 ++ select CRYPTO ++ select CRYPTO_HASH ++ select CRYPTO_SHA256 + help + This option adds support for Realtek RTL8152 based USB 2.0 + 10/100 Ethernet adapters and RTL8153 based USB 3.0 10/100/1000 +diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c +index 4f22fbafe964f..1f41619018c16 100644 +--- a/drivers/nvme/host/pci.c ++++ b/drivers/nvme/host/pci.c +@@ -1331,7 +1331,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved) + iod->aborted = 1; + + cmd.abort.opcode = nvme_admin_abort_cmd; +- cmd.abort.cid = req->tag; ++ cmd.abort.cid = nvme_cid(req); + cmd.abort.sqid = cpu_to_le16(nvmeq->qid); + + dev_warn(nvmeq->dev->ctrl.device, +diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c +index 3d87fadaa160d..8976da38b375a 100644 +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -1383,7 +1383,8 @@ static void nvmem_shift_read_buffer_in_place(struct nvmem_cell *cell, void *buf) + *p-- = 0; + + /* clear msb bits if any leftover in the last byte */ +- *p &= GENMASK((cell->nbits%BITS_PER_BYTE) - 1, 0); ++ if (cell->nbits % BITS_PER_BYTE) ++ *p &= GENMASK((cell->nbits % BITS_PER_BYTE) - 1, 0); + } + + static int __nvmem_cell_read(struct nvmem_device *nvmem, +diff --git a/drivers/platform/mellanox/mlxreg-io.c b/drivers/platform/mellanox/mlxreg-io.c +index 7646708d57e42..a916cd89cbbed 100644 +--- a/drivers/platform/mellanox/mlxreg-io.c ++++ b/drivers/platform/mellanox/mlxreg-io.c +@@ -98,7 +98,7 @@ mlxreg_io_get_reg(void *regmap, struct mlxreg_core_data *data, u32 in_val, + if (ret) + goto access_error; + +- *regval |= rol32(val, regsize * i); ++ *regval |= rol32(val, regsize * i * 8); + } + } + +@@ -141,7 +141,7 @@ mlxreg_io_attr_store(struct device *dev, struct device_attribute *attr, + return -EINVAL; + + /* Convert buffer to input value. */ +- ret = kstrtou32(buf, len, &input_val); ++ ret = kstrtou32(buf, 0, &input_val); + if (ret) + return ret; + +diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c +index d6a7c896ac866..fc95620101e85 100644 +--- a/drivers/platform/x86/amd-pmc.c ++++ b/drivers/platform/x86/amd-pmc.c +@@ -476,6 +476,7 @@ static const struct acpi_device_id amd_pmc_acpi_ids[] = { + {"AMDI0006", 0}, + {"AMDI0007", 0}, + {"AMD0004", 0}, ++ {"AMD0005", 0}, + { } + }; + MODULE_DEVICE_TABLE(acpi, amd_pmc_acpi_ids); +diff --git a/drivers/platform/x86/gigabyte-wmi.c b/drivers/platform/x86/gigabyte-wmi.c +index d53634c8a6e09..658bab4b79648 100644 +--- a/drivers/platform/x86/gigabyte-wmi.c ++++ b/drivers/platform/x86/gigabyte-wmi.c +@@ -141,6 +141,7 @@ static u8 gigabyte_wmi_detect_sensor_usability(struct wmi_device *wdev) + + static const struct dmi_system_id gigabyte_wmi_known_working_platforms[] = { + DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B450M S2H V2"), ++ DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 AORUS ELITE AX V2"), + DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 AORUS ELITE"), + DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 AORUS ELITE V2"), + DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 GAMING X V2"), +diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c +index 9171a46a9e3fe..25b98b12439f1 100644 +--- a/drivers/platform/x86/intel_scu_ipc.c ++++ b/drivers/platform/x86/intel_scu_ipc.c +@@ -232,7 +232,7 @@ static inline u32 ipc_data_readl(struct intel_scu_ipc_dev *scu, u32 offset) + /* Wait till scu status is busy */ + static inline int busy_loop(struct intel_scu_ipc_dev *scu) + { +- unsigned long end = jiffies + msecs_to_jiffies(IPC_TIMEOUT); ++ unsigned long end = jiffies + IPC_TIMEOUT; + + do { + u32 status; +diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c +index 788dcdf25f003..f872cf196c2f3 100644 +--- a/drivers/spi/spi-atmel.c ++++ b/drivers/spi/spi-atmel.c +@@ -1301,7 +1301,7 @@ static int atmel_spi_one_transfer(struct spi_master *master, + * DMA map early, for performance (empties dcache ASAP) and + * better fault reporting. + */ +- if ((!master->cur_msg_mapped) ++ if ((!master->cur_msg->is_dma_mapped) + && as->use_pdc) { + if (atmel_spi_dma_map_xfer(as, xfer) < 0) + return -ENOMEM; +@@ -1381,7 +1381,7 @@ static int atmel_spi_one_transfer(struct spi_master *master, + } + } + +- if (!master->cur_msg_mapped ++ if (!master->cur_msg->is_dma_mapped + && as->use_pdc) + atmel_spi_dma_unmap_xfer(master, xfer); + +diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c +index a78e56f566dd8..3043677ba2226 100644 +--- a/drivers/spi/spi-bcm-qspi.c ++++ b/drivers/spi/spi-bcm-qspi.c +@@ -1250,10 +1250,14 @@ static void bcm_qspi_hw_init(struct bcm_qspi *qspi) + + static void bcm_qspi_hw_uninit(struct bcm_qspi *qspi) + { ++ u32 status = bcm_qspi_read(qspi, MSPI, MSPI_MSPI_STATUS); ++ + bcm_qspi_write(qspi, MSPI, MSPI_SPCR2, 0); + if (has_bspi(qspi)) + bcm_qspi_write(qspi, MSPI, MSPI_WRITE_LOCK, 0); + ++ /* clear interrupt */ ++ bcm_qspi_write(qspi, MSPI, MSPI_MSPI_STATUS, status & ~1); + } + + static const struct spi_controller_mem_ops bcm_qspi_mem_ops = { +@@ -1397,6 +1401,47 @@ int bcm_qspi_probe(struct platform_device *pdev, + if (!qspi->dev_ids) + return -ENOMEM; + ++ /* ++ * Some SoCs integrate spi controller (e.g., its interrupt bits) ++ * in specific ways ++ */ ++ if (soc_intc) { ++ qspi->soc_intc = soc_intc; ++ soc_intc->bcm_qspi_int_set(soc_intc, MSPI_DONE, true); ++ } else { ++ qspi->soc_intc = NULL; ++ } ++ ++ if (qspi->clk) { ++ ret = clk_prepare_enable(qspi->clk); ++ if (ret) { ++ dev_err(dev, "failed to prepare clock\n"); ++ goto qspi_probe_err; ++ } ++ qspi->base_clk = clk_get_rate(qspi->clk); ++ } else { ++ qspi->base_clk = MSPI_BASE_FREQ; ++ } ++ ++ if (data->has_mspi_rev) { ++ rev = bcm_qspi_read(qspi, MSPI, MSPI_REV); ++ /* some older revs do not have a MSPI_REV register */ ++ if ((rev & 0xff) == 0xff) ++ rev = 0; ++ } ++ ++ qspi->mspi_maj_rev = (rev >> 4) & 0xf; ++ qspi->mspi_min_rev = rev & 0xf; ++ qspi->mspi_spcr3_sysclk = data->has_spcr3_sysclk; ++ ++ qspi->max_speed_hz = qspi->base_clk / (bcm_qspi_spbr_min(qspi) * 2); ++ ++ /* ++ * On SW resets it is possible to have the mask still enabled ++ * Need to disable the mask and clear the status while we init ++ */ ++ bcm_qspi_hw_uninit(qspi); ++ + for (val = 0; val < num_irqs; val++) { + irq = -1; + name = qspi_irq_tab[val].irq_name; +@@ -1433,38 +1478,6 @@ int bcm_qspi_probe(struct platform_device *pdev, + goto qspi_probe_err; + } + +- /* +- * Some SoCs integrate spi controller (e.g., its interrupt bits) +- * in specific ways +- */ +- if (soc_intc) { +- qspi->soc_intc = soc_intc; +- soc_intc->bcm_qspi_int_set(soc_intc, MSPI_DONE, true); +- } else { +- qspi->soc_intc = NULL; +- } +- +- ret = clk_prepare_enable(qspi->clk); +- if (ret) { +- dev_err(dev, "failed to prepare clock\n"); +- goto qspi_probe_err; +- } +- +- qspi->base_clk = clk_get_rate(qspi->clk); +- +- if (data->has_mspi_rev) { +- rev = bcm_qspi_read(qspi, MSPI, MSPI_REV); +- /* some older revs do not have a MSPI_REV register */ +- if ((rev & 0xff) == 0xff) +- rev = 0; +- } +- +- qspi->mspi_maj_rev = (rev >> 4) & 0xf; +- qspi->mspi_min_rev = rev & 0xf; +- qspi->mspi_spcr3_sysclk = data->has_spcr3_sysclk; +- +- qspi->max_speed_hz = qspi->base_clk / (bcm_qspi_spbr_min(qspi) * 2); +- + bcm_qspi_hw_init(qspi); + init_completion(&qspi->mspi_done); + init_completion(&qspi->bspi_done); +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c +index 24e9469ea35bb..515466c60f77f 100644 +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -673,6 +673,19 @@ static const struct file_operations spidev_fops = { + + static struct class *spidev_class; + ++static const struct spi_device_id spidev_spi_ids[] = { ++ { .name = "dh2228fv" }, ++ { .name = "ltc2488" }, ++ { .name = "sx1301" }, ++ { .name = "bk4" }, ++ { .name = "dhcom-board" }, ++ { .name = "m53cpld" }, ++ { .name = "spi-petra" }, ++ { .name = "spi-authenta" }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(spi, spidev_spi_ids); ++ + #ifdef CONFIG_OF + static const struct of_device_id spidev_dt_ids[] = { + { .compatible = "rohm,dh2228fv" }, +@@ -819,6 +832,7 @@ static struct spi_driver spidev_spi_driver = { + }, + .probe = spidev_probe, + .remove = spidev_remove, ++ .id_table = spidev_spi_ids, + + /* NOTE: suspend/resume methods are not necessary here. + * We don't do anything except pass the requests to/from +diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c +index 5ce13b099d7dc..5363ebebfc357 100644 +--- a/drivers/tee/optee/core.c ++++ b/drivers/tee/optee/core.c +@@ -585,6 +585,9 @@ static int optee_remove(struct platform_device *pdev) + { + struct optee *optee = platform_get_drvdata(pdev); + ++ /* Unregister OP-TEE specific client devices on TEE bus */ ++ optee_unregister_devices(); ++ + /* + * Ask OP-TEE to free all cached shared memory objects to decrease + * reference counters and also avoid wild pointers in secure world +diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c +index ec1d24693ebaa..128a2d2a50a16 100644 +--- a/drivers/tee/optee/device.c ++++ b/drivers/tee/optee/device.c +@@ -53,6 +53,13 @@ static int get_devices(struct tee_context *ctx, u32 session, + return 0; + } + ++static void optee_release_device(struct device *dev) ++{ ++ struct tee_client_device *optee_device = to_tee_client_device(dev); ++ ++ kfree(optee_device); ++} ++ + static int optee_register_device(const uuid_t *device_uuid) + { + struct tee_client_device *optee_device = NULL; +@@ -63,6 +70,7 @@ static int optee_register_device(const uuid_t *device_uuid) + return -ENOMEM; + + optee_device->dev.bus = &tee_bus_type; ++ optee_device->dev.release = optee_release_device; + if (dev_set_name(&optee_device->dev, "optee-ta-%pUb", device_uuid)) { + kfree(optee_device); + return -ENOMEM; +@@ -154,3 +162,17 @@ int optee_enumerate_devices(u32 func) + { + return __optee_enumerate_devices(func); + } ++ ++static int __optee_unregister_device(struct device *dev, void *data) ++{ ++ if (!strncmp(dev_name(dev), "optee-ta", strlen("optee-ta"))) ++ device_unregister(dev); ++ ++ return 0; ++} ++ ++void optee_unregister_devices(void) ++{ ++ bus_for_each_dev(&tee_bus_type, NULL, NULL, ++ __optee_unregister_device); ++} +diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h +index dbdd367be1568..f6bb4a763ba94 100644 +--- a/drivers/tee/optee/optee_private.h ++++ b/drivers/tee/optee/optee_private.h +@@ -184,6 +184,7 @@ void optee_fill_pages_list(u64 *dst, struct page **pages, int num_pages, + #define PTA_CMD_GET_DEVICES 0x0 + #define PTA_CMD_GET_DEVICES_SUPP 0x1 + int optee_enumerate_devices(u32 func); ++void optee_unregister_devices(void); + + /* + * Small helpers +diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c +index bef104511352c..509b597e30edb 100644 +--- a/drivers/usb/host/xhci-dbgtty.c ++++ b/drivers/usb/host/xhci-dbgtty.c +@@ -408,40 +408,38 @@ static int xhci_dbc_tty_register_device(struct xhci_dbc *dbc) + return -EBUSY; + + xhci_dbc_tty_init_port(dbc, port); +- tty_dev = tty_port_register_device(&port->port, +- dbc_tty_driver, 0, NULL); +- if (IS_ERR(tty_dev)) { +- ret = PTR_ERR(tty_dev); +- goto register_fail; +- } + + ret = kfifo_alloc(&port->write_fifo, DBC_WRITE_BUF_SIZE, GFP_KERNEL); + if (ret) +- goto buf_alloc_fail; ++ goto err_exit_port; + + ret = xhci_dbc_alloc_requests(dbc, BULK_IN, &port->read_pool, + dbc_read_complete); + if (ret) +- goto request_fail; ++ goto err_free_fifo; + + ret = xhci_dbc_alloc_requests(dbc, BULK_OUT, &port->write_pool, + dbc_write_complete); + if (ret) +- goto request_fail; ++ goto err_free_requests; ++ ++ tty_dev = tty_port_register_device(&port->port, ++ dbc_tty_driver, 0, NULL); ++ if (IS_ERR(tty_dev)) { ++ ret = PTR_ERR(tty_dev); ++ goto err_free_requests; ++ } + + port->registered = true; + + return 0; + +-request_fail: ++err_free_requests: + xhci_dbc_free_requests(&port->read_pool); + xhci_dbc_free_requests(&port->write_pool); ++err_free_fifo: + kfifo_free(&port->write_fifo); +- +-buf_alloc_fail: +- tty_unregister_device(dbc_tty_driver, 0); +- +-register_fail: ++err_exit_port: + xhci_dbc_tty_exit_port(port); + + dev_err(dbc->dev, "can't register tty port, err %d\n", ret); +diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c +index 1c9a7957c45c5..003c5f0a8760f 100644 +--- a/drivers/usb/host/xhci-pci.c ++++ b/drivers/usb/host/xhci-pci.c +@@ -30,6 +30,7 @@ + #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73 + #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000 + #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1009 0x1009 ++#define PCI_DEVICE_ID_FRESCO_LOGIC_FL1100 0x1100 + #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1400 0x1400 + + #define PCI_VENDOR_ID_ETRON 0x1b6f +@@ -113,6 +114,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) + /* Look for vendor-specific quirks */ + if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && + (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK || ++ pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1100 || + pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1400)) { + if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK && + pdev->revision == 0x0) { +@@ -279,8 +281,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) + pdev->device == 0x3432) + xhci->quirks |= XHCI_BROKEN_STREAMS; + +- if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) ++ if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) { + xhci->quirks |= XHCI_LPM_SUPPORT; ++ xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; ++ } + + if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && + pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c +index 9017986241f51..8fedf1bf292ba 100644 +--- a/drivers/usb/host/xhci-ring.c ++++ b/drivers/usb/host/xhci-ring.c +@@ -366,16 +366,22 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci, + /* Must be called with xhci->lock held, releases and aquires lock back */ + static int xhci_abort_cmd_ring(struct xhci_hcd *xhci, unsigned long flags) + { +- u64 temp_64; ++ u32 temp_32; + int ret; + + xhci_dbg(xhci, "Abort command ring\n"); + + reinit_completion(&xhci->cmd_ring_stop_completion); + +- temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); +- xhci_write_64(xhci, temp_64 | CMD_RING_ABORT, +- &xhci->op_regs->cmd_ring); ++ /* ++ * The control bits like command stop, abort are located in lower ++ * dword of the command ring control register. Limit the write ++ * to the lower dword to avoid corrupting the command ring pointer ++ * in case if the command ring is stopped by the time upper dword ++ * is written. ++ */ ++ temp_32 = readl(&xhci->op_regs->cmd_ring); ++ writel(temp_32 | CMD_RING_ABORT, &xhci->op_regs->cmd_ring); + + /* Section 4.6.1.2 of xHCI 1.0 spec says software should also time the + * completion of the Command Abort operation. If CRR is not negated in 5 +@@ -559,8 +565,11 @@ static int xhci_move_dequeue_past_td(struct xhci_hcd *xhci, + struct xhci_ring *ep_ring; + struct xhci_command *cmd; + struct xhci_segment *new_seg; ++ struct xhci_segment *halted_seg = NULL; + union xhci_trb *new_deq; + int new_cycle; ++ union xhci_trb *halted_trb; ++ int index = 0; + dma_addr_t addr; + u64 hw_dequeue; + bool cycle_found = false; +@@ -598,7 +607,27 @@ static int xhci_move_dequeue_past_td(struct xhci_hcd *xhci, + hw_dequeue = xhci_get_hw_deq(xhci, dev, ep_index, stream_id); + new_seg = ep_ring->deq_seg; + new_deq = ep_ring->dequeue; +- new_cycle = hw_dequeue & 0x1; ++ ++ /* ++ * Quirk: xHC write-back of the DCS field in the hardware dequeue ++ * pointer is wrong - use the cycle state of the TRB pointed to by ++ * the dequeue pointer. ++ */ ++ if (xhci->quirks & XHCI_EP_CTX_BROKEN_DCS && ++ !(ep->ep_state & EP_HAS_STREAMS)) ++ halted_seg = trb_in_td(xhci, td->start_seg, ++ td->first_trb, td->last_trb, ++ hw_dequeue & ~0xf, false); ++ if (halted_seg) { ++ index = ((dma_addr_t)(hw_dequeue & ~0xf) - halted_seg->dma) / ++ sizeof(*halted_trb); ++ halted_trb = &halted_seg->trbs[index]; ++ new_cycle = halted_trb->generic.field[3] & 0x1; ++ xhci_dbg(xhci, "Endpoint DCS = %d TRB index = %d cycle = %d\n", ++ (u8)(hw_dequeue & 0x1), index, new_cycle); ++ } else { ++ new_cycle = hw_dequeue & 0x1; ++ } + + /* + * We want to find the pointer, segment and cycle state of the new trb +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c +index 4a1346e3de1b2..cb730683f898f 100644 +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -3212,10 +3212,13 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd, + return; + + /* Bail out if toggle is already being cleared by a endpoint reset */ ++ spin_lock_irqsave(&xhci->lock, flags); + if (ep->ep_state & EP_HARD_CLEAR_TOGGLE) { + ep->ep_state &= ~EP_HARD_CLEAR_TOGGLE; ++ spin_unlock_irqrestore(&xhci->lock, flags); + return; + } ++ spin_unlock_irqrestore(&xhci->lock, flags); + /* Only interrupt and bulk ep's use data toggle, USB2 spec 5.5.4-> */ + if (usb_endpoint_xfer_control(&host_ep->desc) || + usb_endpoint_xfer_isoc(&host_ep->desc)) +@@ -3301,8 +3304,10 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd, + xhci_free_command(xhci, cfg_cmd); + cleanup: + xhci_free_command(xhci, stop_cmd); ++ spin_lock_irqsave(&xhci->lock, flags); + if (ep->ep_state & EP_SOFT_CLEAR_TOGGLE) + ep->ep_state &= ~EP_SOFT_CLEAR_TOGGLE; ++ spin_unlock_irqrestore(&xhci->lock, flags); + } + + static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, +diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h +index dca6181c33fdb..5a75fe5631238 100644 +--- a/drivers/usb/host/xhci.h ++++ b/drivers/usb/host/xhci.h +@@ -1899,6 +1899,7 @@ struct xhci_hcd { + #define XHCI_SG_TRB_CACHE_SIZE_QUIRK BIT_ULL(39) + #define XHCI_NO_SOFT_RETRY BIT_ULL(40) + #define XHCI_BROKEN_D3COLD BIT_ULL(41) ++#define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) + + unsigned int num_active_eps; + unsigned int limit_active_eps; +diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c +index ce9fc46c92661..b5935834f9d24 100644 +--- a/drivers/usb/musb/musb_dsps.c ++++ b/drivers/usb/musb/musb_dsps.c +@@ -899,11 +899,13 @@ static int dsps_probe(struct platform_device *pdev) + if (usb_get_dr_mode(&pdev->dev) == USB_DR_MODE_PERIPHERAL) { + ret = dsps_setup_optional_vbus_irq(pdev, glue); + if (ret) +- goto err; ++ goto unregister_pdev; + } + + return 0; + ++unregister_pdev: ++ platform_device_unregister(glue->musb); + err: + pm_runtime_disable(&pdev->dev); + iounmap(glue->usbss_base); +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c +index 6cfb5d33609fb..a484ff5e4ebf8 100644 +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -246,11 +246,13 @@ static void option_instat_callback(struct urb *urb); + /* These Quectel products use Quectel's vendor ID */ + #define QUECTEL_PRODUCT_EC21 0x0121 + #define QUECTEL_PRODUCT_EC25 0x0125 ++#define QUECTEL_PRODUCT_EG91 0x0191 + #define QUECTEL_PRODUCT_EG95 0x0195 + #define QUECTEL_PRODUCT_BG96 0x0296 + #define QUECTEL_PRODUCT_EP06 0x0306 + #define QUECTEL_PRODUCT_EM12 0x0512 + #define QUECTEL_PRODUCT_RM500Q 0x0800 ++#define QUECTEL_PRODUCT_EC200S_CN 0x6002 + #define QUECTEL_PRODUCT_EC200T 0x6026 + + #define CMOTECH_VENDOR_ID 0x16d8 +@@ -1111,6 +1113,9 @@ static const struct usb_device_id option_ids[] = { + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0xff, 0xff), + .driver_info = NUMEP2 }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0, 0) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG91, 0xff, 0xff, 0xff), ++ .driver_info = NUMEP2 }, ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG91, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff), + .driver_info = NUMEP2 }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) }, +@@ -1128,6 +1133,7 @@ static const struct usb_device_id option_ids[] = { + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x10), + .driver_info = ZLP }, ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) }, + + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, +@@ -1227,6 +1233,8 @@ static const struct usb_device_id option_ids[] = { + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1203, 0xff), /* Telit LE910Cx (RNDIS) */ + .driver_info = NCTRL(2) | RSVD(3) }, ++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1204, 0xff), /* Telit LE910Cx (MBIM) */ ++ .driver_info = NCTRL(0) | RSVD(1) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) | RSVD(3) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), +diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c +index 83da8236e3c8b..c18bf8164bc2e 100644 +--- a/drivers/usb/serial/qcserial.c ++++ b/drivers/usb/serial/qcserial.c +@@ -165,6 +165,7 @@ static const struct usb_device_id id_table[] = { + {DEVICE_SWI(0x1199, 0x907b)}, /* Sierra Wireless EM74xx */ + {DEVICE_SWI(0x1199, 0x9090)}, /* Sierra Wireless EM7565 QDL */ + {DEVICE_SWI(0x1199, 0x9091)}, /* Sierra Wireless EM7565 */ ++ {DEVICE_SWI(0x1199, 0x90d2)}, /* Sierra Wireless EM9191 QDL */ + {DEVICE_SWI(0x413c, 0x81a2)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ + {DEVICE_SWI(0x413c, 0x81a3)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ + {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ +diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c +index 9479f7f792173..55ec22f4ef901 100644 +--- a/drivers/vhost/vdpa.c ++++ b/drivers/vhost/vdpa.c +@@ -316,7 +316,7 @@ static long vhost_vdpa_set_config_call(struct vhost_vdpa *v, u32 __user *argp) + struct eventfd_ctx *ctx; + + cb.callback = vhost_vdpa_config_cb; +- cb.private = v->vdpa; ++ cb.private = v; + if (copy_from_user(&fd, argp, sizeof(fd))) + return -EFAULT; + +diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c +index 49984d2cba246..581871e707eb2 100644 +--- a/drivers/virtio/virtio.c ++++ b/drivers/virtio/virtio.c +@@ -238,6 +238,17 @@ static int virtio_dev_probe(struct device *_d) + driver_features_legacy = driver_features; + } + ++ /* ++ * Some devices detect legacy solely via F_VERSION_1. Write ++ * F_VERSION_1 to force LE config space accesses before FEATURES_OK for ++ * these when needed. ++ */ ++ if (drv->validate && !virtio_legacy_is_little_endian() ++ && device_features & BIT_ULL(VIRTIO_F_VERSION_1)) { ++ dev->features = BIT_ULL(VIRTIO_F_VERSION_1); ++ dev->config->finalize_features(dev); ++ } ++ + if (device_features & (1ULL << VIRTIO_F_VERSION_1)) + dev->features = driver_features & device_features; + else +diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c +index 268ce58d45697..5fec2706490ca 100644 +--- a/fs/btrfs/extent-tree.c ++++ b/fs/btrfs/extent-tree.c +@@ -4859,6 +4859,7 @@ struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans, + out_free_delayed: + btrfs_free_delayed_extent_op(extent_op); + out_free_buf: ++ btrfs_tree_unlock(buf); + free_extent_buffer(buf); + out_free_reserved: + btrfs_free_reserved_extent(fs_info, ins.objectid, ins.offset, 0); +diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c +index ee34497500e16..ba44039071e5b 100644 +--- a/fs/btrfs/file.c ++++ b/fs/btrfs/file.c +@@ -733,8 +733,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, + if (args->start >= inode->disk_i_size && !args->replace_extent) + modify_tree = 0; + +- update_refs = (test_bit(BTRFS_ROOT_SHAREABLE, &root->state) || +- root == fs_info->tree_root); ++ update_refs = (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID); + while (1) { + recow = 0; + ret = btrfs_lookup_file_extent(trans, root, path, ino, +@@ -2692,14 +2691,16 @@ int btrfs_replace_file_extents(struct btrfs_inode *inode, + drop_args.bytes_found); + if (ret != -ENOSPC) { + /* +- * When cloning we want to avoid transaction aborts when +- * nothing was done and we are attempting to clone parts +- * of inline extents, in such cases -EOPNOTSUPP is +- * returned by __btrfs_drop_extents() without having +- * changed anything in the file. ++ * The only time we don't want to abort is if we are ++ * attempting to clone a partial inline extent, in which ++ * case we'll get EOPNOTSUPP. However if we aren't ++ * clone we need to abort no matter what, because if we ++ * got EOPNOTSUPP via prealloc then we messed up and ++ * need to abort. + */ +- if (extent_info && !extent_info->is_new_extent && +- ret && ret != -EOPNOTSUPP) ++ if (ret && ++ (ret != -EOPNOTSUPP || ++ (extent_info && extent_info->is_new_extent))) + btrfs_abort_transaction(trans, ret); + break; + } +diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c +index 7037e5855d2a8..17f0de5bb8733 100644 +--- a/fs/btrfs/tree-log.c ++++ b/fs/btrfs/tree-log.c +@@ -1182,7 +1182,10 @@ next: + /* look for a conflicting sequence number */ + di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(dir), + ref_index, name, namelen, 0); +- if (di && !IS_ERR(di)) { ++ if (IS_ERR(di)) { ++ if (PTR_ERR(di) != -ENOENT) ++ return PTR_ERR(di); ++ } else if (di) { + ret = drop_one_dir_item(trans, root, path, dir, di); + if (ret) + return ret; +@@ -1192,7 +1195,9 @@ next: + /* look for a conflicting name */ + di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(dir), + name, namelen, 0); +- if (di && !IS_ERR(di)) { ++ if (IS_ERR(di)) { ++ return PTR_ERR(di); ++ } else if (di) { + ret = drop_one_dir_item(trans, root, path, dir, di); + if (ret) + return ret; +@@ -1936,8 +1941,8 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, + struct btrfs_key log_key; + struct inode *dir; + u8 log_type; +- int exists; +- int ret = 0; ++ bool exists; ++ int ret; + bool update_size = (key->type == BTRFS_DIR_INDEX_KEY); + bool name_added = false; + +@@ -1957,12 +1962,12 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, + name_len); + + btrfs_dir_item_key_to_cpu(eb, di, &log_key); +- exists = btrfs_lookup_inode(trans, root, path, &log_key, 0); +- if (exists == 0) +- exists = 1; +- else +- exists = 0; ++ ret = btrfs_lookup_inode(trans, root, path, &log_key, 0); + btrfs_release_path(path); ++ if (ret < 0) ++ goto out; ++ exists = (ret == 0); ++ ret = 0; + + if (key->type == BTRFS_DIR_ITEM_KEY) { + dst_di = btrfs_lookup_dir_item(trans, root, path, key->objectid, +@@ -1977,7 +1982,14 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, + ret = -EINVAL; + goto out; + } +- if (IS_ERR_OR_NULL(dst_di)) { ++ ++ if (dst_di == ERR_PTR(-ENOENT)) ++ dst_di = NULL; ++ ++ if (IS_ERR(dst_di)) { ++ ret = PTR_ERR(dst_di); ++ goto out; ++ } else if (!dst_di) { + /* we need a sequence number to insert, so we only + * do inserts for the BTRFS_DIR_INDEX_KEY types + */ +diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h +index 6bbae0c3bc0b9..681bea6716dde 100644 +--- a/include/linux/mlx5/mlx5_ifc.h ++++ b/include/linux/mlx5/mlx5_ifc.h +@@ -9467,16 +9467,22 @@ struct mlx5_ifc_pcmr_reg_bits { + u8 reserved_at_0[0x8]; + u8 local_port[0x8]; + u8 reserved_at_10[0x10]; ++ + u8 entropy_force_cap[0x1]; + u8 entropy_calc_cap[0x1]; + u8 entropy_gre_calc_cap[0x1]; +- u8 reserved_at_23[0x1b]; ++ u8 reserved_at_23[0xf]; ++ u8 rx_ts_over_crc_cap[0x1]; ++ u8 reserved_at_33[0xb]; + u8 fcs_cap[0x1]; + u8 reserved_at_3f[0x1]; ++ + u8 entropy_force[0x1]; + u8 entropy_calc[0x1]; + u8 entropy_gre_calc[0x1]; +- u8 reserved_at_43[0x1b]; ++ u8 reserved_at_43[0xf]; ++ u8 rx_ts_over_crc[0x1]; ++ u8 reserved_at_53[0xb]; + u8 fcs_chk[0x1]; + u8 reserved_at_5f[0x1]; + }; +diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h +index 2f5ce4d4fdbff..4984093882372 100644 +--- a/include/soc/mscc/ocelot.h ++++ b/include/soc/mscc/ocelot.h +@@ -600,10 +600,10 @@ struct ocelot_port { + /* The VLAN ID that will be transmitted as untagged, on egress */ + struct ocelot_vlan native_vlan; + ++ unsigned int ptp_skbs_in_flight; + u8 ptp_cmd; + struct sk_buff_head tx_skbs; + u8 ts_id; +- spinlock_t ts_id_lock; + + phy_interface_t phy_mode; + +@@ -677,6 +677,9 @@ struct ocelot { + struct ptp_clock *ptp_clock; + struct ptp_clock_info ptp_info; + struct hwtstamp_config hwtstamp_config; ++ unsigned int ptp_skbs_in_flight; ++ /* Protects the 2-step TX timestamp ID logic */ ++ spinlock_t ts_id_lock; + /* Protects the PTP interface state */ + struct mutex ptp_lock; + /* Protects the PTP clock */ +@@ -691,6 +694,7 @@ struct ocelot_policer { + + struct ocelot_skb_cb { + struct sk_buff *clone; ++ unsigned int ptp_class; /* valid only for clones */ + u8 ptp_cmd; + u8 ts_id; + }; +diff --git a/include/soc/mscc/ocelot_ptp.h b/include/soc/mscc/ocelot_ptp.h +index ded497d72bdbb..f085884b1fa27 100644 +--- a/include/soc/mscc/ocelot_ptp.h ++++ b/include/soc/mscc/ocelot_ptp.h +@@ -13,6 +13,9 @@ + #include + #include + ++#define OCELOT_MAX_PTP_ID 63 ++#define OCELOT_PTP_FIFO_SIZE 128 ++ + #define PTP_PIN_CFG_RSZ 0x20 + #define PTP_PIN_TOD_SEC_MSB_RSZ PTP_PIN_CFG_RSZ + #define PTP_PIN_TOD_SEC_LSB_RSZ PTP_PIN_CFG_RSZ +diff --git a/kernel/module.c b/kernel/module.c +index ed13917ea5f39..d184be24b9eac 100644 +--- a/kernel/module.c ++++ b/kernel/module.c +@@ -4484,8 +4484,10 @@ static void cfi_init(struct module *mod) + /* Fix init/exit functions to point to the CFI jump table */ + if (init) + mod->init = *init; ++#ifdef CONFIG_MODULE_UNLOAD + if (exit) + mod->exit = *exit; ++#endif + + cfi_module_add(mod, module_addr_min); + #endif +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c +index a1adb29ef5c18..f4aa00a58f3c6 100644 +--- a/kernel/trace/trace.c ++++ b/kernel/trace/trace.c +@@ -1744,16 +1744,15 @@ void latency_fsnotify(struct trace_array *tr) + irq_work_queue(&tr->fsnotify_irqwork); + } + +-/* +- * (defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER)) && \ +- * defined(CONFIG_FSNOTIFY) +- */ +-#else ++#elif defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER) \ ++ || defined(CONFIG_OSNOISE_TRACER) + + #define trace_create_maxlat_file(tr, d_tracer) \ + trace_create_file("tracing_max_latency", 0644, d_tracer, \ + &tr->max_latency, &tracing_max_lat_fops) + ++#else ++#define trace_create_maxlat_file(tr, d_tracer) do { } while (0) + #endif + + #ifdef CONFIG_TRACER_MAX_TRACE +@@ -9457,9 +9456,7 @@ init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer) + + create_trace_options_dir(tr); + +-#if defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER) + trace_create_maxlat_file(tr, d_tracer); +-#endif + + if (ftrace_create_function_files(tr, d_tracer)) + MEM_FAIL(1, "Could not allocate function filter files"); +diff --git a/net/dsa/switch.c b/net/dsa/switch.c +index 5ece05dfd8f2c..9ef9125713321 100644 +--- a/net/dsa/switch.c ++++ b/net/dsa/switch.c +@@ -148,7 +148,7 @@ static int dsa_switch_bridge_leave(struct dsa_switch *ds, + if (extack._msg) + dev_err(ds->dev, "port %d: %s\n", info->port, + extack._msg); +- if (err && err != EOPNOTSUPP) ++ if (err && err != -EOPNOTSUPP) + return err; + } + return 0; +diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c +index 4d2abdd3cd3b1..e7ea062876f7c 100644 +--- a/net/mptcp/protocol.c ++++ b/net/mptcp/protocol.c +@@ -515,7 +515,6 @@ static bool mptcp_check_data_fin(struct sock *sk) + + sk->sk_shutdown |= RCV_SHUTDOWN; + smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ +- set_bit(MPTCP_DATA_READY, &msk->flags); + + switch (sk->sk_state) { + case TCP_ESTABLISHED: +@@ -730,10 +729,9 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk) + + /* Wake-up the reader only for in-sequence data */ + mptcp_data_lock(sk); +- if (move_skbs_to_msk(msk, ssk)) { +- set_bit(MPTCP_DATA_READY, &msk->flags); ++ if (move_skbs_to_msk(msk, ssk)) + sk->sk_data_ready(sk); +- } ++ + mptcp_data_unlock(sk); + } + +@@ -838,7 +836,6 @@ static void mptcp_check_for_eof(struct mptcp_sock *msk) + sk->sk_shutdown |= RCV_SHUTDOWN; + + smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ +- set_bit(MPTCP_DATA_READY, &msk->flags); + sk->sk_data_ready(sk); + } + +@@ -1701,21 +1698,6 @@ out: + return copied ? : ret; + } + +-static void mptcp_wait_data(struct sock *sk, long *timeo) +-{ +- DEFINE_WAIT_FUNC(wait, woken_wake_function); +- struct mptcp_sock *msk = mptcp_sk(sk); +- +- add_wait_queue(sk_sleep(sk), &wait); +- sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk); +- +- sk_wait_event(sk, timeo, +- test_bit(MPTCP_DATA_READY, &msk->flags), &wait); +- +- sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk); +- remove_wait_queue(sk_sleep(sk), &wait); +-} +- + static int __mptcp_recvmsg_mskq(struct mptcp_sock *msk, + struct msghdr *msg, + size_t len, int flags, +@@ -2019,19 +2001,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, + } + + pr_debug("block timeout %ld", timeo); +- mptcp_wait_data(sk, &timeo); +- } +- +- if (skb_queue_empty_lockless(&sk->sk_receive_queue) && +- skb_queue_empty(&msk->receive_queue)) { +- /* entire backlog drained, clear DATA_READY. */ +- clear_bit(MPTCP_DATA_READY, &msk->flags); +- +- /* .. race-breaker: ssk might have gotten new data +- * after last __mptcp_move_skbs() returned false. +- */ +- if (unlikely(__mptcp_move_skbs(msk))) +- set_bit(MPTCP_DATA_READY, &msk->flags); ++ sk_wait_data(sk, &timeo, NULL); + } + + out_err: +@@ -2040,9 +2010,9 @@ out_err: + tcp_recv_timestamp(msg, sk, &tss); + } + +- pr_debug("msk=%p data_ready=%d rx queue empty=%d copied=%d", +- msk, test_bit(MPTCP_DATA_READY, &msk->flags), +- skb_queue_empty_lockless(&sk->sk_receive_queue), copied); ++ pr_debug("msk=%p rx queue empty=%d:%d copied=%d", ++ msk, skb_queue_empty_lockless(&sk->sk_receive_queue), ++ skb_queue_empty(&msk->receive_queue), copied); + if (!(flags & MSG_PEEK)) + mptcp_rcv_space_adjust(msk, copied); + +@@ -2255,7 +2225,6 @@ static void mptcp_check_fastclose(struct mptcp_sock *msk) + inet_sk_state_store(sk, TCP_CLOSE); + sk->sk_shutdown = SHUTDOWN_MASK; + smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ +- set_bit(MPTCP_DATA_READY, &msk->flags); + set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags); + + mptcp_close_wake_up(sk); +@@ -3272,8 +3241,14 @@ unlock_fail: + + static __poll_t mptcp_check_readable(struct mptcp_sock *msk) + { +- return test_bit(MPTCP_DATA_READY, &msk->flags) ? EPOLLIN | EPOLLRDNORM : +- 0; ++ /* Concurrent splices from sk_receive_queue into receive_queue will ++ * always show at least one non-empty queue when checked in this order. ++ */ ++ if (skb_queue_empty_lockless(&((struct sock *)msk)->sk_receive_queue) && ++ skb_queue_empty_lockless(&msk->receive_queue)) ++ return 0; ++ ++ return EPOLLIN | EPOLLRDNORM; + } + + static __poll_t mptcp_check_writeable(struct mptcp_sock *msk) +@@ -3308,7 +3283,7 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock, + state = inet_sk_state_load(sk); + pr_debug("msk=%p state=%d flags=%lx", msk, state, msk->flags); + if (state == TCP_LISTEN) +- return mptcp_check_readable(msk); ++ return test_bit(MPTCP_DATA_READY, &msk->flags) ? EPOLLIN | EPOLLRDNORM : 0; + + if (state != TCP_SYN_SENT && state != TCP_SYN_RECV) { + mask |= mptcp_check_readable(msk); +diff --git a/net/nfc/af_nfc.c b/net/nfc/af_nfc.c +index 4a9e72073564a..581358dcbdf8d 100644 +--- a/net/nfc/af_nfc.c ++++ b/net/nfc/af_nfc.c +@@ -60,6 +60,9 @@ int nfc_proto_register(const struct nfc_protocol *nfc_proto) + proto_tab[nfc_proto->id] = nfc_proto; + write_unlock(&proto_tab_lock); + ++ if (rc) ++ proto_unregister(nfc_proto->proto); ++ + return rc; + } + EXPORT_SYMBOL(nfc_proto_register); +diff --git a/net/nfc/digital_core.c b/net/nfc/digital_core.c +index 5044c7db577eb..c8fc9fcbb0a72 100644 +--- a/net/nfc/digital_core.c ++++ b/net/nfc/digital_core.c +@@ -277,6 +277,7 @@ int digital_tg_configure_hw(struct nfc_digital_dev *ddev, int type, int param) + static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech) + { + struct digital_tg_mdaa_params *params; ++ int rc; + + params = kzalloc(sizeof(*params), GFP_KERNEL); + if (!params) +@@ -291,8 +292,12 @@ static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech) + get_random_bytes(params->nfcid2 + 2, NFC_NFCID2_MAXSIZE - 2); + params->sc = DIGITAL_SENSF_FELICA_SC; + +- return digital_send_cmd(ddev, DIGITAL_CMD_TG_LISTEN_MDAA, NULL, params, +- 500, digital_tg_recv_atr_req, NULL); ++ rc = digital_send_cmd(ddev, DIGITAL_CMD_TG_LISTEN_MDAA, NULL, params, ++ 500, digital_tg_recv_atr_req, NULL); ++ if (rc) ++ kfree(params); ++ ++ return rc; + } + + static int digital_tg_listen_md(struct nfc_digital_dev *ddev, u8 rf_tech) +diff --git a/net/nfc/digital_technology.c b/net/nfc/digital_technology.c +index 84d2345c75a3f..3adf4589852af 100644 +--- a/net/nfc/digital_technology.c ++++ b/net/nfc/digital_technology.c +@@ -465,8 +465,12 @@ static int digital_in_send_sdd_req(struct nfc_digital_dev *ddev, + skb_put_u8(skb, sel_cmd); + skb_put_u8(skb, DIGITAL_SDD_REQ_SEL_PAR); + +- return digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sdd_res, +- target); ++ rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sdd_res, ++ target); ++ if (rc) ++ kfree_skb(skb); ++ ++ return rc; + } + + static void digital_in_recv_sens_res(struct nfc_digital_dev *ddev, void *arg, +diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c +index 8766ab5b87880..5eb3b1b7ae5e7 100644 +--- a/net/sched/sch_mqprio.c ++++ b/net/sched/sch_mqprio.c +@@ -529,22 +529,28 @@ static int mqprio_dump_class_stats(struct Qdisc *sch, unsigned long cl, + for (i = tc.offset; i < tc.offset + tc.count; i++) { + struct netdev_queue *q = netdev_get_tx_queue(dev, i); + struct Qdisc *qdisc = rtnl_dereference(q->qdisc); +- struct gnet_stats_basic_cpu __percpu *cpu_bstats = NULL; +- struct gnet_stats_queue __percpu *cpu_qstats = NULL; + + spin_lock_bh(qdisc_lock(qdisc)); ++ + if (qdisc_is_percpu_stats(qdisc)) { +- cpu_bstats = qdisc->cpu_bstats; +- cpu_qstats = qdisc->cpu_qstats; ++ qlen = qdisc_qlen_sum(qdisc); ++ ++ __gnet_stats_copy_basic(NULL, &bstats, ++ qdisc->cpu_bstats, ++ &qdisc->bstats); ++ __gnet_stats_copy_queue(&qstats, ++ qdisc->cpu_qstats, ++ &qdisc->qstats, ++ qlen); ++ } else { ++ qlen += qdisc->q.qlen; ++ bstats.bytes += qdisc->bstats.bytes; ++ bstats.packets += qdisc->bstats.packets; ++ qstats.backlog += qdisc->qstats.backlog; ++ qstats.drops += qdisc->qstats.drops; ++ qstats.requeues += qdisc->qstats.requeues; ++ qstats.overlimits += qdisc->qstats.overlimits; + } +- +- qlen = qdisc_qlen_sum(qdisc); +- __gnet_stats_copy_basic(NULL, &sch->bstats, +- cpu_bstats, &qdisc->bstats); +- __gnet_stats_copy_queue(&sch->qstats, +- cpu_qstats, +- &qdisc->qstats, +- qlen); + spin_unlock_bh(qdisc_lock(qdisc)); + } + +diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c +index b8fa8f1a72770..c7503fd649159 100644 +--- a/net/sctp/sm_make_chunk.c ++++ b/net/sctp/sm_make_chunk.c +@@ -3697,7 +3697,7 @@ struct sctp_chunk *sctp_make_strreset_req( + outlen = (sizeof(outreq) + stream_len) * out; + inlen = (sizeof(inreq) + stream_len) * in; + +- retval = sctp_make_reconf(asoc, outlen + inlen); ++ retval = sctp_make_reconf(asoc, SCTP_PAD4(outlen) + SCTP_PAD4(inlen)); + if (!retval) + return NULL; + +diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c +index f23f558054a7c..99acd337ba90d 100644 +--- a/net/smc/smc_cdc.c ++++ b/net/smc/smc_cdc.c +@@ -150,9 +150,11 @@ static int smcr_cdc_get_slot_and_msg_send(struct smc_connection *conn) + + again: + link = conn->lnk; ++ if (!smc_wr_tx_link_hold(link)) ++ return -ENOLINK; + rc = smc_cdc_get_free_slot(conn, link, &wr_buf, NULL, &pend); + if (rc) +- return rc; ++ goto put_out; + + spin_lock_bh(&conn->send_lock); + if (link != conn->lnk) { +@@ -160,6 +162,7 @@ again: + spin_unlock_bh(&conn->send_lock); + smc_wr_tx_put_slot(link, + (struct smc_wr_tx_pend_priv *)pend); ++ smc_wr_tx_link_put(link); + if (again) + return -ENOLINK; + again = true; +@@ -167,6 +170,8 @@ again: + } + rc = smc_cdc_msg_send(conn, wr_buf, pend); + spin_unlock_bh(&conn->send_lock); ++put_out: ++ smc_wr_tx_link_put(link); + return rc; + } + +diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c +index 116cfd6fac1ff..fa53b2146d8c0 100644 +--- a/net/smc/smc_core.c ++++ b/net/smc/smc_core.c +@@ -949,7 +949,7 @@ struct smc_link *smc_switch_conns(struct smc_link_group *lgr, + to_lnk = &lgr->lnk[i]; + break; + } +- if (!to_lnk) { ++ if (!to_lnk || !smc_wr_tx_link_hold(to_lnk)) { + smc_lgr_terminate_sched(lgr); + return NULL; + } +@@ -981,24 +981,26 @@ again: + read_unlock_bh(&lgr->conns_lock); + /* pre-fetch buffer outside of send_lock, might sleep */ + rc = smc_cdc_get_free_slot(conn, to_lnk, &wr_buf, NULL, &pend); +- if (rc) { +- smcr_link_down_cond_sched(to_lnk); +- return NULL; +- } ++ if (rc) ++ goto err_out; + /* avoid race with smcr_tx_sndbuf_nonempty() */ + spin_lock_bh(&conn->send_lock); + smc_switch_link_and_count(conn, to_lnk); + rc = smc_switch_cursor(smc, pend, wr_buf); + spin_unlock_bh(&conn->send_lock); + sock_put(&smc->sk); +- if (rc) { +- smcr_link_down_cond_sched(to_lnk); +- return NULL; +- } ++ if (rc) ++ goto err_out; + goto again; + } + read_unlock_bh(&lgr->conns_lock); ++ smc_wr_tx_link_put(to_lnk); + return to_lnk; ++ ++err_out: ++ smcr_link_down_cond_sched(to_lnk); ++ smc_wr_tx_link_put(to_lnk); ++ return NULL; + } + + static void smcr_buf_unuse(struct smc_buf_desc *rmb_desc, +diff --git a/net/smc/smc_llc.c b/net/smc/smc_llc.c +index 2e7560eba9812..72f4b72eb1753 100644 +--- a/net/smc/smc_llc.c ++++ b/net/smc/smc_llc.c +@@ -383,9 +383,11 @@ int smc_llc_send_confirm_link(struct smc_link *link, + struct smc_wr_buf *wr_buf; + int rc; + ++ if (!smc_wr_tx_link_hold(link)) ++ return -ENOLINK; + rc = smc_llc_add_pending_send(link, &wr_buf, &pend); + if (rc) +- return rc; ++ goto put_out; + confllc = (struct smc_llc_msg_confirm_link *)wr_buf; + memset(confllc, 0, sizeof(*confllc)); + confllc->hd.common.type = SMC_LLC_CONFIRM_LINK; +@@ -402,6 +404,8 @@ int smc_llc_send_confirm_link(struct smc_link *link, + confllc->max_links = SMC_LLC_ADD_LNK_MAX_LINKS; + /* send llc message */ + rc = smc_wr_tx_send(link, pend); ++put_out: ++ smc_wr_tx_link_put(link); + return rc; + } + +@@ -415,9 +419,11 @@ static int smc_llc_send_confirm_rkey(struct smc_link *send_link, + struct smc_link *link; + int i, rc, rtok_ix; + ++ if (!smc_wr_tx_link_hold(send_link)) ++ return -ENOLINK; + rc = smc_llc_add_pending_send(send_link, &wr_buf, &pend); + if (rc) +- return rc; ++ goto put_out; + rkeyllc = (struct smc_llc_msg_confirm_rkey *)wr_buf; + memset(rkeyllc, 0, sizeof(*rkeyllc)); + rkeyllc->hd.common.type = SMC_LLC_CONFIRM_RKEY; +@@ -444,6 +450,8 @@ static int smc_llc_send_confirm_rkey(struct smc_link *send_link, + (u64)sg_dma_address(rmb_desc->sgt[send_link->link_idx].sgl)); + /* send llc message */ + rc = smc_wr_tx_send(send_link, pend); ++put_out: ++ smc_wr_tx_link_put(send_link); + return rc; + } + +@@ -456,9 +464,11 @@ static int smc_llc_send_delete_rkey(struct smc_link *link, + struct smc_wr_buf *wr_buf; + int rc; + ++ if (!smc_wr_tx_link_hold(link)) ++ return -ENOLINK; + rc = smc_llc_add_pending_send(link, &wr_buf, &pend); + if (rc) +- return rc; ++ goto put_out; + rkeyllc = (struct smc_llc_msg_delete_rkey *)wr_buf; + memset(rkeyllc, 0, sizeof(*rkeyllc)); + rkeyllc->hd.common.type = SMC_LLC_DELETE_RKEY; +@@ -467,6 +477,8 @@ static int smc_llc_send_delete_rkey(struct smc_link *link, + rkeyllc->rkey[0] = htonl(rmb_desc->mr_rx[link->link_idx]->rkey); + /* send llc message */ + rc = smc_wr_tx_send(link, pend); ++put_out: ++ smc_wr_tx_link_put(link); + return rc; + } + +@@ -480,9 +492,11 @@ int smc_llc_send_add_link(struct smc_link *link, u8 mac[], u8 gid[], + struct smc_wr_buf *wr_buf; + int rc; + ++ if (!smc_wr_tx_link_hold(link)) ++ return -ENOLINK; + rc = smc_llc_add_pending_send(link, &wr_buf, &pend); + if (rc) +- return rc; ++ goto put_out; + addllc = (struct smc_llc_msg_add_link *)wr_buf; + + memset(addllc, 0, sizeof(*addllc)); +@@ -504,6 +518,8 @@ int smc_llc_send_add_link(struct smc_link *link, u8 mac[], u8 gid[], + } + /* send llc message */ + rc = smc_wr_tx_send(link, pend); ++put_out: ++ smc_wr_tx_link_put(link); + return rc; + } + +@@ -517,9 +533,11 @@ int smc_llc_send_delete_link(struct smc_link *link, u8 link_del_id, + struct smc_wr_buf *wr_buf; + int rc; + ++ if (!smc_wr_tx_link_hold(link)) ++ return -ENOLINK; + rc = smc_llc_add_pending_send(link, &wr_buf, &pend); + if (rc) +- return rc; ++ goto put_out; + delllc = (struct smc_llc_msg_del_link *)wr_buf; + + memset(delllc, 0, sizeof(*delllc)); +@@ -536,6 +554,8 @@ int smc_llc_send_delete_link(struct smc_link *link, u8 link_del_id, + delllc->reason = htonl(reason); + /* send llc message */ + rc = smc_wr_tx_send(link, pend); ++put_out: ++ smc_wr_tx_link_put(link); + return rc; + } + +@@ -547,9 +567,11 @@ static int smc_llc_send_test_link(struct smc_link *link, u8 user_data[16]) + struct smc_wr_buf *wr_buf; + int rc; + ++ if (!smc_wr_tx_link_hold(link)) ++ return -ENOLINK; + rc = smc_llc_add_pending_send(link, &wr_buf, &pend); + if (rc) +- return rc; ++ goto put_out; + testllc = (struct smc_llc_msg_test_link *)wr_buf; + memset(testllc, 0, sizeof(*testllc)); + testllc->hd.common.type = SMC_LLC_TEST_LINK; +@@ -557,6 +579,8 @@ static int smc_llc_send_test_link(struct smc_link *link, u8 user_data[16]) + memcpy(testllc->user_data, user_data, sizeof(testllc->user_data)); + /* send llc message */ + rc = smc_wr_tx_send(link, pend); ++put_out: ++ smc_wr_tx_link_put(link); + return rc; + } + +@@ -567,13 +591,16 @@ static int smc_llc_send_message(struct smc_link *link, void *llcbuf) + struct smc_wr_buf *wr_buf; + int rc; + +- if (!smc_link_usable(link)) ++ if (!smc_wr_tx_link_hold(link)) + return -ENOLINK; + rc = smc_llc_add_pending_send(link, &wr_buf, &pend); + if (rc) +- return rc; ++ goto put_out; + memcpy(wr_buf, llcbuf, sizeof(union smc_llc_msg)); +- return smc_wr_tx_send(link, pend); ++ rc = smc_wr_tx_send(link, pend); ++put_out: ++ smc_wr_tx_link_put(link); ++ return rc; + } + + /* schedule an llc send on link, may wait for buffers, +@@ -586,13 +613,16 @@ static int smc_llc_send_message_wait(struct smc_link *link, void *llcbuf) + struct smc_wr_buf *wr_buf; + int rc; + +- if (!smc_link_usable(link)) ++ if (!smc_wr_tx_link_hold(link)) + return -ENOLINK; + rc = smc_llc_add_pending_send(link, &wr_buf, &pend); + if (rc) +- return rc; ++ goto put_out; + memcpy(wr_buf, llcbuf, sizeof(union smc_llc_msg)); +- return smc_wr_tx_send_wait(link, pend, SMC_LLC_WAIT_TIME); ++ rc = smc_wr_tx_send_wait(link, pend, SMC_LLC_WAIT_TIME); ++put_out: ++ smc_wr_tx_link_put(link); ++ return rc; + } + + /********************************* receive ***********************************/ +@@ -672,9 +702,11 @@ static int smc_llc_add_link_cont(struct smc_link *link, + struct smc_buf_desc *rmb; + u8 n; + ++ if (!smc_wr_tx_link_hold(link)) ++ return -ENOLINK; + rc = smc_llc_add_pending_send(link, &wr_buf, &pend); + if (rc) +- return rc; ++ goto put_out; + addc_llc = (struct smc_llc_msg_add_link_cont *)wr_buf; + memset(addc_llc, 0, sizeof(*addc_llc)); + +@@ -706,7 +738,10 @@ static int smc_llc_add_link_cont(struct smc_link *link, + addc_llc->hd.length = sizeof(struct smc_llc_msg_add_link_cont); + if (lgr->role == SMC_CLNT) + addc_llc->hd.flags |= SMC_LLC_FLAG_RESP; +- return smc_wr_tx_send(link, pend); ++ rc = smc_wr_tx_send(link, pend); ++put_out: ++ smc_wr_tx_link_put(link); ++ return rc; + } + + static int smc_llc_cli_rkey_exchange(struct smc_link *link, +diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c +index c79361dfcdfb9..738a4a99c8279 100644 +--- a/net/smc/smc_tx.c ++++ b/net/smc/smc_tx.c +@@ -496,7 +496,7 @@ static int smc_tx_rdma_writes(struct smc_connection *conn, + /* Wakeup sndbuf consumers from any context (IRQ or process) + * since there is more data to transmit; usable snd_wnd as max transmit + */ +-static int _smcr_tx_sndbuf_nonempty(struct smc_connection *conn) ++static int smcr_tx_sndbuf_nonempty(struct smc_connection *conn) + { + struct smc_cdc_producer_flags *pflags = &conn->local_tx_ctrl.prod_flags; + struct smc_link *link = conn->lnk; +@@ -505,8 +505,11 @@ static int _smcr_tx_sndbuf_nonempty(struct smc_connection *conn) + struct smc_wr_buf *wr_buf; + int rc; + ++ if (!link || !smc_wr_tx_link_hold(link)) ++ return -ENOLINK; + rc = smc_cdc_get_free_slot(conn, link, &wr_buf, &wr_rdma_buf, &pend); + if (rc < 0) { ++ smc_wr_tx_link_put(link); + if (rc == -EBUSY) { + struct smc_sock *smc = + container_of(conn, struct smc_sock, conn); +@@ -547,22 +550,7 @@ static int _smcr_tx_sndbuf_nonempty(struct smc_connection *conn) + + out_unlock: + spin_unlock_bh(&conn->send_lock); +- return rc; +-} +- +-static int smcr_tx_sndbuf_nonempty(struct smc_connection *conn) +-{ +- struct smc_link *link = conn->lnk; +- int rc = -ENOLINK; +- +- if (!link) +- return rc; +- +- atomic_inc(&link->wr_tx_refcnt); +- if (smc_link_usable(link)) +- rc = _smcr_tx_sndbuf_nonempty(conn); +- if (atomic_dec_and_test(&link->wr_tx_refcnt)) +- wake_up_all(&link->wr_tx_wait); ++ smc_wr_tx_link_put(link); + return rc; + } + +diff --git a/net/smc/smc_wr.h b/net/smc/smc_wr.h +index 423b8709f1c9e..2bc626f230a56 100644 +--- a/net/smc/smc_wr.h ++++ b/net/smc/smc_wr.h +@@ -60,6 +60,20 @@ static inline void smc_wr_tx_set_wr_id(atomic_long_t *wr_tx_id, long val) + atomic_long_set(wr_tx_id, val); + } + ++static inline bool smc_wr_tx_link_hold(struct smc_link *link) ++{ ++ if (!smc_link_usable(link)) ++ return false; ++ atomic_inc(&link->wr_tx_refcnt); ++ return true; ++} ++ ++static inline void smc_wr_tx_link_put(struct smc_link *link) ++{ ++ if (atomic_dec_and_test(&link->wr_tx_refcnt)) ++ wake_up_all(&link->wr_tx_wait); ++} ++ + static inline void smc_wr_wakeup_tx_wait(struct smc_link *lnk) + { + wake_up_all(&lnk->wr_tx_wait); +diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl +index 8f6b13ae46bfc..7d631aaa0ae11 100755 +--- a/scripts/recordmcount.pl ++++ b/scripts/recordmcount.pl +@@ -189,7 +189,7 @@ if ($arch =~ /(x86(_64)?)|(i386)/) { + $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)"; + $weak_regex = "^[0-9a-fA-F]+\\s+([wW])\\s+(\\S+)"; + $section_regex = "Disassembly of section\\s+(\\S+):"; +-$function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; ++$function_regex = "^([0-9a-fA-F]+)\\s+<([^^]*?)>:"; + $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s(mcount|__fentry__)\$"; + $section_type = '@progbits'; + $mcount_adjust = 0; +diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c +index a59de24695ec9..dfe5a64e19d2e 100644 +--- a/sound/core/pcm_compat.c ++++ b/sound/core/pcm_compat.c +@@ -468,6 +468,76 @@ static int snd_pcm_ioctl_sync_ptr_x32(struct snd_pcm_substream *substream, + } + #endif /* CONFIG_X86_X32 */ + ++#ifdef __BIG_ENDIAN ++typedef char __pad_before_u32[4]; ++typedef char __pad_after_u32[0]; ++#else ++typedef char __pad_before_u32[0]; ++typedef char __pad_after_u32[4]; ++#endif ++ ++/* PCM 2.0.15 API definition had a bug in mmap control; it puts the avail_min ++ * at the wrong offset due to a typo in padding type. ++ * The bug hits only 32bit. ++ * A workaround for incorrect read/write is needed only in 32bit compat mode. ++ */ ++struct __snd_pcm_mmap_control64_buggy { ++ __pad_before_u32 __pad1; ++ __u32 appl_ptr; ++ __pad_before_u32 __pad2; /* SiC! here is the bug */ ++ __pad_before_u32 __pad3; ++ __u32 avail_min; ++ __pad_after_uframe __pad4; ++}; ++ ++static int snd_pcm_ioctl_sync_ptr_buggy(struct snd_pcm_substream *substream, ++ struct snd_pcm_sync_ptr __user *_sync_ptr) ++{ ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ struct snd_pcm_sync_ptr sync_ptr; ++ struct __snd_pcm_mmap_control64_buggy *sync_cp; ++ volatile struct snd_pcm_mmap_status *status; ++ volatile struct snd_pcm_mmap_control *control; ++ int err; ++ ++ memset(&sync_ptr, 0, sizeof(sync_ptr)); ++ sync_cp = (struct __snd_pcm_mmap_control64_buggy *)&sync_ptr.c.control; ++ if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags))) ++ return -EFAULT; ++ if (copy_from_user(sync_cp, &(_sync_ptr->c.control), sizeof(*sync_cp))) ++ return -EFAULT; ++ status = runtime->status; ++ control = runtime->control; ++ if (sync_ptr.flags & SNDRV_PCM_SYNC_PTR_HWSYNC) { ++ err = snd_pcm_hwsync(substream); ++ if (err < 0) ++ return err; ++ } ++ snd_pcm_stream_lock_irq(substream); ++ if (!(sync_ptr.flags & SNDRV_PCM_SYNC_PTR_APPL)) { ++ err = pcm_lib_apply_appl_ptr(substream, sync_cp->appl_ptr); ++ if (err < 0) { ++ snd_pcm_stream_unlock_irq(substream); ++ return err; ++ } ++ } else { ++ sync_cp->appl_ptr = control->appl_ptr; ++ } ++ if (!(sync_ptr.flags & SNDRV_PCM_SYNC_PTR_AVAIL_MIN)) ++ control->avail_min = sync_cp->avail_min; ++ else ++ sync_cp->avail_min = control->avail_min; ++ sync_ptr.s.status.state = status->state; ++ sync_ptr.s.status.hw_ptr = status->hw_ptr; ++ sync_ptr.s.status.tstamp = status->tstamp; ++ sync_ptr.s.status.suspended_state = status->suspended_state; ++ sync_ptr.s.status.audio_tstamp = status->audio_tstamp; ++ snd_pcm_stream_unlock_irq(substream); ++ if (copy_to_user(_sync_ptr, &sync_ptr, sizeof(sync_ptr))) ++ return -EFAULT; ++ return 0; ++} ++ + /* + */ + enum { +@@ -537,7 +607,7 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned l + if (in_x32_syscall()) + return snd_pcm_ioctl_sync_ptr_x32(substream, argp); + #endif /* CONFIG_X86_X32 */ +- return snd_pcm_common_ioctl(file, substream, cmd, argp); ++ return snd_pcm_ioctl_sync_ptr_buggy(substream, argp); + case SNDRV_PCM_IOCTL_HW_REFINE32: + return snd_pcm_ioctl_hw_params_compat(substream, 1, argp); + case SNDRV_PCM_IOCTL_HW_PARAMS32: +diff --git a/sound/core/seq_device.c b/sound/core/seq_device.c +index 382275c5b1937..7f3fd8eb016fe 100644 +--- a/sound/core/seq_device.c ++++ b/sound/core/seq_device.c +@@ -156,6 +156,8 @@ static int snd_seq_device_dev_free(struct snd_device *device) + struct snd_seq_device *dev = device->device_data; + + cancel_autoload_drivers(); ++ if (dev->private_free) ++ dev->private_free(dev); + put_device(&dev->dev); + return 0; + } +@@ -183,11 +185,7 @@ static int snd_seq_device_dev_disconnect(struct snd_device *device) + + static void snd_seq_dev_release(struct device *dev) + { +- struct snd_seq_device *sdev = to_seq_dev(dev); +- +- if (sdev->private_free) +- sdev->private_free(sdev); +- kfree(sdev); ++ kfree(to_seq_dev(dev)); + } + + /* +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 0b9230a274b0a..8e6ff50f0f94f 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -527,6 +527,8 @@ static void alc_shutup_pins(struct hda_codec *codec) + struct alc_spec *spec = codec->spec; + + switch (codec->core.vendor_id) { ++ case 0x10ec0236: ++ case 0x10ec0256: + case 0x10ec0283: + case 0x10ec0286: + case 0x10ec0288: +@@ -2549,7 +2551,8 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { + SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), + SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), + SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), +- SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS), ++ SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED), + SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950), + SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950), +@@ -3540,7 +3543,8 @@ static void alc256_shutup(struct hda_codec *codec) + /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly + * when booting with headset plugged. So skip setting it for the codec alc257 + */ +- if (codec->core.vendor_id != 0x10ec0257) ++ if (spec->codec_variant != ALC269_TYPE_ALC257 && ++ spec->codec_variant != ALC269_TYPE_ALC256) + alc_update_coef_idx(codec, 0x46, 0, 3 << 12); + + if (!spec->no_shutup_pins) +@@ -6462,6 +6466,24 @@ static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, + /* for alc285_fixup_ideapad_s740_coef() */ + #include "ideapad_s740_helper.c" + ++static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *codec, ++ const struct hda_fixup *fix, ++ int action) ++{ ++ /* ++ * A certain other OS sets these coeffs to different values. On at least one TongFang ++ * barebone these settings might survive even a cold reboot. So to restore a clean slate the ++ * values are explicitly reset to default here. Without this, the external microphone is ++ * always in a plugged-in state, while the internal microphone is always in an unplugged ++ * state, breaking the ability to use the internal microphone. ++ */ ++ alc_write_coef_idx(codec, 0x24, 0x0000); ++ alc_write_coef_idx(codec, 0x26, 0x0000); ++ alc_write_coef_idx(codec, 0x29, 0x3000); ++ alc_write_coef_idx(codec, 0x37, 0xfe05); ++ alc_write_coef_idx(codec, 0x45, 0x5089); ++} ++ + enum { + ALC269_FIXUP_GPIO2, + ALC269_FIXUP_SONY_VAIO, +@@ -6676,7 +6698,8 @@ enum { + ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS, + ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE, + ALC287_FIXUP_YOGA7_14ITL_SPEAKERS, +- ALC287_FIXUP_13S_GEN2_SPEAKERS ++ ALC287_FIXUP_13S_GEN2_SPEAKERS, ++ ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS, + }; + + static const struct hda_fixup alc269_fixups[] = { +@@ -8357,7 +8380,7 @@ static const struct hda_fixup alc269_fixups[] = { + .v.verbs = (const struct hda_verb[]) { + { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x41 }, +- { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, +@@ -8374,6 +8397,10 @@ static const struct hda_fixup alc269_fixups[] = { + .chained = true, + .chain_id = ALC269_FIXUP_HEADSET_MODE, + }, ++ [ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc256_fixup_tongfang_reset_persistent_settings, ++ }, + }; + + static const struct snd_pci_quirk alc269_fixup_tbl[] = { +@@ -8465,6 +8492,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC), + SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC), + SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK), ++ SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK), ++ SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE), ++ SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), +@@ -8802,6 +8832,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */ + SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802), + SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X), ++ SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS), + SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC), + SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC), +@@ -10179,6 +10210,9 @@ enum { + ALC671_FIXUP_HP_HEADSET_MIC2, + ALC662_FIXUP_ACER_X2660G_HEADSET_MODE, + ALC662_FIXUP_ACER_NITRO_HEADSET_MODE, ++ ALC668_FIXUP_ASUS_NO_HEADSET_MIC, ++ ALC668_FIXUP_HEADSET_MIC, ++ ALC668_FIXUP_MIC_DET_COEF, + }; + + static const struct hda_fixup alc662_fixups[] = { +@@ -10562,6 +10596,29 @@ static const struct hda_fixup alc662_fixups[] = { + .chained = true, + .chain_id = ALC662_FIXUP_USI_FUNC + }, ++ [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x1b, 0x04a1112c }, ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC668_FIXUP_HEADSET_MIC ++ }, ++ [ALC668_FIXUP_HEADSET_MIC] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc269_fixup_headset_mic, ++ .chained = true, ++ .chain_id = ALC668_FIXUP_MIC_DET_COEF ++ }, ++ [ALC668_FIXUP_MIC_DET_COEF] = { ++ .type = HDA_FIXUP_VERBS, ++ .v.verbs = (const struct hda_verb[]) { ++ { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 }, ++ { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 }, ++ {} ++ }, ++ }, + }; + + static const struct snd_pci_quirk alc662_fixup_tbl[] = { +@@ -10597,6 +10654,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16), + SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51), + SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51), ++ SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC), + SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8), + SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16), + SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), +diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c +index 3d5848d5481be..53ebabf424722 100644 +--- a/sound/usb/mixer_scarlett_gen2.c ++++ b/sound/usb/mixer_scarlett_gen2.c +@@ -2450,6 +2450,8 @@ static int scarlett2_update_monitor_other(struct usb_mixer_interface *mixer) + err = scarlett2_usb_get_config(mixer, + SCARLETT2_CONFIG_TALKBACK_MAP, + 1, &bitmap); ++ if (err < 0) ++ return err; + for (i = 0; i < num_mixes; i++, bitmap >>= 1) + private->talkback_map[i] = bitmap & 1; + } +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h +index 19bb499c17daa..147b831e1a82d 100644 +--- a/sound/usb/quirks-table.h ++++ b/sound/usb/quirks-table.h +@@ -77,6 +77,48 @@ + /* E-Mu 0204 USB */ + { USB_DEVICE_VENDOR_SPEC(0x041e, 0x3f19) }, + ++/* ++ * Creative Technology, Ltd Live! Cam Sync HD [VF0770] ++ * The device advertises 8 formats, but only a rate of 48kHz is honored by the ++ * hardware and 24 bits give chopped audio, so only report the one working ++ * combination. ++ */ ++{ ++ USB_DEVICE(0x041e, 0x4095), ++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { ++ .ifnum = QUIRK_ANY_INTERFACE, ++ .type = QUIRK_COMPOSITE, ++ .data = &(const struct snd_usb_audio_quirk[]) { ++ { ++ .ifnum = 2, ++ .type = QUIRK_AUDIO_STANDARD_MIXER, ++ }, ++ { ++ .ifnum = 3, ++ .type = QUIRK_AUDIO_FIXED_ENDPOINT, ++ .data = &(const struct audioformat) { ++ .formats = SNDRV_PCM_FMTBIT_S16_LE, ++ .channels = 2, ++ .fmt_bits = 16, ++ .iface = 3, ++ .altsetting = 4, ++ .altset_idx = 4, ++ .endpoint = 0x82, ++ .ep_attr = 0x05, ++ .rates = SNDRV_PCM_RATE_48000, ++ .rate_min = 48000, ++ .rate_max = 48000, ++ .nr_rates = 1, ++ .rate_table = (unsigned int[]) { 48000 }, ++ }, ++ }, ++ { ++ .ifnum = -1 ++ }, ++ }, ++ }, ++}, ++ + /* + * HP Wireless Audio + * When not ignored, causes instability issues for some users, forcing them to diff --git a/patch/kernel/archive/sunxi-5.4/patch-5.4.25-26.patch b/patch/kernel/archive/sunxi-5.4/patch-5.4.25-26.patch index aac88a712f..6b0c967031 100644 --- a/patch/kernel/archive/sunxi-5.4/patch-5.4.25-26.patch +++ b/patch/kernel/archive/sunxi-5.4/patch-5.4.25-26.patch @@ -1502,41 +1502,6 @@ index ca70a1d840eb..4004f98e50d9 100644 }; static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info) -diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c -index 6912624eed4a..44ea5dcc43fd 100644 ---- a/drivers/net/usb/r8152.c -+++ b/drivers/net/usb/r8152.c -@@ -3006,6 +3006,8 @@ static u16 r8153_phy_status(struct r8152 *tp, u16 desired) - } - - msleep(20); -+ if (test_bit(RTL8152_UNPLUG, &tp->flags)) -+ break; - } - - return data; -@@ -4419,7 +4421,10 @@ static void r8153_init(struct r8152 *tp) - if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) & - AUTOLOAD_DONE) - break; -+ - msleep(20); -+ if (test_bit(RTL8152_UNPLUG, &tp->flags)) -+ break; - } - - data = r8153_phy_status(tp, 0); -@@ -4545,7 +4550,10 @@ static void r8153b_init(struct r8152 *tp) - if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) & - AUTOLOAD_DONE) - break; -+ - msleep(20); -+ if (test_bit(RTL8152_UNPLUG, &tp->flags)) -+ break; - } - - data = r8153_phy_status(tp, 0); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c b/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c index 945c1ea5cda8..ed367b0a185c 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/nvm.c