diff --git a/config/kernel/linux-meson64-legacy.config b/config/kernel/linux-meson64-legacy.config index f3339d180..770e3441f 100644 --- a/config/kernel/linux-meson64-legacy.config +++ b/config/kernel/linux-meson64-legacy.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 4.9.205 Kernel Configuration +# Linux/arm64 4.9.210 Kernel Configuration # CONFIG_ARM64=y CONFIG_64BIT=y diff --git a/config/kernel/linux-odroidxu4-current.config b/config/kernel/linux-odroidxu4-current.config index b4f956e29..7ba4a12e9 100644 --- a/config/kernel/linux-odroidxu4-current.config +++ b/config/kernel/linux-odroidxu4-current.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 5.4.6 Kernel Configuration +# Linux/arm 5.4.15 Kernel Configuration # # @@ -67,7 +67,6 @@ CONFIG_SPARSE_IRQ=y CONFIG_GENERIC_IRQ_MULTI_HANDLER=y CONFIG_ARCH_CLOCKSOURCE_DATA=y -CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_ARCH_HAS_TICK_BROADCAST=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y @@ -168,7 +167,6 @@ CONFIG_NET_NS=y CONFIG_RELAY=y CONFIG_BLK_DEV_INITRD=y CONFIG_INITRAMFS_SOURCE="" -# CONFIG_INITRAMFS_FORCE is not set CONFIG_RD_GZIP=y CONFIG_RD_BZIP2=y CONFIG_RD_LZMA=y @@ -395,12 +393,12 @@ CONFIG_ARM_VIRT_EXT=y CONFIG_SWP_EMULATE=y # CONFIG_CPU_BIG_ENDIAN is not set # CONFIG_CPU_ICACHE_DISABLE is not set -# CONFIG_CPU_ICACHE_MISMATCH_WORKAROUND is not set +CONFIG_CPU_ICACHE_MISMATCH_WORKAROUND=y # CONFIG_CPU_BPREDICT_DISABLE is not set CONFIG_CPU_SPECTRE=y CONFIG_HARDEN_BRANCH_PREDICTOR=y CONFIG_KUSER_HELPERS=y -CONFIG_VDSO=y +# CONFIG_VDSO is not set CONFIG_OUTER_CACHE=y CONFIG_OUTER_CACHE_SYNC=y CONFIG_MIGHT_HAVE_CACHE_L2X0=y @@ -447,7 +445,7 @@ CONFIG_HAVE_SMP=y CONFIG_SMP=y CONFIG_SMP_ON_UP=y CONFIG_ARM_CPU_TOPOLOGY=y -CONFIG_SCHED_MC=y +# CONFIG_SCHED_MC is not set # CONFIG_SCHED_SMT is not set CONFIG_HAVE_ARM_SCU=y CONFIG_HAVE_ARM_ARCH_TIMER=y @@ -464,13 +462,13 @@ CONFIG_HOTPLUG_CPU=y # CONFIG_ARM_PSCI is not set CONFIG_ARCH_NR_GPIO=512 CONFIG_HZ_FIXED=0 -# CONFIG_HZ_100 is not set +CONFIG_HZ_100=y # CONFIG_HZ_200 is not set -CONFIG_HZ_250=y +# CONFIG_HZ_250 is not set # CONFIG_HZ_300 is not set # CONFIG_HZ_500 is not set # CONFIG_HZ_1000 is not set -CONFIG_HZ=250 +CONFIG_HZ=100 CONFIG_SCHED_HRTICK=y # CONFIG_THUMB2_KERNEL is not set CONFIG_ARM_PATCH_IDIV=y @@ -483,7 +481,7 @@ CONFIG_HIGHPTE=y CONFIG_CPU_SW_DOMAIN_PAN=y CONFIG_HW_PERF_EVENTS=y CONFIG_ARCH_WANT_GENERAL_HUGETLB=y -# CONFIG_ARM_MODULE_PLTS is not set +CONFIG_ARM_MODULE_PLTS=y CONFIG_FORCE_MAX_ZONEORDER=11 CONFIG_ALIGNMENT_TRAP=y # CONFIG_UACCESS_WITH_MEMCPY is not set @@ -503,11 +501,11 @@ CONFIG_ZBOOT_ROM_TEXT=0x0 CONFIG_ZBOOT_ROM_BSS=0x0 CONFIG_ARM_APPENDED_DTB=y CONFIG_ARM_ATAG_DTB_COMPAT=y -# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER is not set -CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND=y -CONFIG_CMDLINE="s5p_mfc.mem=16M" -# CONFIG_CMDLINE_FROM_BOOTLOADER is not set -CONFIG_CMDLINE_EXTEND=y +CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y +# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND is not set +CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc mem=256M" +CONFIG_CMDLINE_FROM_BOOTLOADER=y +# CONFIG_CMDLINE_EXTEND is not set # CONFIG_CMDLINE_FORCE is not set # CONFIG_KEXEC is not set # CONFIG_CRASH_DUMP is not set @@ -690,6 +688,7 @@ CONFIG_HAVE_ARCH_MMAP_RND_BITS=y CONFIG_HAVE_EXIT_THREAD=y CONFIG_ARCH_MMAP_RND_BITS=8 CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y +CONFIG_HAVE_COPY_THREAD_TLS=y CONFIG_CLONE_BACKWARDS=y CONFIG_OLD_SIGSUSPEND3=y CONFIG_OLD_SIGACTION=y @@ -804,7 +803,7 @@ CONFIG_BINFMT_SCRIPT=y CONFIG_ARCH_HAS_BINFMT_FLAT=y # CONFIG_BINFMT_FLAT is not set CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y -CONFIG_BINFMT_MISC=m +# CONFIG_BINFMT_MISC is not set CONFIG_COREDUMP=y # end of Executable file formats @@ -1642,8 +1641,6 @@ CONFIG_CFG80211_DEFAULT_PS=y CONFIG_CFG80211_CRDA_SUPPORT=y CONFIG_CFG80211_WEXT=y CONFIG_LIB80211=m -CONFIG_LIB80211_CRYPT_WEP=m -CONFIG_LIB80211_CRYPT_CCMP=m # CONFIG_LIB80211_DEBUG is not set CONFIG_MAC80211=m CONFIG_MAC80211_HAS_RC=y @@ -1782,7 +1779,7 @@ CONFIG_BLK_DEV_DRBD=m CONFIG_BLK_DEV_NBD=m CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=16384 +CONFIG_BLK_DEV_RAM_SIZE=8192 # CONFIG_CDROM_PKTCDVD is not set # CONFIG_ATA_OVER_ETH is not set # CONFIG_BLK_DEV_RBD is not set @@ -1974,7 +1971,6 @@ CONFIG_TARGET_CORE=m # CONFIG_TCM_IBLOCK is not set # CONFIG_TCM_FILEIO is not set # CONFIG_TCM_PSCSI is not set -CONFIG_TCM_USER2=m # CONFIG_LOOPBACK_TARGET is not set # CONFIG_ISCSI_TARGET is not set CONFIG_NETDEVICES=y @@ -2027,40 +2023,67 @@ CONFIG_NET_VENDOR_ALACRITECH=y # CONFIG_ALTERA_TSE is not set CONFIG_NET_VENDOR_AMAZON=y CONFIG_NET_VENDOR_AQUANTIA=y -# CONFIG_NET_VENDOR_ARC is not set -# CONFIG_NET_VENDOR_AURORA is not set -# CONFIG_NET_VENDOR_BROADCOM is not set +CONFIG_NET_VENDOR_ARC=y +CONFIG_NET_VENDOR_AURORA=y +# CONFIG_AURORA_NB8800 is not set +CONFIG_NET_VENDOR_BROADCOM=y +# CONFIG_B44 is not set +# CONFIG_BCMGENET is not set +# CONFIG_SYSTEMPORT is not set CONFIG_NET_VENDOR_CADENCE=y # CONFIG_MACB is not set CONFIG_NET_VENDOR_CAVIUM=y -# CONFIG_NET_VENDOR_CIRRUS is not set +CONFIG_NET_VENDOR_CIRRUS=y +# CONFIG_CS89x0 is not set CONFIG_NET_VENDOR_CORTINA=y # CONFIG_GEMINI_ETHERNET is not set # CONFIG_DM9000 is not set # CONFIG_DNET is not set -# CONFIG_NET_VENDOR_EZCHIP is not set -# CONFIG_NET_VENDOR_FARADAY is not set +CONFIG_NET_VENDOR_EZCHIP=y +# CONFIG_EZCHIP_NPS_MANAGEMENT_ENET is not set +CONFIG_NET_VENDOR_FARADAY=y +# CONFIG_FTMAC100 is not set +# CONFIG_FTGMAC100 is not set CONFIG_NET_VENDOR_GOOGLE=y -# CONFIG_NET_VENDOR_HISILICON is not set +CONFIG_NET_VENDOR_HISILICON=y +# CONFIG_HIX5HD2_GMAC is not set +# CONFIG_HISI_FEMAC is not set +# CONFIG_HIP04_ETH is not set +# CONFIG_HNS is not set +# CONFIG_HNS_DSAF is not set +# CONFIG_HNS_ENET is not set CONFIG_NET_VENDOR_HUAWEI=y -# CONFIG_NET_VENDOR_INTEL is not set -# CONFIG_NET_VENDOR_MARVELL is not set +CONFIG_NET_VENDOR_I825XX=y +CONFIG_NET_VENDOR_INTEL=y +CONFIG_NET_VENDOR_MARVELL=y +# CONFIG_MVMDIO is not set CONFIG_NET_VENDOR_MELLANOX=y # CONFIG_MLXSW_CORE is not set # CONFIG_MLXFW is not set -# CONFIG_NET_VENDOR_MICREL is not set -# CONFIG_NET_VENDOR_MICROCHIP is not set +CONFIG_NET_VENDOR_MICREL=y +# CONFIG_KS8842 is not set +# CONFIG_KS8851 is not set +# CONFIG_KS8851_MLL is not set +CONFIG_NET_VENDOR_MICROCHIP=y +# CONFIG_ENC28J60 is not set +# CONFIG_ENCX24J600 is not set CONFIG_NET_VENDOR_MICROSEMI=y -# CONFIG_NET_VENDOR_NATSEMI is not set -# CONFIG_NET_VENDOR_NETRONOME is not set +CONFIG_NET_VENDOR_NATSEMI=y +CONFIG_NET_VENDOR_NETRONOME=y CONFIG_NET_VENDOR_NI=y -CONFIG_NI_XGE_MANAGEMENT_ENET=m +# CONFIG_NI_XGE_MANAGEMENT_ENET is not set +CONFIG_NET_VENDOR_8390=y +# CONFIG_AX88796 is not set # CONFIG_ETHOC is not set CONFIG_NET_VENDOR_PENSANDO=y -# CONFIG_NET_VENDOR_QUALCOMM is not set -# CONFIG_NET_VENDOR_RENESAS is not set -# CONFIG_NET_VENDOR_ROCKER is not set -# CONFIG_NET_VENDOR_SAMSUNG is not set +CONFIG_NET_VENDOR_QUALCOMM=y +# CONFIG_QCA7000_SPI is not set +# CONFIG_QCOM_EMAC is not set +# CONFIG_RMNET is not set +CONFIG_NET_VENDOR_RENESAS=y +CONFIG_NET_VENDOR_ROCKER=y +CONFIG_NET_VENDOR_SAMSUNG=y +# CONFIG_SXGBE_ETH is not set CONFIG_NET_VENDOR_SEEQ=y CONFIG_NET_VENDOR_SOLARFLARE=y CONFIG_NET_VENDOR_SMSC=y @@ -2556,7 +2579,8 @@ CONFIG_INPUT_MISC=y # CONFIG_INPUT_BMA150 is not set # CONFIG_INPUT_E3X0_BUTTON is not set CONFIG_INPUT_MSM_VIBRATOR=m -CONFIG_INPUT_MAX77650_ONKEY=m +# CONFIG_INPUT_MAX77693_HAPTIC is not set +# CONFIG_INPUT_MAX8997_HAPTIC is not set # CONFIG_INPUT_MMA8450 is not set # CONFIG_INPUT_GP2A is not set # CONFIG_INPUT_GPIO_BEEPER is not set @@ -2626,14 +2650,15 @@ CONFIG_VT_CONSOLE_SLEEP=y CONFIG_HW_CONSOLE=y CONFIG_VT_HW_CONSOLE_BINDING=y CONFIG_UNIX98_PTYS=y -# CONFIG_LEGACY_PTYS is not set +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 # CONFIG_SERIAL_NONSTANDARD is not set # CONFIG_N_GSM is not set # CONFIG_TRACE_SINK is not set -CONFIG_NULL_TTY=m +# CONFIG_NULL_TTY is not set CONFIG_LDISC_AUTOLOAD=y CONFIG_DEVMEM=y -CONFIG_DEVKMEM=y +# CONFIG_DEVKMEM is not set # # Serial drivers @@ -2886,7 +2911,6 @@ CONFIG_GPIO_GW_PLD=m # CONFIG_GPIO_BD70528=m # CONFIG_HTC_EGPIO is not set -CONFIG_GPIO_MAX77650=m CONFIG_GPIO_TQMX86=m # CONFIG_GPIO_WM8994 is not set # end of MFD GPIO expanders @@ -2981,14 +3005,18 @@ CONFIG_BATTERY_MAX17042=y # CONFIG_CHARGER_GPIO is not set # CONFIG_CHARGER_MANAGER is not set CONFIG_CHARGER_LT3651=m +# CONFIG_CHARGER_MAX14577 is not set # CONFIG_CHARGER_DETECTOR_MAX14656 is not set -CONFIG_CHARGER_MAX77650=m +# CONFIG_CHARGER_MAX77693 is not set +# CONFIG_CHARGER_MAX8997 is not set +# CONFIG_CHARGER_MAX8998 is not set # CONFIG_CHARGER_BQ2415X is not set # CONFIG_CHARGER_BQ24190 is not set # CONFIG_CHARGER_BQ24257 is not set # CONFIG_CHARGER_BQ24735 is not set # CONFIG_CHARGER_BQ25890 is not set # CONFIG_CHARGER_SMB347 is not set +# CONFIG_CHARGER_TPS65090 is not set # CONFIG_BATTERY_GAUGE_LTC2941 is not set # CONFIG_CHARGER_RT9455 is not set CONFIG_CHARGER_CROS_USBPD=m @@ -3108,7 +3136,7 @@ CONFIG_SENSORS_PWM_FAN=y # CONFIG_SENSORS_ADS7871 is not set # CONFIG_SENSORS_AMC6821 is not set # CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set +CONFIG_SENSORS_INA2XX=y # CONFIG_SENSORS_INA3221 is not set # CONFIG_SENSORS_TC74 is not set # CONFIG_SENSORS_THMC50 is not set @@ -3230,16 +3258,16 @@ CONFIG_MFD_CROS_EC_DEV=m # CONFIG_MFD_88PM800 is not set # CONFIG_MFD_88PM805 is not set # CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_MAX14577 is not set +CONFIG_MFD_MAX14577=y # CONFIG_MFD_MAX77620 is not set -CONFIG_MFD_MAX77650=m -# CONFIG_MFD_MAX77686 is not set -# CONFIG_MFD_MAX77693 is not set +# CONFIG_MFD_MAX77650 is not set +CONFIG_MFD_MAX77686=y +CONFIG_MFD_MAX77693=y # CONFIG_MFD_MAX77843 is not set # CONFIG_MFD_MAX8907 is not set # CONFIG_MFD_MAX8925 is not set -# CONFIG_MFD_MAX8997 is not set -# CONFIG_MFD_MAX8998 is not set +CONFIG_MFD_MAX8997=y +CONFIG_MFD_MAX8998=y # CONFIG_MFD_MT6397 is not set # CONFIG_MFD_MENF21BMC is not set # CONFIG_EZX_PCAP is not set @@ -3269,7 +3297,7 @@ CONFIG_MFD_SYSCON=y # CONFIG_TPS65010 is not set # CONFIG_TPS6507X is not set # CONFIG_MFD_TPS65086 is not set -# CONFIG_MFD_TPS65090 is not set +CONFIG_MFD_TPS65090=y # CONFIG_MFD_TPS65217 is not set # CONFIG_MFD_TI_LP873X is not set # CONFIG_MFD_TI_LP87565 is not set @@ -3295,7 +3323,7 @@ CONFIG_MFD_TQMX86=m # CONFIG_MFD_WM831X_I2C is not set # CONFIG_MFD_WM831X_SPI is not set # CONFIG_MFD_WM8350_I2C is not set -CONFIG_MFD_WM8994=m +CONFIG_MFD_WM8994=y # CONFIG_MFD_ROHM_BD718XX is not set CONFIG_MFD_ROHM_BD70528=m # CONFIG_MFD_STPMIC1 is not set @@ -3324,13 +3352,18 @@ CONFIG_REGULATOR_GPIO=y # CONFIG_REGULATOR_LP8755 is not set # CONFIG_REGULATOR_LTC3589 is not set # CONFIG_REGULATOR_LTC3676 is not set +# CONFIG_REGULATOR_MAX14577 is not set # CONFIG_REGULATOR_MAX1586 is not set -CONFIG_REGULATOR_MAX77650=m # CONFIG_REGULATOR_MAX8649 is not set # CONFIG_REGULATOR_MAX8660 is not set -# CONFIG_REGULATOR_MAX8952 is not set +CONFIG_REGULATOR_MAX8952=y # CONFIG_REGULATOR_MAX8973 is not set -CONFIG_REGULATOR_MCP16502=m +CONFIG_REGULATOR_MAX8997=y +CONFIG_REGULATOR_MAX8998=y +CONFIG_REGULATOR_MAX77686=y +CONFIG_REGULATOR_MAX77693=y +CONFIG_REGULATOR_MAX77802=y +# CONFIG_REGULATOR_MCP16502 is not set # CONFIG_REGULATOR_MT6311 is not set # CONFIG_REGULATOR_PFUZE100 is not set # CONFIG_REGULATOR_PV88060 is not set @@ -3347,6 +3380,7 @@ CONFIG_REGULATOR_SY8824X=m # CONFIG_REGULATOR_TPS62360 is not set # CONFIG_REGULATOR_TPS65023 is not set # CONFIG_REGULATOR_TPS6507X is not set +# CONFIG_REGULATOR_TPS65090 is not set # CONFIG_REGULATOR_TPS65132 is not set # CONFIG_REGULATOR_TPS6524X is not set # CONFIG_REGULATOR_VCTRL is not set @@ -3398,7 +3432,6 @@ CONFIG_MEDIA_CEC_SUPPORT=y # CONFIG_MEDIA_CEC_RC is not set CONFIG_MEDIA_CONTROLLER=y CONFIG_MEDIA_CONTROLLER_DVB=y -# CONFIG_MEDIA_CONTROLLER_REQUEST_API is not set CONFIG_VIDEO_DEV=y CONFIG_VIDEO_V4L2_SUBDEV_API=y CONFIG_VIDEO_V4L2=y @@ -3406,7 +3439,7 @@ CONFIG_VIDEO_V4L2_I2C=y # CONFIG_VIDEO_ADV_DEBUG is not set # CONFIG_VIDEO_FIXED_MINOR_RANGES is not set CONFIG_VIDEO_TUNER=m -CONFIG_V4L2_MEM2MEM_DEV=y +CONFIG_V4L2_MEM2MEM_DEV=m # CONFIG_V4L2_FLASH_LED_CLASS is not set CONFIG_V4L2_FWNODE=m CONFIG_VIDEOBUF_GEN=m @@ -3594,14 +3627,20 @@ CONFIG_V4L_PLATFORM_DRIVERS=y # CONFIG_VIDEO_CADENCE is not set # CONFIG_VIDEO_ASPEED is not set # CONFIG_VIDEO_MUX is not set -# CONFIG_VIDEO_SAMSUNG_EXYNOS4_IS is not set +CONFIG_VIDEO_SAMSUNG_EXYNOS4_IS=m +CONFIG_VIDEO_EXYNOS4_IS_COMMON=m +CONFIG_VIDEO_S5P_FIMC=m +CONFIG_VIDEO_S5P_MIPI_CSIS=m +CONFIG_VIDEO_EXYNOS_FIMC_LITE=m +CONFIG_VIDEO_EXYNOS4_FIMC_IS=m +CONFIG_VIDEO_EXYNOS4_ISP_DMA_CAPTURE=y # CONFIG_VIDEO_XILINX is not set CONFIG_V4L_MEM2MEM_DRIVERS=y # CONFIG_VIDEO_MEM2MEM_DEINTERLACE is not set # CONFIG_VIDEO_SAMSUNG_S5P_G2D is not set -CONFIG_VIDEO_SAMSUNG_S5P_JPEG=y -CONFIG_VIDEO_SAMSUNG_S5P_MFC=y -CONFIG_VIDEO_SAMSUNG_EXYNOS_GSC=y +CONFIG_VIDEO_SAMSUNG_S5P_JPEG=m +CONFIG_VIDEO_SAMSUNG_S5P_MFC=m +CONFIG_VIDEO_SAMSUNG_EXYNOS_GSC=m # CONFIG_VIDEO_SH_VEU is not set CONFIG_V4L_TEST_DRIVERS=y # CONFIG_VIDEO_VIMC is not set @@ -3615,7 +3654,7 @@ CONFIG_DVB_PLATFORM_DRIVERS=y CONFIG_CEC_PLATFORM_DRIVERS=y # CONFIG_VIDEO_CROS_EC_CEC is not set # CONFIG_CEC_GPIO is not set -CONFIG_VIDEO_SAMSUNG_S5P_CEC=y +CONFIG_VIDEO_SAMSUNG_S5P_CEC=m # CONFIG_SDR_PLATFORM_DRIVERS is not set # @@ -3650,10 +3689,10 @@ CONFIG_MEDIA_COMMON_OPTIONS=y CONFIG_VIDEO_CX2341X=m CONFIG_VIDEO_TVEEPROM=m CONFIG_CYPRESS_FIRMWARE=m -CONFIG_VIDEOBUF2_CORE=y -CONFIG_VIDEOBUF2_V4L2=y -CONFIG_VIDEOBUF2_MEMOPS=y -CONFIG_VIDEOBUF2_DMA_CONTIG=y +CONFIG_VIDEOBUF2_CORE=m +CONFIG_VIDEOBUF2_V4L2=m +CONFIG_VIDEOBUF2_MEMOPS=m +CONFIG_VIDEOBUF2_DMA_CONTIG=m CONFIG_VIDEOBUF2_VMALLOC=m CONFIG_DVB_B2C2_FLEXCOP=m CONFIG_SMS_SIANO_MDTV=m @@ -3922,7 +3961,6 @@ CONFIG_DVB_SP2=m # # CONFIG_IMX_IPUV3_CORE is not set CONFIG_DRM=y -CONFIG_DRM_MIPI_DBI=m CONFIG_DRM_MIPI_DSI=y # CONFIG_DRM_DP_AUX_CHARDEV is not set # CONFIG_DRM_DEBUG_MM is not set @@ -3930,12 +3968,12 @@ CONFIG_DRM_KMS_HELPER=y CONFIG_DRM_KMS_FB_HELPER=y CONFIG_DRM_FBDEV_EMULATION=y CONFIG_DRM_FBDEV_OVERALLOC=100 -CONFIG_DRM_LOAD_EDID_FIRMWARE=y +# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set # CONFIG_DRM_DP_CEC is not set CONFIG_DRM_GEM_CMA_HELPER=y CONFIG_DRM_KMS_CMA_HELPER=y CONFIG_DRM_GEM_SHMEM_HELPER=y -CONFIG_DRM_SCHED=m +CONFIG_DRM_SCHED=y # # I2C encoder or helper chips @@ -3966,7 +4004,7 @@ CONFIG_DRM_EXYNOS=y # # CRTCs # -# CONFIG_DRM_EXYNOS_FIMD is not set +CONFIG_DRM_EXYNOS_FIMD=y # CONFIG_DRM_EXYNOS5433_DECON is not set # CONFIG_DRM_EXYNOS7_DECON is not set CONFIG_DRM_EXYNOS_MIXER=y @@ -3975,12 +4013,15 @@ CONFIG_DRM_EXYNOS_MIXER=y # # Encoders and Bridges # +CONFIG_DRM_EXYNOS_DPI=y +CONFIG_DRM_EXYNOS_DSI=y +CONFIG_DRM_EXYNOS_DP=y CONFIG_DRM_EXYNOS_HDMI=y # # Sub-drivers # -CONFIG_DRM_EXYNOS_G2D=y +# CONFIG_DRM_EXYNOS_G2D is not set # CONFIG_DRM_EXYNOS_FIMC is not set # CONFIG_DRM_EXYNOS_ROTATOR is not set # CONFIG_DRM_EXYNOS_SCALER is not set @@ -4000,41 +4041,41 @@ CONFIG_DRM_PANEL=y # CONFIG_DRM_PANEL_ARM_VERSATILE is not set # CONFIG_DRM_PANEL_LVDS is not set CONFIG_DRM_PANEL_SIMPLE=y -CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D=m +# CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D is not set # CONFIG_DRM_PANEL_ILITEK_IL9322 is not set # CONFIG_DRM_PANEL_ILITEK_ILI9881C is not set # CONFIG_DRM_PANEL_INNOLUX_P079ZCA is not set # CONFIG_DRM_PANEL_JDI_LT070ME05000 is not set -CONFIG_DRM_PANEL_KINGDISPLAY_KD097D04=m +# CONFIG_DRM_PANEL_KINGDISPLAY_KD097D04 is not set CONFIG_DRM_PANEL_SAMSUNG_LD9040=y -CONFIG_DRM_PANEL_LG_LB035Q02=m +# CONFIG_DRM_PANEL_LG_LB035Q02 is not set # CONFIG_DRM_PANEL_LG_LG4573 is not set -CONFIG_DRM_PANEL_NEC_NL8048HL11=m -CONFIG_DRM_PANEL_NOVATEK_NT39016=m +# CONFIG_DRM_PANEL_NEC_NL8048HL11 is not set +# CONFIG_DRM_PANEL_NOVATEK_NT39016 is not set # CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO is not set # CONFIG_DRM_PANEL_ORISETECH_OTM8009A is not set # CONFIG_DRM_PANEL_OSD_OSD101T2587_53TS is not set # CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00 is not set # CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN is not set -CONFIG_DRM_PANEL_RAYDIUM_RM67191=m +# CONFIG_DRM_PANEL_RAYDIUM_RM67191 is not set # CONFIG_DRM_PANEL_RAYDIUM_RM68200 is not set -CONFIG_DRM_PANEL_ROCKTECH_JH057N00900=m -CONFIG_DRM_PANEL_RONBO_RB070D30=m +# CONFIG_DRM_PANEL_ROCKTECH_JH057N00900 is not set +# CONFIG_DRM_PANEL_RONBO_RB070D30 is not set # CONFIG_DRM_PANEL_SAMSUNG_S6D16D0 is not set # CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2 is not set -# CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03 is not set -CONFIG_DRM_PANEL_SAMSUNG_S6E63M0=m +CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03=y +# CONFIG_DRM_PANEL_SAMSUNG_S6E63M0 is not set CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0=y # CONFIG_DRM_PANEL_SEIKO_43WVF1G is not set # CONFIG_DRM_PANEL_SHARP_LQ101R1SX01 is not set -CONFIG_DRM_PANEL_SHARP_LS037V7DW01=m +# CONFIG_DRM_PANEL_SHARP_LS037V7DW01 is not set # CONFIG_DRM_PANEL_SHARP_LS043T1LE01 is not set -CONFIG_DRM_PANEL_SITRONIX_ST7701=m +# CONFIG_DRM_PANEL_SITRONIX_ST7701 is not set # CONFIG_DRM_PANEL_SITRONIX_ST7789V is not set -CONFIG_DRM_PANEL_SONY_ACX565AKM=m -CONFIG_DRM_PANEL_TPO_TD028TTEC1=m -CONFIG_DRM_PANEL_TPO_TD043MTEA1=m -CONFIG_DRM_PANEL_TPO_TPG110=m +# CONFIG_DRM_PANEL_SONY_ACX565AKM is not set +# CONFIG_DRM_PANEL_TPO_TD028TTEC1 is not set +# CONFIG_DRM_PANEL_TPO_TD043MTEA1 is not set +# CONFIG_DRM_PANEL_TPO_TPG110 is not set # CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA is not set # end of Display Panels @@ -4053,32 +4094,32 @@ CONFIG_DRM_NXP_PTN3460=y CONFIG_DRM_PARADE_PS8622=y # CONFIG_DRM_SIL_SII8620 is not set # CONFIG_DRM_SII902X is not set -# CONFIG_DRM_SII9234 is not set +CONFIG_DRM_SII9234=y # CONFIG_DRM_THINE_THC63LVD1024 is not set -# CONFIG_DRM_TOSHIBA_TC358764 is not set +CONFIG_DRM_TOSHIBA_TC358764=y # CONFIG_DRM_TOSHIBA_TC358767 is not set # CONFIG_DRM_TI_TFP410 is not set # CONFIG_DRM_TI_SN65DSI86 is not set +CONFIG_DRM_ANALOGIX_DP=y # CONFIG_DRM_I2C_ADV7511 is not set # end of Display Interface Bridges # CONFIG_DRM_STI is not set -CONFIG_DRM_ETNAVIV=m -CONFIG_DRM_ETNAVIV_THERMAL=y +# CONFIG_DRM_ETNAVIV is not set # CONFIG_DRM_ARCPGU is not set # CONFIG_DRM_MXSFB is not set -CONFIG_DRM_GM12U320=m -CONFIG_TINYDRM_HX8357D=m -CONFIG_TINYDRM_ILI9225=m -CONFIG_TINYDRM_ILI9341=m -CONFIG_TINYDRM_MI0283QT=m -CONFIG_TINYDRM_REPAPER=m -CONFIG_TINYDRM_ST7586=m -CONFIG_TINYDRM_ST7735R=m +# CONFIG_DRM_GM12U320 is not set +# CONFIG_TINYDRM_HX8357D is not set +# CONFIG_TINYDRM_ILI9225 is not set +# CONFIG_TINYDRM_ILI9341 is not set +# CONFIG_TINYDRM_MI0283QT is not set +# CONFIG_TINYDRM_REPAPER is not set +# CONFIG_TINYDRM_ST7586 is not set +# CONFIG_TINYDRM_ST7735R is not set # CONFIG_DRM_PL111 is not set # CONFIG_DRM_TVE200 is not set -CONFIG_DRM_LIMA=m -CONFIG_DRM_PANFROST=m +CONFIG_DRM_LIMA=y +CONFIG_DRM_PANFROST=y # CONFIG_DRM_MCDE is not set # CONFIG_DRM_LEGACY is not set CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y @@ -4086,22 +4127,7 @@ CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y # # ARM GPU Configuration # -CONFIG_MALI_MIDGARD=y -CONFIG_MALI_GATOR_SUPPORT=y -# CONFIG_MALI_MIDGARD_ENABLE_TRACE is not set -CONFIG_MALI_DEVFREQ=y -CONFIG_MALI_DMA_FENCE=y -CONFIG_MALI_PLATFORM_NAME="devicetree" -CONFIG_MALI_EXPERT=y -# CONFIG_MALI_CORESTACK is not set -# CONFIG_MALI_PRFCNT_SET_SECONDARY is not set -# CONFIG_MALI_DEBUG is not set -# CONFIG_MALI_FENCE_DEBUG is not set -# CONFIG_MALI_NO_MALI is not set -# CONFIG_MALI_TRACE_TIMELINE is not set -# CONFIG_MALI_SYSTEM_TRACE is not set -# CONFIG_MALI_2MB_ALLOC is not set -# CONFIG_MALI_PWRSOFT_765 is not set +# CONFIG_MALI_MIDGARD is not set CONFIG_MALI_KUTF=m # end of ARM GPU Configuration @@ -4111,7 +4137,7 @@ CONFIG_MALI_KUTF=m CONFIG_FB_CMDLINE=y CONFIG_FB_NOTIFY=y CONFIG_FB=y -CONFIG_FIRMWARE_EDID=y +# CONFIG_FIRMWARE_EDID is not set CONFIG_FB_CFB_FILLRECT=y CONFIG_FB_CFB_COPYAREA=y CONFIG_FB_CFB_IMAGEBLIT=y @@ -4121,8 +4147,7 @@ CONFIG_FB_SYS_IMAGEBLIT=y # CONFIG_FB_FOREIGN_ENDIAN is not set CONFIG_FB_SYS_FOPS=y CONFIG_FB_DEFERRED_IO=y -CONFIG_FB_BACKLIGHT=m -CONFIG_FB_MODE_HELPERS=y +# CONFIG_FB_MODE_HELPERS is not set # CONFIG_FB_TILEBLITTING is not set # @@ -4143,7 +4168,7 @@ CONFIG_FB_MODE_HELPERS=y # # Backlight & LCD device support # -CONFIG_LCD_CLASS_DEVICE=m +CONFIG_LCD_CLASS_DEVICE=y # CONFIG_LCD_L4F00242T03 is not set # CONFIG_LCD_LMS283GF05 is not set # CONFIG_LCD_LTV350QV is not set @@ -4151,7 +4176,7 @@ CONFIG_LCD_CLASS_DEVICE=m # CONFIG_LCD_ILI9320 is not set # CONFIG_LCD_TDO24M is not set # CONFIG_LCD_VGG2432A4 is not set -CONFIG_LCD_PLATFORM=m +CONFIG_LCD_PLATFORM=y # CONFIG_LCD_AMS369FG06 is not set # CONFIG_LCD_LMS501KF03 is not set # CONFIG_LCD_HX8357 is not set @@ -4180,7 +4205,7 @@ CONFIG_HDMI=y CONFIG_DUMMY_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y -CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set # CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER is not set # end of Console display driver support @@ -4585,7 +4610,7 @@ CONFIG_USB_SUPPORT=y CONFIG_USB_COMMON=y # CONFIG_USB_LED_TRIG is not set # CONFIG_USB_ULPI_BUS is not set -CONFIG_USB_CONN_GPIO=m +# CONFIG_USB_CONN_GPIO is not set CONFIG_USB_ARCH_HAS_HCD=y CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y @@ -4595,10 +4620,8 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y # CONFIG_USB_DEFAULT_PERSIST=y # CONFIG_USB_DYNAMIC_MINORS is not set -CONFIG_USB_OTG=y +# CONFIG_USB_OTG is not set # CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_OTG_FSM is not set # CONFIG_USB_LEDS_TRIGGER_USBPORT is not set CONFIG_USB_AUTOSUSPEND_DELAY=2 # CONFIG_USB_MON is not set @@ -4666,9 +4689,7 @@ CONFIG_USB_UAS=m # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set # CONFIG_USBIP_CORE is not set -CONFIG_USB_CDNS3=m -# CONFIG_USB_CDNS3_GADGET is not set -# CONFIG_USB_CDNS3_HOST is not set +# CONFIG_USB_CDNS3 is not set # CONFIG_USB_MUSB_HDRC is not set CONFIG_USB_DWC3=y # CONFIG_USB_DWC3_HOST is not set @@ -4798,7 +4819,6 @@ CONFIG_USB_GADGET=y # CONFIG_USB_GADGET_DEBUG_FS is not set CONFIG_USB_GADGET_VBUS_DRAW=2 CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 -# CONFIG_U_SERIAL_CONSOLE is not set # # USB Peripheral Controller @@ -4818,38 +4838,9 @@ CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 # CONFIG_USB_DUMMY_HCD is not set # end of USB Peripheral Controller -CONFIG_USB_LIBCOMPOSITE=m -CONFIG_USB_F_ACM=m -CONFIG_USB_U_SERIAL=m -CONFIG_USB_U_ETHER=m -CONFIG_USB_F_SERIAL=m -CONFIG_USB_F_OBEX=m -CONFIG_USB_F_ECM=m -CONFIG_USB_F_SUBSET=m -CONFIG_USB_F_RNDIS=m -CONFIG_USB_F_MASS_STORAGE=m # CONFIG_USB_CONFIGFS is not set -# CONFIG_USB_ZERO is not set -# CONFIG_USB_AUDIO is not set -CONFIG_USB_ETH=m -CONFIG_USB_ETH_RNDIS=y -# CONFIG_USB_ETH_EEM is not set -# CONFIG_USB_G_NCM is not set -# CONFIG_USB_GADGETFS is not set -# CONFIG_USB_FUNCTIONFS is not set -CONFIG_USB_MASS_STORAGE=m -# CONFIG_USB_GADGET_TARGET is not set -CONFIG_USB_G_SERIAL=m -# CONFIG_USB_MIDI_GADGET is not set -# CONFIG_USB_G_PRINTER is not set -# CONFIG_USB_CDC_COMPOSITE is not set -# CONFIG_USB_G_ACM_MS is not set -# CONFIG_USB_G_MULTI is not set -# CONFIG_USB_G_HID is not set -# CONFIG_USB_G_DBGP is not set -# CONFIG_USB_G_WEBCAM is not set # CONFIG_TYPEC is not set -CONFIG_USB_ROLE_SWITCH=m +# CONFIG_USB_ROLE_SWITCH is not set CONFIG_MMC=y CONFIG_PWRSEQ_EMMC=y # CONFIG_PWRSEQ_SD8787 is not set @@ -4918,7 +4909,8 @@ CONFIG_LEDS_PWM=y # CONFIG_LEDS_LT3593 is not set # CONFIG_LEDS_TCA6507 is not set # CONFIG_LEDS_TLC591XX is not set -CONFIG_LEDS_MAX77650=m +CONFIG_LEDS_MAX77693=y +CONFIG_LEDS_MAX8997=y # CONFIG_LEDS_LM355x is not set # CONFIG_LEDS_KTD2692 is not set # CONFIG_LEDS_IS31FL319X is not set @@ -4931,9 +4923,8 @@ CONFIG_LEDS_MAX77650=m # CONFIG_LEDS_SYSCON is not set # CONFIG_LEDS_MLXREG is not set # CONFIG_LEDS_USER is not set -CONFIG_LEDS_SPI_BYTE=m -CONFIG_LEDS_TI_LMU_COMMON=m -CONFIG_LEDS_LM3697=m +# CONFIG_LEDS_SPI_BYTE is not set +# CONFIG_LEDS_TI_LMU_COMMON is not set # # LED Triggers @@ -4955,8 +4946,8 @@ CONFIG_LEDS_TRIGGER_HEARTBEAT=y # CONFIG_LEDS_TRIGGER_CAMERA is not set # CONFIG_LEDS_TRIGGER_PANIC is not set # CONFIG_LEDS_TRIGGER_NETDEV is not set -CONFIG_LEDS_TRIGGER_PATTERN=m -CONFIG_LEDS_TRIGGER_AUDIO=m +# CONFIG_LEDS_TRIGGER_PATTERN is not set +# CONFIG_LEDS_TRIGGER_AUDIO is not set # CONFIG_ACCESSIBILITY is not set # CONFIG_INFINIBAND is not set CONFIG_EDAC_ATOMIC_SCRUB=y @@ -4983,13 +4974,16 @@ CONFIG_RTC_INTF_DEV=y # I2C RTC drivers # # CONFIG_RTC_DRV_ABB5ZES3 is not set -CONFIG_RTC_DRV_ABEOZ9=m +# CONFIG_RTC_DRV_ABEOZ9 is not set # CONFIG_RTC_DRV_ABX80X is not set # CONFIG_RTC_DRV_DS1307 is not set # CONFIG_RTC_DRV_DS1374 is not set # CONFIG_RTC_DRV_DS1672 is not set # CONFIG_RTC_DRV_HYM8563 is not set # CONFIG_RTC_DRV_MAX6900 is not set +CONFIG_RTC_DRV_MAX8998=y +CONFIG_RTC_DRV_MAX8997=y +CONFIG_RTC_DRV_MAX77686=y # CONFIG_RTC_DRV_RS5C372 is not set # CONFIG_RTC_DRV_ISL1208 is not set # CONFIG_RTC_DRV_ISL12022 is not set @@ -5009,10 +5003,10 @@ CONFIG_RTC_DRV_ABEOZ9=m # CONFIG_RTC_DRV_RX8581 is not set # CONFIG_RTC_DRV_RX8025 is not set # CONFIG_RTC_DRV_EM3027 is not set -CONFIG_RTC_DRV_RV3028=m +# CONFIG_RTC_DRV_RV3028 is not set # CONFIG_RTC_DRV_RV8803 is not set CONFIG_RTC_DRV_S5M=y -CONFIG_RTC_DRV_SD3078=m +# CONFIG_RTC_DRV_SD3078 is not set # # SPI RTC drivers @@ -5060,7 +5054,7 @@ CONFIG_RTC_I2C_AND_SPI=y # CONFIG_RTC_DRV_RP5C01 is not set # CONFIG_RTC_DRV_V3020 is not set # CONFIG_RTC_DRV_ZYNQMP is not set -CONFIG_RTC_DRV_CROS_EC=m +# CONFIG_RTC_DRV_CROS_EC is not set # # on-CPU RTC drivers @@ -5069,7 +5063,7 @@ CONFIG_HAVE_S3C_RTC=y CONFIG_RTC_DRV_S3C=y # CONFIG_RTC_DRV_PL030 is not set # CONFIG_RTC_DRV_PL031 is not set -CONFIG_RTC_DRV_CADENCE=m +# CONFIG_RTC_DRV_CADENCE is not set # CONFIG_RTC_DRV_FTRTC010 is not set # CONFIG_RTC_DRV_SNVS is not set # CONFIG_RTC_DRV_R7301 is not set @@ -5084,15 +5078,13 @@ CONFIG_DMADEVICES=y # # DMA Devices # -CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH=y CONFIG_DMA_ENGINE=y -CONFIG_DMA_VIRTUAL_CHANNELS=m CONFIG_DMA_OF=y # CONFIG_ALTERA_MSGDMA is not set # CONFIG_AMBA_PL08X is not set # CONFIG_DW_AXI_DMAC is not set # CONFIG_FSL_EDMA is not set -CONFIG_FSL_QDMA=m +# CONFIG_FSL_QDMA is not set # CONFIG_INTEL_IDMA64 is not set # CONFIG_NBPFAXI_DMA is not set CONFIG_PL330_DMA=y @@ -5105,7 +5097,6 @@ CONFIG_PL330_DMA=y # # CONFIG_ASYNC_TX_DMA is not set # CONFIG_DMATEST is not set -CONFIG_DMA_ENGINE_RAID=y # # DMABUF options @@ -5113,15 +5104,12 @@ CONFIG_DMA_ENGINE_RAID=y CONFIG_SYNC_FILE=y # CONFIG_SW_SYNC is not set # CONFIG_UDMABUF is not set -CONFIG_DMABUF_SELFTESTS=m +# CONFIG_DMABUF_SELFTESTS is not set # end of DMABUF options # CONFIG_AUXDISPLAY is not set # CONFIG_PANEL is not set -CONFIG_UIO=m -CONFIG_UIO_PDRV_GENIRQ=m -CONFIG_UIO_DMEM_GENIRQ=m -# CONFIG_UIO_PRUSS is not set +# CONFIG_UIO is not set # CONFIG_VFIO is not set # CONFIG_VIRT_DRIVERS is not set CONFIG_VIRTIO_MENU=y @@ -5133,169 +5121,20 @@ CONFIG_VIRTIO_MENU=y # end of Microsoft Hyper-V guest support # CONFIG_GREYBUS is not set -CONFIG_STAGING=y -CONFIG_PRISM2_USB=m -# CONFIG_COMEDI is not set -# CONFIG_RTLLIB is not set -# CONFIG_RTL8723BS is not set -CONFIG_R8712U=m -CONFIG_R8188EU=m -CONFIG_88EU_AP_MODE=y -# CONFIG_VT6656 is not set - -# -# IIO staging drivers -# - -# -# Accelerometers -# -# CONFIG_ADIS16203 is not set -# CONFIG_ADIS16240 is not set -# end of Accelerometers - -# -# Analog to digital converters -# -# CONFIG_AD7816 is not set -# CONFIG_AD7192 is not set -# CONFIG_AD7280 is not set -# end of Analog to digital converters - -# -# Analog digital bi-direction converters -# -# CONFIG_ADT7316 is not set -# end of Analog digital bi-direction converters - -# -# Capacitance to digital converters -# -# CONFIG_AD7150 is not set -# CONFIG_AD7746 is not set -# end of Capacitance to digital converters - -# -# Direct Digital Synthesis -# -# CONFIG_AD9832 is not set -# CONFIG_AD9834 is not set -# end of Direct Digital Synthesis - -# -# Network Analyzer, Impedance Converters -# -# CONFIG_AD5933 is not set -# end of Network Analyzer, Impedance Converters - -# -# Active energy metering IC -# -# CONFIG_ADE7854 is not set -# end of Active energy metering IC - -# -# Resolver to digital converters -# -# CONFIG_AD2S1210 is not set -# end of Resolver to digital converters -# end of IIO staging drivers - -# -# Speakup console speech -# -# CONFIG_SPEAKUP is not set -# end of Speakup console speech - -CONFIG_STAGING_MEDIA=y - -# -# soc_camera sensor drivers -# - -# -# Android -# -# end of Android - -# CONFIG_STAGING_BOARD is not set -# CONFIG_LTE_GDM724X is not set -# CONFIG_GS_FPGABOOT is not set -# CONFIG_UNISYSSPAR is not set -# CONFIG_COMMON_CLK_XLNX_CLKWZRD is not set -CONFIG_FB_TFT=m -CONFIG_FB_TFT_AGM1264K_FL=m -CONFIG_FB_TFT_BD663474=m -CONFIG_FB_TFT_HX8340BN=m -CONFIG_FB_TFT_HX8347D=m -CONFIG_FB_TFT_HX8353D=m -CONFIG_FB_TFT_HX8357D=m -CONFIG_FB_TFT_ILI9163=m -CONFIG_FB_TFT_ILI9320=m -CONFIG_FB_TFT_ILI9325=m -CONFIG_FB_TFT_ILI9340=m -CONFIG_FB_TFT_ILI9341=m -CONFIG_FB_TFT_ILI9481=m -CONFIG_FB_TFT_ILI9486=m -CONFIG_FB_TFT_PCD8544=m -CONFIG_FB_TFT_RA8875=m -CONFIG_FB_TFT_S6D02A1=m -CONFIG_FB_TFT_S6D1121=m -# CONFIG_FB_TFT_SH1106 is not set -CONFIG_FB_TFT_SSD1289=m -CONFIG_FB_TFT_SSD1305=m -CONFIG_FB_TFT_SSD1306=m -CONFIG_FB_TFT_SSD1331=m -CONFIG_FB_TFT_SSD1351=m -CONFIG_FB_TFT_ST7735R=m -CONFIG_FB_TFT_ST7789V=m -CONFIG_FB_TFT_TINYLCD=m -CONFIG_FB_TFT_TLS8204=m -CONFIG_FB_TFT_UC1611=m -CONFIG_FB_TFT_UC1701=m -CONFIG_FB_TFT_UPD161704=m -CONFIG_FB_TFT_WATTEROTT=m -CONFIG_FB_TFT_HKTFT35=m -CONFIG_FB_TFT_HKTFT32=m -# CONFIG_WILC1000_SDIO is not set -# CONFIG_WILC1000_SPI is not set -# CONFIG_MOST is not set -# CONFIG_KS7010 is not set -# CONFIG_PI433 is not set - -# -# Gasket devices -# -# end of Gasket devices - -# CONFIG_XIL_AXIS_FIFO is not set -CONFIG_FIELDBUS_DEV=m -CONFIG_HMS_ANYBUSS_BUS=m -CONFIG_ARCX_ANYBUS_CONTROLLER=m -CONFIG_HMS_PROFINET=m -# CONFIG_USB_WUSB_CBAF is not set -# CONFIG_UWB is not set -CONFIG_EXFAT_FS=m -CONFIG_EXFAT_DONT_MOUNT_VFAT=y -CONFIG_EXFAT_DISCARD=y -# CONFIG_EXFAT_DELAYED_SYNC is not set -# CONFIG_EXFAT_KERNEL_DEBUG is not set -# CONFIG_EXFAT_DEBUG_MSG is not set -CONFIG_EXFAT_DEFAULT_CODEPAGE=437 -CONFIG_EXFAT_DEFAULT_IOCHARSET="utf8" +# CONFIG_STAGING is not set # CONFIG_GOLDFISH is not set CONFIG_MFD_CROS_EC=y CONFIG_CHROME_PLATFORMS=y CONFIG_CROS_EC=y -CONFIG_CROS_EC_I2C=m -CONFIG_CROS_EC_SPI=m +CONFIG_CROS_EC_I2C=y +CONFIG_CROS_EC_SPI=y CONFIG_CROS_EC_PROTO=y CONFIG_CROS_EC_CHARDEV=m CONFIG_CROS_EC_LIGHTBAR=m CONFIG_CROS_EC_VBC=m CONFIG_CROS_EC_DEBUGFS=m CONFIG_CROS_EC_SYSFS=m -CONFIG_CROS_USBPD_LOGGER=m +# CONFIG_CROS_USBPD_LOGGER is not set # CONFIG_MELLANOX_PLATFORM is not set CONFIG_CLKDEV_LOOKUP=y CONFIG_HAVE_CLK_PREPARE=y @@ -5305,8 +5144,9 @@ CONFIG_COMMON_CLK=y # Common Clock Framework # # CONFIG_CLK_HSDK is not set -CONFIG_COMMON_CLK_MAX9485=m -CONFIG_COMMON_CLK_SI5341=m +CONFIG_COMMON_CLK_MAX77686=y +# CONFIG_COMMON_CLK_MAX9485 is not set +# CONFIG_COMMON_CLK_SI5341 is not set # CONFIG_COMMON_CLK_SI5351 is not set # CONFIG_COMMON_CLK_SI514 is not set # CONFIG_COMMON_CLK_SI544 is not set @@ -5448,17 +5288,21 @@ CONFIG_EXTCON=y # CONFIG_EXTCON_ADC_JACK is not set # CONFIG_EXTCON_FSA9480 is not set # CONFIG_EXTCON_GPIO is not set +CONFIG_EXTCON_MAX14577=y # CONFIG_EXTCON_MAX3355 is not set +CONFIG_EXTCON_MAX77693=y +CONFIG_EXTCON_MAX8997=y # CONFIG_EXTCON_PTN5150 is not set # CONFIG_EXTCON_RT8973A is not set # CONFIG_EXTCON_SM5502 is not set -CONFIG_EXTCON_USB_GPIO=m +# CONFIG_EXTCON_USB_GPIO is not set # CONFIG_EXTCON_USBC_CROS_EC is not set CONFIG_MEMORY=y +CONFIG_DDR=y # CONFIG_ARM_PL172_MPMC is not set CONFIG_PL353_SMC=y CONFIG_SAMSUNG_MC=y -# CONFIG_EXYNOS5422_DMC is not set +CONFIG_EXYNOS5422_DMC=y CONFIG_EXYNOS_SROM=y CONFIG_IIO=y CONFIG_IIO_BUFFER=y @@ -5479,9 +5323,8 @@ CONFIG_IIO_CONSUMERS_PER_TRIGGER=2 # CONFIG_ADIS16209 is not set # CONFIG_ADXL345_I2C is not set # CONFIG_ADXL345_SPI is not set -CONFIG_ADXL372=m -CONFIG_ADXL372_SPI=m -CONFIG_ADXL372_I2C=m +# CONFIG_ADXL372_SPI is not set +# CONFIG_ADXL372_I2C is not set # CONFIG_BMA180 is not set # CONFIG_BMA220 is not set # CONFIG_BMC150_ACCEL is not set @@ -5491,7 +5334,6 @@ CONFIG_ADXL372_I2C=m # CONFIG_DMARD09 is not set # CONFIG_DMARD10 is not set CONFIG_HID_SENSOR_ACCEL_3D=m -# CONFIG_IIO_CROS_EC_ACCEL_LEGACY is not set # CONFIG_IIO_ST_ACCEL_3AXIS is not set # CONFIG_KXSD9 is not set # CONFIG_KXCJK1013 is not set @@ -5517,24 +5359,22 @@ CONFIG_HID_SENSOR_ACCEL_3D=m # CONFIG_AD7291 is not set # CONFIG_AD7298 is not set # CONFIG_AD7476 is not set -CONFIG_AD7606=m -CONFIG_AD7606_IFACE_PARALLEL=m -CONFIG_AD7606_IFACE_SPI=m +# CONFIG_AD7606_IFACE_PARALLEL is not set +# CONFIG_AD7606_IFACE_SPI is not set # CONFIG_AD7766 is not set -CONFIG_AD7768_1=m +# CONFIG_AD7768_1 is not set # CONFIG_AD7780 is not set # CONFIG_AD7791 is not set # CONFIG_AD7793 is not set # CONFIG_AD7887 is not set # CONFIG_AD7923 is not set -CONFIG_AD7949=m +# CONFIG_AD7949 is not set # CONFIG_AD799X is not set # CONFIG_CC10001_ADC is not set # CONFIG_ENVELOPE_DETECTOR is not set CONFIG_EXYNOS_ADC=y # CONFIG_HI8435 is not set # CONFIG_HX711 is not set -# CONFIG_INA2XX_ADC is not set # CONFIG_LTC2471 is not set # CONFIG_LTC2485 is not set # CONFIG_LTC2497 is not set @@ -5545,7 +5385,7 @@ CONFIG_EXYNOS_ADC=y # CONFIG_MAX9611 is not set # CONFIG_MCP320X is not set # CONFIG_MCP3422 is not set -CONFIG_MCP3911=m +# CONFIG_MCP3911 is not set # CONFIG_NAU7802 is not set # CONFIG_SD_ADC_MODULATOR is not set # CONFIG_TI_ADC081C is not set @@ -5557,12 +5397,12 @@ CONFIG_MCP3911=m # CONFIG_TI_ADC161S626 is not set # CONFIG_TI_ADS1015 is not set # CONFIG_TI_ADS7950 is not set -CONFIG_TI_ADS8344=m +# CONFIG_TI_ADS8344 is not set # CONFIG_TI_ADS8688 is not set -CONFIG_TI_ADS124S08=m +# CONFIG_TI_ADS124S08 is not set # CONFIG_TI_TLC4541 is not set # CONFIG_VF610_ADC is not set -CONFIG_XILINX_XADC=m +# CONFIG_XILINX_XADC is not set # end of Analog to digital converters # @@ -5591,9 +5431,7 @@ CONFIG_SENSIRION_SGP30=m # CONFIG_VZ89X is not set # end of Chemical Sensors -CONFIG_IIO_CROS_EC_SENSORS_CORE=m -CONFIG_IIO_CROS_EC_SENSORS=m -CONFIG_IIO_CROS_EC_SENSORS_LID_ANGLE=m +# CONFIG_IIO_CROS_EC_SENSORS_CORE is not set # # Hid Sensor IIO Common @@ -5621,12 +5459,12 @@ CONFIG_HID_SENSOR_IIO_TRIGGER=m # CONFIG_AD5593R is not set # CONFIG_AD5504 is not set # CONFIG_AD5624R_SPI is not set -CONFIG_LTC1660=m +# CONFIG_LTC1660 is not set # CONFIG_LTC2632 is not set # CONFIG_AD5686_SPI is not set # CONFIG_AD5696_I2C is not set # CONFIG_AD5755 is not set -CONFIG_AD5758=m +# CONFIG_AD5758 is not set # CONFIG_AD5761 is not set # CONFIG_AD5764 is not set # CONFIG_AD5791 is not set @@ -5641,8 +5479,8 @@ CONFIG_AD5758=m # CONFIG_MCP4922 is not set # CONFIG_TI_DAC082S085 is not set # CONFIG_TI_DAC5571 is not set -CONFIG_TI_DAC7311=m -CONFIG_TI_DAC7612=m +# CONFIG_TI_DAC7311 is not set +# CONFIG_TI_DAC7612 is not set # CONFIG_VF610_DAC is not set # end of Digital to analog converters @@ -5665,7 +5503,7 @@ CONFIG_TI_DAC7612=m # Phase-Locked Loop (PLL) frequency synthesizers # # CONFIG_ADF4350 is not set -CONFIG_ADF4371=m +# CONFIG_ADF4371 is not set # end of Phase-Locked Loop (PLL) frequency synthesizers # end of Frequency Synthesizers DDS/PLL @@ -5678,10 +5516,8 @@ CONFIG_ADF4371=m # CONFIG_ADIS16260 is not set # CONFIG_ADXRS450 is not set # CONFIG_BMG160 is not set -CONFIG_FXAS21002C=m -CONFIG_FXAS21002C_I2C=m -CONFIG_FXAS21002C_SPI=m -CONFIG_HID_SENSOR_GYRO_3D=m +# CONFIG_FXAS21002C is not set +# CONFIG_HID_SENSOR_GYRO_3D is not set # CONFIG_MPU3050_I2C is not set # CONFIG_IIO_ST_GYRO_3AXIS is not set # CONFIG_ITG3200 is not set @@ -5742,7 +5578,6 @@ CONFIG_HID_SENSOR_HUMIDITY=m # CONFIG_CM3323 is not set # CONFIG_CM3605 is not set CONFIG_CM36651=y -CONFIG_IIO_CROS_EC_LIGHT_PROX=m # CONFIG_GP2AP020A00F is not set # CONFIG_SENSORS_ISL29018 is not set # CONFIG_SENSORS_ISL29028 is not set @@ -5754,11 +5589,11 @@ CONFIG_HID_SENSOR_PROX=m # CONFIG_LTR501 is not set # CONFIG_LV0104CS is not set # CONFIG_MAX44000 is not set -CONFIG_MAX44009=m -CONFIG_NOA1305=m +# CONFIG_MAX44009 is not set +# CONFIG_NOA1305 is not set # CONFIG_OPT3001 is not set # CONFIG_PA12203001 is not set -CONFIG_SI1133=m +# CONFIG_SI1133 is not set # CONFIG_SI1145 is not set # CONFIG_STK3310 is not set # CONFIG_ST_UVIS25 is not set @@ -5770,7 +5605,7 @@ CONFIG_SI1133=m # CONFIG_TSL4531 is not set # CONFIG_US5182D is not set # CONFIG_VCNL4000 is not set -CONFIG_VCNL4035=m +# CONFIG_VCNL4035 is not set # CONFIG_VEML6070 is not set # CONFIG_VL6180 is not set # CONFIG_ZOPT2201 is not set @@ -5790,9 +5625,8 @@ CONFIG_HID_SENSOR_MAGNETOMETER_3D=m # CONFIG_IIO_ST_MAGN_3AXIS is not set # CONFIG_SENSORS_HMC5843_I2C is not set # CONFIG_SENSORS_HMC5843_SPI is not set -CONFIG_SENSORS_RM3100=m -CONFIG_SENSORS_RM3100_I2C=m -CONFIG_SENSORS_RM3100_SPI=m +# CONFIG_SENSORS_RM3100_I2C is not set +# CONFIG_SENSORS_RM3100_SPI is not set # end of Magnetometer sensors # @@ -5820,13 +5654,13 @@ CONFIG_HID_SENSOR_DEVICE_ROTATION=m # # CONFIG_AD5272 is not set # CONFIG_DS1803 is not set -CONFIG_MAX5432=m +# CONFIG_MAX5432 is not set # CONFIG_MAX5481 is not set # CONFIG_MAX5487 is not set # CONFIG_MCP4018 is not set # CONFIG_MCP4131 is not set # CONFIG_MCP4531 is not set -CONFIG_MCP41010=m +# CONFIG_MCP41010 is not set # CONFIG_TPL0102 is not set # end of Digital potentiometers @@ -5843,7 +5677,6 @@ CONFIG_MCP41010=m CONFIG_BMP280=m CONFIG_BMP280_I2C=m CONFIG_BMP280_SPI=m -CONFIG_IIO_CROS_EC_BARO=m CONFIG_DPS310=m CONFIG_HID_SENSOR_PRESS=m # CONFIG_HP03 is not set @@ -5867,14 +5700,14 @@ CONFIG_HID_SENSOR_PRESS=m # # Proximity and distance sensors # -CONFIG_ISL29501=m +# CONFIG_ISL29501 is not set # CONFIG_LIDAR_LITE_V2 is not set -CONFIG_MB1232=m +# CONFIG_MB1232 is not set # CONFIG_RFD77402 is not set # CONFIG_SRF04 is not set # CONFIG_SX9500 is not set # CONFIG_SRF08 is not set -CONFIG_VL53L0X_I2C=m +# CONFIG_VL53L0X_I2C is not set # end of Proximity and distance sensors # @@ -5895,12 +5728,12 @@ CONFIG_HID_SENSOR_TEMP=m # CONFIG_TMP007 is not set # CONFIG_TSYS01 is not set # CONFIG_TSYS02D is not set -CONFIG_MAX31856=m +# CONFIG_MAX31856 is not set # end of Temperature sensors CONFIG_PWM=y CONFIG_PWM_SYSFS=y -CONFIG_PWM_CROS_EC=m +# CONFIG_PWM_CROS_EC is not set # CONFIG_PWM_FSL_FTM is not set # CONFIG_PWM_PCA9685 is not set CONFIG_PWM_SAMSUNG=y @@ -5922,17 +5755,16 @@ CONFIG_GIC_NON_BANKED=y # PHY Subsystem # CONFIG_GENERIC_PHY=y -CONFIG_GENERIC_PHY_MIPI_DPHY=y # CONFIG_BCM_KONA_USB2_PHY is not set -CONFIG_PHY_CADENCE_DP=m -CONFIG_PHY_CADENCE_DPHY=m -CONFIG_PHY_FSL_IMX8MQ_USB=m -CONFIG_PHY_MIXEL_MIPI_DPHY=m +# CONFIG_PHY_CADENCE_DP is not set +# CONFIG_PHY_CADENCE_DPHY is not set +# CONFIG_PHY_FSL_IMX8MQ_USB is not set +# CONFIG_PHY_MIXEL_MIPI_DPHY is not set # CONFIG_PHY_PXA_28NM_HSIC is not set # CONFIG_PHY_PXA_28NM_USB2 is not set # CONFIG_PHY_CPCAP_USB is not set # CONFIG_PHY_MAPPHONE_MDM6600 is not set -CONFIG_PHY_OCELOT_SERDES=m +# CONFIG_PHY_OCELOT_SERDES is not set CONFIG_PHY_EXYNOS_DP_VIDEO=y CONFIG_PHY_EXYNOS_MIPI_VIDEO=y # CONFIG_PHY_EXYNOS_PCIE is not set @@ -5950,9 +5782,7 @@ CONFIG_PHY_EXYNOS5250_SATA=y # # Performance monitor support # -CONFIG_ARM_CCI_PMU=m -CONFIG_ARM_CCI400_PMU=y -CONFIG_ARM_CCI5xx_PMU=y +# CONFIG_ARM_CCI_PMU is not set # CONFIG_ARM_CCN is not set CONFIG_ARM_PMU=y # end of Performance monitor support @@ -5965,7 +5795,7 @@ CONFIG_ARM_PMU=y # CONFIG_ANDROID is not set # end of Android -CONFIG_DAX=y +# CONFIG_DAX is not set CONFIG_NVMEM=y CONFIG_NVMEM_SYSFS=y @@ -5993,16 +5823,15 @@ CONFIG_MUX_MMIO=m CONFIG_PM_OPP=y # CONFIG_SIOX is not set # CONFIG_SLIMBUS is not set -CONFIG_INTERCONNECT=m -CONFIG_COUNTER=m -CONFIG_FTM_QUADDEC=m +# CONFIG_INTERCONNECT is not set +# CONFIG_COUNTER is not set # end of Device Drivers # # File systems # CONFIG_DCACHE_WORD_ACCESS=y -CONFIG_VALIDATE_FS_PARSER=y +# CONFIG_VALIDATE_FS_PARSER is not set CONFIG_FS_IOMAP=y CONFIG_EXT2_FS=y # CONFIG_EXT2_FS_XATTR is not set diff --git a/config/kernel/linux-odroidxu4-legacy.config b/config/kernel/linux-odroidxu4-legacy.config index ab3476def..364e0c891 100644 --- a/config/kernel/linux-odroidxu4-legacy.config +++ b/config/kernel/linux-odroidxu4-legacy.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 4.14.162 Kernel Configuration +# Linux/arm 4.14.167 Kernel Configuration # CONFIG_ARM=y CONFIG_ARM_HAS_SG_CHAIN=y diff --git a/config/kernel/linux-rk3399-legacy.config b/config/kernel/linux-rk3399-legacy.config index 8c207d623..ac15069e4 100644 --- a/config/kernel/linux-rk3399-legacy.config +++ b/config/kernel/linux-rk3399-legacy.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 4.4.208 Kernel Configuration +# Linux/arm64 4.4.211 Kernel Configuration # CONFIG_ARM64=y CONFIG_64BIT=y diff --git a/config/kernel/linux-rockchip-legacy.config b/config/kernel/linux-rockchip-legacy.config index c38436465..6e6e93b3b 100644 --- a/config/kernel/linux-rockchip-legacy.config +++ b/config/kernel/linux-rockchip-legacy.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 4.4.208 Kernel Configuration +# Linux/arm 4.4.211 Kernel Configuration # CONFIG_ARM=y CONFIG_ARM_HAS_SG_CHAIN=y diff --git a/config/kernel/linux-rockchip64-legacy.config b/config/kernel/linux-rockchip64-legacy.config index 2359b1d38..6a32d777f 100644 --- a/config/kernel/linux-rockchip64-legacy.config +++ b/config/kernel/linux-rockchip64-legacy.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 4.4.207 Kernel Configuration +# Linux/arm64 4.4.211 Kernel Configuration # CONFIG_ARM64=y CONFIG_64BIT=y diff --git a/config/sources/families/odroidxu4.conf b/config/sources/families/odroidxu4.conf index 2f26de70a..a5331b16e 100644 --- a/config/sources/families/odroidxu4.conf +++ b/config/sources/families/odroidxu4.conf @@ -17,12 +17,15 @@ case $BRANCH in ;; - current|dev) + current) KERNELSOURCE='https://github.com/mihailescu2m/linux' KERNELBRANCH='branch:odroidxu4-5.4.y' KERNELDIR='linux-odroidxu4' + ;; + dev) + KERNELBRANCH='branch:linux-5.5.y' ;; esac diff --git a/patch/kernel/odroidxu4-current/0002-next-soc-samsung-exynos-asv-fix-potential-overflow-in-multiply.patch b/patch/kernel/odroidxu4-current/0002-next-soc-samsung-exynos-asv-fix-potential-overflow-in-multiply.patch new file mode 100644 index 000000000..d39700049 --- /dev/null +++ b/patch/kernel/odroidxu4-current/0002-next-soc-samsung-exynos-asv-fix-potential-overflow-in-multiply.patch @@ -0,0 +1,52 @@ +From: Colin Ian King + +The multiplication of opp_freq by MHZ is performed using unsigned int +multiplication however the result is being passed into a function where +the frequency is an unsigned long, so there is an expectation that the +result won't fit into an unsigned int. Fix any potential integer overflow +my making opp_freq an unsigned long. Also change from %u to %lu format +specifiers + +Addresses-Coverity: ("Unintentional integer overflow") +Fixes: 5ea428595cc5 ("soc: samsung: Add Exynos Adaptive Supply Voltage driver") +Signed-off-by: Colin Ian King +--- + drivers/soc/samsung/exynos-asv.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/soc/samsung/exynos-asv.c b/drivers/soc/samsung/exynos-asv.c +index 8abf4dfaa5c5..d66fc74379a3 100644 +--- a/drivers/soc/samsung/exynos-asv.c ++++ b/drivers/soc/samsung/exynos-asv.c +@@ -30,7 +30,7 @@ static int exynos_asv_update_cpu_opps(struct exynos_asv *asv, + { + struct exynos_asv_subsys *subsys = NULL; + struct dev_pm_opp *opp; +- unsigned int opp_freq; ++ unsigned long opp_freq; + int i; + + for (i = 0; i < ARRAY_SIZE(asv->subsys); i++) { +@@ -51,7 +51,7 @@ static int exynos_asv_update_cpu_opps(struct exynos_asv *asv, + + opp = dev_pm_opp_find_freq_exact(cpu, opp_freq * MHZ, true); + if (IS_ERR(opp)) { +- dev_info(asv->dev, "cpu%d opp%d, freq: %u missing\n", ++ dev_info(asv->dev, "cpu%d opp%d, freq: %lu missing\n", + cpu->id, i, opp_freq); + + continue; +@@ -68,11 +68,11 @@ static int exynos_asv_update_cpu_opps(struct exynos_asv *asv, + new_volt, new_volt, new_volt); + if (ret < 0) + dev_err(asv->dev, +- "Failed to adjust OPP %u Hz/%u uV for cpu%d\n", ++ "Failed to adjust OPP %lu Hz/%u uV for cpu%d\n", + opp_freq, new_volt, cpu->id); + else + dev_dbg(asv->dev, +- "Adjusted OPP %u Hz/%u -> %u uV, cpu%d\n", ++ "Adjusted OPP %lu Hz/%u -> %u uV, cpu%d\n", + opp_freq, volt, new_volt, cpu->id); + } + diff --git a/patch/kernel/odroidxu4-current/0003-add-yaml-DWC2-bindings.patch b/patch/kernel/odroidxu4-current/0003-add-yaml-DWC2-bindings.patch new file mode 100644 index 000000000..2ae198707 --- /dev/null +++ b/patch/kernel/odroidxu4-current/0003-add-yaml-DWC2-bindings.patch @@ -0,0 +1,271 @@ +Convert DWC2 bindings to DT schema format using json-schema. +DWC2 is widely use but a couple of compatibles and properties +(vusb_d-supply,vusb_a-supply) were missing in dwc2.txt, the +patch add them. + +Signed-off-by: Benjamin Gaignard +--- +CC: Minas Harutyunyan + +changes in version 2: +- put Minas Harutyunyan as maintainer +- remove type and description from phy property +- remove description from compatible items +- simplify samsung,s3c6400-hsotg compatible handling + + Documentation/devicetree/bindings/usb/dwc2.txt | 64 ---------- + Documentation/devicetree/bindings/usb/dwc2.yaml | 152 ++++++++++++++++++++++++ + 2 files changed, 152 insertions(+), 64 deletions(-) + delete mode 100644 Documentation/devicetree/bindings/usb/dwc2.txt + create mode 100644 Documentation/devicetree/bindings/usb/dwc2.yaml + +diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt b/Documentation/devicetree/bindings/usb/dwc2.txt +deleted file mode 100644 +index aafff3a6904d..000000000000 +--- a/Documentation/devicetree/bindings/usb/dwc2.txt ++++ /dev/null +@@ -1,64 +0,0 @@ +-Platform DesignWare HS OTG USB 2.0 controller +------------------------------------------------------ +- +-Required properties: +-- compatible : One of: +- - brcm,bcm2835-usb: The DWC2 USB controller instance in the BCM2835 SoC. +- - hisilicon,hi6220-usb: The DWC2 USB controller instance in the hi6220 SoC. +- - rockchip,rk3066-usb: The DWC2 USB controller instance in the rk3066 Soc; +- - "rockchip,px30-usb", "rockchip,rk3066-usb", "snps,dwc2": for px30 Soc; +- - "rockchip,rk3188-usb", "rockchip,rk3066-usb", "snps,dwc2": for rk3188 Soc; +- - "rockchip,rk3288-usb", "rockchip,rk3066-usb", "snps,dwc2": for rk3288 Soc; +- - "lantiq,arx100-usb": The DWC2 USB controller instance in Lantiq ARX SoCs; +- - "lantiq,xrx200-usb": The DWC2 USB controller instance in Lantiq XRX SoCs; +- - "amlogic,meson8-usb": The DWC2 USB controller instance in Amlogic Meson8 SoCs; +- - "amlogic,meson8b-usb": The DWC2 USB controller instance in Amlogic Meson8b SoCs; +- - "amlogic,meson-gxbb-usb": The DWC2 USB controller instance in Amlogic S905 SoCs; +- - "amlogic,meson-g12a-usb": The DWC2 USB controller instance in Amlogic G12A SoCs; +- - "amcc,dwc-otg": The DWC2 USB controller instance in AMCC Canyonlands 460EX SoCs; +- - snps,dwc2: A generic DWC2 USB controller with default parameters. +- - "st,stm32f4x9-fsotg": The DWC2 USB FS/HS controller instance in STM32F4x9 SoCs +- configured in FS mode; +- - "st,stm32f4x9-hsotg": The DWC2 USB HS controller instance in STM32F4x9 SoCs +- configured in HS mode; +- - "st,stm32f7-hsotg": The DWC2 USB HS controller instance in STM32F7 SoCs +- configured in HS mode; +-- reg : Should contain 1 register range (address and length) +-- interrupts : Should contain 1 interrupt +-- clocks: clock provider specifier +-- clock-names: shall be "otg" +-Refer to clk/clock-bindings.txt for generic clock consumer properties +- +-Optional properties: +-- phys: phy provider specifier +-- phy-names: shall be "usb2-phy" +-- vbus-supply: reference to the VBUS regulator. Depending on the current mode +- this is enabled (in "host" mode") or disabled (in "peripheral" mode). The +- regulator is updated if the controller is configured in "otg" mode and the +- status changes between "host" and "peripheral". +-Refer to phy/phy-bindings.txt for generic phy consumer properties +-- dr_mode: shall be one of "host", "peripheral" and "otg" +- Refer to usb/generic.txt +-- g-rx-fifo-size: size of rx fifo size in gadget mode. +-- g-np-tx-fifo-size: size of non-periodic tx fifo size in gadget mode. +-- g-tx-fifo-size: size of periodic tx fifo per endpoint (except ep0) in gadget mode. +-- snps,need-phy-for-wake: If present indicates that the phy needs to be left +- on for remote wakeup during suspend. +-- snps,reset-phy-on-wake: If present indicates that we need to reset the PHY when +- we detect a wakeup. This is due to a hardware errata. +- +-Deprecated properties: +-- g-use-dma: gadget DMA mode is automatically detected +- +-Example: +- +- usb@101c0000 { +- compatible = "ralink,rt3050-usb, snps,dwc2"; +- reg = <0x101c0000 40000>; +- interrupts = <18>; +- clocks = <&usb_otg_ahb_clk>; +- clock-names = "otg"; +- phys = <&usbphy>; +- phy-names = "usb2-phy"; +- snps,need-phy-for-wake; +- }; +diff --git a/Documentation/devicetree/bindings/usb/dwc2.yaml b/Documentation/devicetree/bindings/usb/dwc2.yaml +new file mode 100644 +index 000000000000..e29dfcd2466c +--- /dev/null ++++ b/Documentation/devicetree/bindings/usb/dwc2.yaml +@@ -0,0 +1,152 @@ ++# SPDX-License-Identifier: GPL-2.0 ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/usb/dwc2.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: DesignWare HS OTG USB 2.0 controller Bindings ++ ++maintainers: ++ - Minas Harutyunyan ++ ++properties: ++ compatible: ++ oneOf: ++ - const: brcm,bcm2835-usb ++ - const: hisilicon,hi6220-usb ++ - items: ++ - const: rockchip,rk3066-usb ++ - const: snps,dwc2 ++ - items: ++ - const: rockchip,px30-usb ++ - const: rockchip,rk3066-usb ++ - const: snps,dwc2 ++ - items: ++ - const: rockchip,rk3036-usb ++ - const: rockchip,rk3066-usb ++ - const: snps,dwc2 ++ - items: ++ - const: rockchip,rv1108-usb ++ - const: rockchip,rk3066-usb ++ - const: snps,dwc2 ++ - items: ++ - const: rockchip,rk3188-usb ++ - const: rockchip,rk3066-usb ++ - const: snps,dwc2 ++ - items: ++ - const: rockchip,rk3228-usb ++ - const: rockchip,rk3066-usb ++ - const: snps,dwc2 ++ - items: ++ - const: rockchip,rk3288-usb ++ - const: rockchip,rk3066-usb ++ - const: snps,dwc2 ++ - const: lantiq,arx100-usb ++ - const: lantiq,xrx200-usb ++ - items: ++ - const: amlogic,meson8-usb ++ - const: snps,dwc2 ++ - items: ++ - const: amlogic,meson8b-usb ++ - const: snps,dwc2 ++ - const: amlogic,meson-gxbb-usb ++ - items: ++ - const: amlogic,meson-g12a-usb ++ - const: snps,dwc2 ++ - const: amcc,dwc-otg ++ - const: snps,dwc2 ++ - const: st,stm32f4x9-fsotg ++ - const: st,stm32f4x9-hsotg ++ - const: st,stm32f7-hsotg ++ - const: samsung,s3c6400-hsotg ++ ++ reg: ++ maxItems: 1 ++ ++ interrupts: ++ maxItems: 1 ++ ++ clocks: ++ maxItems: 1 ++ ++ clock-names: ++ items: ++ - const: otg ++ ++ resets: ++ items: ++ - description: common reset ++ - description: ecc reset ++ minItems: 1 ++ ++ reset-names: ++ items: ++ - const: dwc2 ++ - const: dwc2-ecc ++ minItems: 1 ++ ++ phys: ++ maxItems: 1 ++ ++ phy-names: ++ const: usb2-phy ++ ++ vbus-supply: ++ description: reference to the VBUS regulator. Depending on the current mode ++ this is enabled (in "host" mode") or disabled (in "peripheral" mode). The ++ regulator is updated if the controller is configured in "otg" mode and the ++ status changes between "host" and "peripheral". ++ ++ vusb_d-supply: ++ description: phandle to voltage regulator of digital section, ++ ++ vusb_a-supply: ++ description: phandle to voltage regulator of analog section. ++ ++ dr_mode: ++ enum: [host, peripheral, otg] ++ ++ g-rx-fifo-size: ++ $ref: /schemas/types.yaml#/definitions/uint32 ++ description: size of rx fifo size in gadget mode. ++ ++ g-np-tx-fifo-size: ++ $ref: /schemas/types.yaml#/definitions/uint32 ++ description: size of non-periodic tx fifo size in gadget mode. ++ ++ g-tx-fifo-size: ++ $ref: /schemas/types.yaml#/definitions/uint32-array ++ description: size of periodic tx fifo per endpoint (except ep0) in gadget mode. ++ ++ snps,need-phy-for-wake: ++ $ref: /schemas/types.yaml#/definitions/flag ++ description: If present indicates that the phy needs to be left on for remote wakeup during suspend. ++ ++ snps,reset-phy-on-wake: ++ $ref: /schemas/types.yaml#/definitions/flag ++ description: If present indicates that we need to reset the PHY when we detect a wakeup. ++ This is due to a hardware errata. ++ ++required: ++ - compatible ++ - reg ++ - interrupts ++ - clocks ++ - clock-names ++ ++additionalProperties: false ++ ++examples: ++ - | ++ usb@101c0000 { ++ compatible = "ralink,rt3050-usb, snps,dwc2"; ++ reg = <0x101c0000 40000>; ++ interrupts = <18>; ++ clocks = <&usb_otg_ahb_clk>; ++ clock-names = "otg"; ++ phys = <&usbphy>; ++ phy-names = "usb2-phy"; ++ snps,need-phy-for-wake; ++ }; ++ ++... + +Remove "snps,dwc2" from hsotg@12480000 node compatible list because +"samsung,s3c6400-hsotg" should be enough. + +Signed-off-by: Benjamin Gaignard +--- + arch/arm/boot/dts/exynos3250.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/exynos3250.dtsi b/arch/arm/boot/dts/exynos3250.dtsi +index b016b0b68306..d4866269f4ee 100644 +--- a/arch/arm/boot/dts/exynos3250.dtsi ++++ b/arch/arm/boot/dts/exynos3250.dtsi +@@ -362,7 +362,7 @@ + }; + + hsotg: hsotg@12480000 { +- compatible = "samsung,s3c6400-hsotg", "snps,dwc2"; ++ compatible = "samsung,s3c6400-hsotg"; + reg = <0x12480000 0x20000>; + interrupts = ; + clocks = <&cmu CLK_USBOTG>; diff --git a/patch/kernel/odroidxu4-current/03-patch-5.4.11-12.patch b/patch/kernel/odroidxu4-current/03-patch-5.4.11-12.patch new file mode 100644 index 000000000..e0f4084ba --- /dev/null +++ b/patch/kernel/odroidxu4-current/03-patch-5.4.11-12.patch @@ -0,0 +1,2421 @@ +diff --git a/Makefile b/Makefile +index e8963f623568..45c6264f1108 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 11 ++SUBLEVEL = 12 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig +index 8a50efb559f3..39002d769d95 100644 +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -73,6 +73,7 @@ config ARM + select HAVE_ARM_SMCCC if CPU_V7 + select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32 + select HAVE_CONTEXT_TRACKING ++ select HAVE_COPY_THREAD_TLS + select HAVE_C_RECORDMCOUNT + select HAVE_DEBUG_KMEMLEAK + select HAVE_DMA_CONTIGUOUS if MMU +diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c +index 9485acc520a4..e7fac125ea0d 100644 +--- a/arch/arm/kernel/process.c ++++ b/arch/arm/kernel/process.c +@@ -224,8 +224,8 @@ void release_thread(struct task_struct *dead_task) + asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); + + int +-copy_thread(unsigned long clone_flags, unsigned long stack_start, +- unsigned long stk_sz, struct task_struct *p) ++copy_thread_tls(unsigned long clone_flags, unsigned long stack_start, ++ unsigned long stk_sz, struct task_struct *p, unsigned long tls) + { + struct thread_info *thread = task_thread_info(p); + struct pt_regs *childregs = task_pt_regs(p); +@@ -259,7 +259,7 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start, + clear_ptrace_hw_breakpoint(p); + + if (clone_flags & CLONE_SETTLS) +- thread->tp_value[0] = childregs->ARM_r3; ++ thread->tp_value[0] = tls; + thread->tp_value[1] = get_tpuser(); + + thread_notify(THREAD_NOTIFY_COPY, thread); +diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig +index 3f047afb982c..6ccd2ed30963 100644 +--- a/arch/arm64/Kconfig ++++ b/arch/arm64/Kconfig +@@ -139,6 +139,7 @@ config ARM64 + select HAVE_CMPXCHG_DOUBLE + select HAVE_CMPXCHG_LOCAL + select HAVE_CONTEXT_TRACKING ++ select HAVE_COPY_THREAD_TLS + select HAVE_DEBUG_BUGVERBOSE + select HAVE_DEBUG_KMEMLEAK + select HAVE_DMA_CONTIGUOUS +diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h +index 2629a68b8724..5af82587909e 100644 +--- a/arch/arm64/include/asm/unistd.h ++++ b/arch/arm64/include/asm/unistd.h +@@ -42,7 +42,6 @@ + #endif + + #define __ARCH_WANT_SYS_CLONE +-#define __ARCH_WANT_SYS_CLONE3 + + #ifndef __COMPAT_SYSCALL_NR + #include +diff --git a/arch/arm64/include/uapi/asm/unistd.h b/arch/arm64/include/uapi/asm/unistd.h +index 4703d218663a..f83a70e07df8 100644 +--- a/arch/arm64/include/uapi/asm/unistd.h ++++ b/arch/arm64/include/uapi/asm/unistd.h +@@ -19,5 +19,6 @@ + #define __ARCH_WANT_NEW_STAT + #define __ARCH_WANT_SET_GET_RLIMIT + #define __ARCH_WANT_TIME32_SYSCALLS ++#define __ARCH_WANT_SYS_CLONE3 + + #include +diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c +index 71f788cd2b18..d54586d5b031 100644 +--- a/arch/arm64/kernel/process.c ++++ b/arch/arm64/kernel/process.c +@@ -360,8 +360,8 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) + + asmlinkage void ret_from_fork(void) asm("ret_from_fork"); + +-int copy_thread(unsigned long clone_flags, unsigned long stack_start, +- unsigned long stk_sz, struct task_struct *p) ++int copy_thread_tls(unsigned long clone_flags, unsigned long stack_start, ++ unsigned long stk_sz, struct task_struct *p, unsigned long tls) + { + struct pt_regs *childregs = task_pt_regs(p); + +@@ -394,11 +394,11 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start, + } + + /* +- * If a TLS pointer was passed to clone (4th argument), use it +- * for the new thread. ++ * If a TLS pointer was passed to clone, use it for the new ++ * thread. + */ + if (clone_flags & CLONE_SETTLS) +- p->thread.uw.tp_value = childregs->regs[3]; ++ p->thread.uw.tp_value = tls; + } else { + memset(childregs, 0, sizeof(struct pt_regs)); + childregs->pstate = PSR_MODE_EL1h; +diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig +index b16237c95ea3..0c29d6cb2c8d 100644 +--- a/arch/parisc/Kconfig ++++ b/arch/parisc/Kconfig +@@ -62,6 +62,7 @@ config PARISC + select HAVE_FTRACE_MCOUNT_RECORD if HAVE_DYNAMIC_FTRACE + select HAVE_KPROBES_ON_FTRACE + select HAVE_DYNAMIC_FTRACE_WITH_REGS ++ select HAVE_COPY_THREAD_TLS + + help + The PA-RISC microprocessor is designed by Hewlett-Packard and used +diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c +index ecc5c2771208..230a6422b99f 100644 +--- a/arch/parisc/kernel/process.c ++++ b/arch/parisc/kernel/process.c +@@ -208,8 +208,8 @@ arch_initcall(parisc_idle_init); + * Copy architecture-specific thread state + */ + int +-copy_thread(unsigned long clone_flags, unsigned long usp, +- unsigned long kthread_arg, struct task_struct *p) ++copy_thread_tls(unsigned long clone_flags, unsigned long usp, ++ unsigned long kthread_arg, struct task_struct *p, unsigned long tls) + { + struct pt_regs *cregs = &(p->thread.regs); + void *stack = task_stack_page(p); +@@ -254,9 +254,9 @@ copy_thread(unsigned long clone_flags, unsigned long usp, + cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN + FRAME_SIZE; + cregs->kpc = (unsigned long) &child_return; + +- /* Setup thread TLS area from the 4th parameter in clone */ ++ /* Setup thread TLS area */ + if (clone_flags & CLONE_SETTLS) +- cregs->cr27 = cregs->gr[23]; ++ cregs->cr27 = tls; + } + + return 0; +diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig +index 8eebbc8860bb..ade9699aa0dd 100644 +--- a/arch/riscv/Kconfig ++++ b/arch/riscv/Kconfig +@@ -61,6 +61,7 @@ config RISCV + select SPARSEMEM_STATIC if 32BIT + select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU + select HAVE_ARCH_MMAP_RND_BITS ++ select HAVE_COPY_THREAD_TLS + + config ARCH_MMAP_RND_BITS_MIN + default 18 if 64BIT +diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c +index 85e3c39bb60b..330b34706aa0 100644 +--- a/arch/riscv/kernel/process.c ++++ b/arch/riscv/kernel/process.c +@@ -99,8 +99,8 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) + return 0; + } + +-int copy_thread(unsigned long clone_flags, unsigned long usp, +- unsigned long arg, struct task_struct *p) ++int copy_thread_tls(unsigned long clone_flags, unsigned long usp, ++ unsigned long arg, struct task_struct *p, unsigned long tls) + { + struct pt_regs *childregs = task_pt_regs(p); + +@@ -120,7 +120,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, + if (usp) /* User fork */ + childregs->sp = usp; + if (clone_flags & CLONE_SETTLS) +- childregs->tp = childregs->a5; ++ childregs->tp = tls; + childregs->a0 = 0; /* Return value of fork() */ + p->thread.ra = (unsigned long)ret_from_fork; + } +diff --git a/arch/um/Kconfig b/arch/um/Kconfig +index fec6b4ca2b6e..c56d3526a3bd 100644 +--- a/arch/um/Kconfig ++++ b/arch/um/Kconfig +@@ -14,6 +14,7 @@ config UML + select HAVE_FUTEX_CMPXCHG if FUTEX + select HAVE_DEBUG_KMEMLEAK + select HAVE_DEBUG_BUGVERBOSE ++ select HAVE_COPY_THREAD_TLS + select GENERIC_IRQ_SHOW + select GENERIC_CPU_DEVICES + select GENERIC_CLOCKEVENTS +diff --git a/arch/um/include/asm/ptrace-generic.h b/arch/um/include/asm/ptrace-generic.h +index 81c647ef9c6c..adf91ef553ae 100644 +--- a/arch/um/include/asm/ptrace-generic.h ++++ b/arch/um/include/asm/ptrace-generic.h +@@ -36,7 +36,7 @@ extern long subarch_ptrace(struct task_struct *child, long request, + extern unsigned long getreg(struct task_struct *child, int regno); + extern int putreg(struct task_struct *child, int regno, unsigned long value); + +-extern int arch_copy_tls(struct task_struct *new); ++extern int arch_set_tls(struct task_struct *new, unsigned long tls); + extern void clear_flushed_tls(struct task_struct *task); + extern int syscall_trace_enter(struct pt_regs *regs); + extern void syscall_trace_leave(struct pt_regs *regs); +diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c +index 263a8f069133..17045e7211bf 100644 +--- a/arch/um/kernel/process.c ++++ b/arch/um/kernel/process.c +@@ -153,8 +153,8 @@ void fork_handler(void) + userspace(¤t->thread.regs.regs, current_thread_info()->aux_fp_regs); + } + +-int copy_thread(unsigned long clone_flags, unsigned long sp, +- unsigned long arg, struct task_struct * p) ++int copy_thread_tls(unsigned long clone_flags, unsigned long sp, ++ unsigned long arg, struct task_struct * p, unsigned long tls) + { + void (*handler)(void); + int kthread = current->flags & PF_KTHREAD; +@@ -188,7 +188,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, + * Set a new TLS for the child thread? + */ + if (clone_flags & CLONE_SETTLS) +- ret = arch_copy_tls(p); ++ ret = arch_set_tls(p, tls); + } + + return ret; +diff --git a/arch/x86/um/tls_32.c b/arch/x86/um/tls_32.c +index 5bd949da7a4a..ac8eee093f9c 100644 +--- a/arch/x86/um/tls_32.c ++++ b/arch/x86/um/tls_32.c +@@ -215,14 +215,12 @@ static int set_tls_entry(struct task_struct* task, struct user_desc *info, + return 0; + } + +-int arch_copy_tls(struct task_struct *new) ++int arch_set_tls(struct task_struct *new, unsigned long tls) + { + struct user_desc info; + int idx, ret = -EFAULT; + +- if (copy_from_user(&info, +- (void __user *) UPT_SI(&new->thread.regs.regs), +- sizeof(info))) ++ if (copy_from_user(&info, (void __user *) tls, sizeof(info))) + goto out; + + ret = -EINVAL; +diff --git a/arch/x86/um/tls_64.c b/arch/x86/um/tls_64.c +index 3a621e0d3925..ebd3855d9b13 100644 +--- a/arch/x86/um/tls_64.c ++++ b/arch/x86/um/tls_64.c +@@ -6,14 +6,13 @@ void clear_flushed_tls(struct task_struct *task) + { + } + +-int arch_copy_tls(struct task_struct *t) ++int arch_set_tls(struct task_struct *t, unsigned long tls) + { + /* + * If CLONE_SETTLS is set, we need to save the thread id +- * (which is argument 5, child_tid, of clone) so it can be set +- * during context switches. ++ * so it can be set during context switches. + */ +- t->thread.arch.fs = t->thread.regs.regs.gp[R8 / sizeof(long)]; ++ t->thread.arch.fs = tls; + + return 0; + } +diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig +index a8e7beb6b7b5..8352037322df 100644 +--- a/arch/xtensa/Kconfig ++++ b/arch/xtensa/Kconfig +@@ -22,6 +22,7 @@ config XTENSA + select HAVE_ARCH_JUMP_LABEL + select HAVE_ARCH_KASAN if MMU + select HAVE_ARCH_TRACEHOOK ++ select HAVE_COPY_THREAD_TLS + select HAVE_DEBUG_KMEMLEAK + select HAVE_DMA_CONTIGUOUS + select HAVE_EXIT_THREAD +diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c +index db278a9e80c7..7cbf8bd6d922 100644 +--- a/arch/xtensa/kernel/process.c ++++ b/arch/xtensa/kernel/process.c +@@ -202,8 +202,9 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) + * involved. Much simpler to just not copy those live frames across. + */ + +-int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn, +- unsigned long thread_fn_arg, struct task_struct *p) ++int copy_thread_tls(unsigned long clone_flags, unsigned long usp_thread_fn, ++ unsigned long thread_fn_arg, struct task_struct *p, ++ unsigned long tls) + { + struct pt_regs *childregs = task_pt_regs(p); + +@@ -264,9 +265,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn, + ®s->areg[XCHAL_NUM_AREGS - len/4], len); + } + +- /* The thread pointer is passed in the '4th argument' (= a5) */ + if (clone_flags & CLONE_SETTLS) +- childregs->threadptr = childregs->areg[5]; ++ childregs->threadptr = tls; + } else { + p->thread.ra = MAKE_RA_FOR_CALL( + (unsigned long)ret_from_kernel_thread, 1); +diff --git a/drivers/char/tpm/tpm-dev-common.c b/drivers/char/tpm/tpm-dev-common.c +index b23b0b999232..87f449340202 100644 +--- a/drivers/char/tpm/tpm-dev-common.c ++++ b/drivers/char/tpm/tpm-dev-common.c +@@ -130,7 +130,7 @@ ssize_t tpm_common_read(struct file *file, char __user *buf, + priv->response_read = true; + + ret_size = min_t(ssize_t, size, priv->response_length); +- if (!ret_size) { ++ if (ret_size <= 0) { + priv->response_length = 0; + goto out; + } +diff --git a/drivers/char/tpm/tpm-dev.h b/drivers/char/tpm/tpm-dev.h +index 1089fc0bb290..f3742bcc73e3 100644 +--- a/drivers/char/tpm/tpm-dev.h ++++ b/drivers/char/tpm/tpm-dev.h +@@ -14,7 +14,7 @@ struct file_priv { + struct work_struct timeout_work; + struct work_struct async_work; + wait_queue_head_t async_wait; +- size_t response_length; ++ ssize_t response_length; + bool response_read; + bool command_enqueued; + +diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c +index f528fc39ea6b..c3181ea9f271 100644 +--- a/drivers/char/tpm/tpm_tis_core.c ++++ b/drivers/char/tpm/tpm_tis_core.c +@@ -899,13 +899,13 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, + + if (wait_startup(chip, 0) != 0) { + rc = -ENODEV; +- goto err_start; ++ goto out_err; + } + + /* Take control of the TPM's interrupt hardware and shut it off */ + rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask); + if (rc < 0) +- goto err_start; ++ goto out_err; + + intmask |= TPM_INTF_CMD_READY_INT | TPM_INTF_LOCALITY_CHANGE_INT | + TPM_INTF_DATA_AVAIL_INT | TPM_INTF_STS_VALID_INT; +@@ -914,21 +914,21 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, + + rc = tpm_chip_start(chip); + if (rc) +- goto err_start; +- ++ goto out_err; + rc = tpm2_probe(chip); ++ tpm_chip_stop(chip); + if (rc) +- goto err_probe; ++ goto out_err; + + rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor); + if (rc < 0) +- goto err_probe; ++ goto out_err; + + priv->manufacturer_id = vendor; + + rc = tpm_tis_read8(priv, TPM_RID(0), &rid); + if (rc < 0) +- goto err_probe; ++ goto out_err; + + dev_info(dev, "%s TPM (device-id 0x%X, rev-id %d)\n", + (chip->flags & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2", +@@ -937,13 +937,13 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, + probe = probe_itpm(chip); + if (probe < 0) { + rc = -ENODEV; +- goto err_probe; ++ goto out_err; + } + + /* Figure out the capabilities */ + rc = tpm_tis_read32(priv, TPM_INTF_CAPS(priv->locality), &intfcaps); + if (rc < 0) +- goto err_probe; ++ goto out_err; + + dev_dbg(dev, "TPM interface capabilities (0x%x):\n", + intfcaps); +@@ -977,10 +977,9 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, + if (tpm_get_timeouts(chip)) { + dev_err(dev, "Could not get TPM timeouts and durations\n"); + rc = -ENODEV; +- goto err_probe; ++ goto out_err; + } + +- chip->flags |= TPM_CHIP_FLAG_IRQ; + if (irq) { + tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED, + irq); +@@ -992,18 +991,15 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, + } + } + +- tpm_chip_stop(chip); +- + rc = tpm_chip_register(chip); + if (rc) +- goto err_start; +- +- return 0; ++ goto out_err; + +-err_probe: +- tpm_chip_stop(chip); ++ if (chip->ops->clk_enable != NULL) ++ chip->ops->clk_enable(chip, false); + +-err_start: ++ return 0; ++out_err: + if ((chip->ops != NULL) && (chip->ops->clk_enable != NULL)) + chip->ops->clk_enable(chip, false); + +diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c +index 59ccfd24627d..1f98e988c0d3 100644 +--- a/drivers/gpio/gpiolib-acpi.c ++++ b/drivers/gpio/gpiolib-acpi.c +@@ -21,11 +21,19 @@ + #include "gpiolib.h" + #include "gpiolib-acpi.h" + ++#define QUIRK_NO_EDGE_EVENTS_ON_BOOT 0x01l ++#define QUIRK_NO_WAKEUP 0x02l ++ + static int run_edge_events_on_boot = -1; + module_param(run_edge_events_on_boot, int, 0444); + MODULE_PARM_DESC(run_edge_events_on_boot, + "Run edge _AEI event-handlers at boot: 0=no, 1=yes, -1=auto"); + ++static int honor_wakeup = -1; ++module_param(honor_wakeup, int, 0444); ++MODULE_PARM_DESC(honor_wakeup, ++ "Honor the ACPI wake-capable flag: 0=no, 1=yes, -1=auto"); ++ + /** + * struct acpi_gpio_event - ACPI GPIO event handler data + * +@@ -274,7 +282,7 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares, + event->handle = evt_handle; + event->handler = handler; + event->irq = irq; +- event->irq_is_wake = agpio->wake_capable == ACPI_WAKE_CAPABLE; ++ event->irq_is_wake = honor_wakeup && agpio->wake_capable == ACPI_WAKE_CAPABLE; + event->pin = pin; + event->desc = desc; + +@@ -1302,7 +1310,7 @@ static int acpi_gpio_handle_deferred_request_irqs(void) + /* We must use _sync so that this runs after the first deferred_probe run */ + late_initcall_sync(acpi_gpio_handle_deferred_request_irqs); + +-static const struct dmi_system_id run_edge_events_on_boot_blacklist[] = { ++static const struct dmi_system_id gpiolib_acpi_quirks[] = { + { + /* + * The Minix Neo Z83-4 has a micro-USB-B id-pin handler for +@@ -1312,7 +1320,8 @@ static const struct dmi_system_id run_edge_events_on_boot_blacklist[] = { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "MINIX"), + DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"), +- } ++ }, ++ .driver_data = (void *)QUIRK_NO_EDGE_EVENTS_ON_BOOT, + }, + { + /* +@@ -1324,20 +1333,52 @@ static const struct dmi_system_id run_edge_events_on_boot_blacklist[] = { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Wortmann_AG"), + DMI_MATCH(DMI_PRODUCT_NAME, "TERRA_PAD_1061"), +- } ++ }, ++ .driver_data = (void *)QUIRK_NO_EDGE_EVENTS_ON_BOOT, ++ }, ++ { ++ /* ++ * Various HP X2 10 Cherry Trail models use an external ++ * embedded-controller connected via I2C + an ACPI GPIO ++ * event handler. The embedded controller generates various ++ * spurious wakeup events when suspended. So disable wakeup ++ * for its handler (it uses the only ACPI GPIO event handler). ++ * This breaks wakeup when opening the lid, the user needs ++ * to press the power-button to wakeup the system. The ++ * alternative is suspend simply not working, which is worse. ++ */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "HP"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "HP x2 Detachable 10-p0XX"), ++ }, ++ .driver_data = (void *)QUIRK_NO_WAKEUP, + }, + {} /* Terminating entry */ + }; + + static int acpi_gpio_setup_params(void) + { ++ const struct dmi_system_id *id; ++ long quirks = 0; ++ ++ id = dmi_first_match(gpiolib_acpi_quirks); ++ if (id) ++ quirks = (long)id->driver_data; ++ + if (run_edge_events_on_boot < 0) { +- if (dmi_check_system(run_edge_events_on_boot_blacklist)) ++ if (quirks & QUIRK_NO_EDGE_EVENTS_ON_BOOT) + run_edge_events_on_boot = 0; + else + run_edge_events_on_boot = 1; + } + ++ if (honor_wakeup < 0) { ++ if (quirks & QUIRK_NO_WAKEUP) ++ honor_wakeup = 0; ++ else ++ honor_wakeup = 1; ++ } ++ + return 0; + } + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +index b19157b19fa0..33a1099e2f33 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +@@ -145,7 +145,7 @@ int amdgpu_async_gfx_ring = 1; + int amdgpu_mcbp = 0; + int amdgpu_discovery = -1; + int amdgpu_mes = 0; +-int amdgpu_noretry = 1; ++int amdgpu_noretry; + + struct amdgpu_mgpu_info mgpu_info = { + .mutex = __MUTEX_INITIALIZER(mgpu_info.mutex), +@@ -613,7 +613,7 @@ MODULE_PARM_DESC(mes, + module_param_named(mes, amdgpu_mes, int, 0444); + + MODULE_PARM_DESC(noretry, +- "Disable retry faults (0 = retry enabled, 1 = retry disabled (default))"); ++ "Disable retry faults (0 = retry enabled (default), 1 = retry disabled)"); + module_param_named(noretry, amdgpu_noretry, int, 0644); + + #ifdef CONFIG_HSA_AMD +diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c +index 86c17896b532..a48a4c21b1b3 100644 +--- a/drivers/gpu/drm/drm_dp_mst_topology.c ++++ b/drivers/gpu/drm/drm_dp_mst_topology.c +@@ -339,7 +339,7 @@ static void drm_dp_encode_sideband_req(struct drm_dp_sideband_msg_req_body *req, + memcpy(&buf[idx], req->u.i2c_read.transactions[i].bytes, req->u.i2c_read.transactions[i].num_bytes); + idx += req->u.i2c_read.transactions[i].num_bytes; + +- buf[idx] = (req->u.i2c_read.transactions[i].no_stop_bit & 0x1) << 5; ++ buf[idx] = (req->u.i2c_read.transactions[i].no_stop_bit & 0x1) << 4; + buf[idx] |= (req->u.i2c_read.transactions[i].i2c_transaction_delay & 0xf); + idx++; + } +diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c +index a7ba5b4902d6..8d193a58363d 100644 +--- a/drivers/gpu/drm/drm_fb_helper.c ++++ b/drivers/gpu/drm/drm_fb_helper.c +@@ -1320,7 +1320,7 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, + * Changes struct fb_var_screeninfo are currently not pushed back + * to KMS, hence fail if different settings are requested. + */ +- if (var->bits_per_pixel != fb->format->cpp[0] * 8 || ++ if (var->bits_per_pixel > fb->format->cpp[0] * 8 || + var->xres > fb->width || var->yres > fb->height || + var->xres_virtual > fb->width || var->yres_virtual > fb->height) { + DRM_DEBUG("fb requested width/height/bpp can't fit in current fb " +@@ -1345,6 +1345,11 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, + drm_fb_helper_fill_pixel_fmt(var, fb->format->depth); + } + ++ /* ++ * Likewise, bits_per_pixel should be rounded up to a supported value. ++ */ ++ var->bits_per_pixel = fb->format->cpp[0] * 8; ++ + /* + * drm fbdev emulation doesn't support changing the pixel format at all, + * so reject all pixel format changing requests. +diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c +index d564bfcab6a3..4949b5ad860f 100644 +--- a/drivers/gpu/drm/i915/gt/intel_lrc.c ++++ b/drivers/gpu/drm/i915/gt/intel_lrc.c +@@ -2132,6 +2132,14 @@ static u32 *gen9_init_indirectctx_bb(struct intel_engine_cs *engine, u32 *batch) + /* WaFlushCoherentL3CacheLinesAtContextSwitch:skl,bxt,glk */ + batch = gen8_emit_flush_coherentl3_wa(engine, batch); + ++ /* WaClearSlmSpaceAtContextSwitch:skl,bxt,kbl,glk,cfl */ ++ batch = gen8_emit_pipe_control(batch, ++ PIPE_CONTROL_FLUSH_L3 | ++ PIPE_CONTROL_GLOBAL_GTT_IVB | ++ PIPE_CONTROL_CS_STALL | ++ PIPE_CONTROL_QW_WRITE, ++ slm_offset(engine)); ++ + batch = emit_lri(batch, lri, ARRAY_SIZE(lri)); + + /* WaMediaPoolStateCmdInWABB:bxt,glk */ +@@ -3716,9 +3724,11 @@ intel_execlists_create_virtual(struct i915_gem_context *ctx, + ve->base.i915 = ctx->i915; + ve->base.gt = siblings[0]->gt; + ve->base.id = -1; ++ + ve->base.class = OTHER_CLASS; + ve->base.uabi_class = I915_ENGINE_CLASS_INVALID; + ve->base.instance = I915_ENGINE_CLASS_INVALID_VIRTUAL; ++ ve->base.uabi_instance = I915_ENGINE_CLASS_INVALID_VIRTUAL; + + /* + * The decision on whether to submit a request using semaphores +diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h +index f8ee9aba3955..7b6e68f082f8 100644 +--- a/drivers/gpu/drm/i915/i915_reg.h ++++ b/drivers/gpu/drm/i915/i915_reg.h +@@ -4049,7 +4049,13 @@ enum { + #define GWUNIT_CLKGATE_DIS (1 << 16) + + #define UNSLICE_UNIT_LEVEL_CLKGATE _MMIO(0x9434) +-#define VFUNIT_CLKGATE_DIS (1 << 20) ++#define VFUNIT_CLKGATE_DIS REG_BIT(20) ++#define HSUNIT_CLKGATE_DIS REG_BIT(8) ++#define VSUNIT_CLKGATE_DIS REG_BIT(3) ++ ++#define UNSLICE_UNIT_LEVEL_CLKGATE2 _MMIO(0x94e4) ++#define VSUNIT_CLKGATE_DIS_TGL REG_BIT(19) ++#define PSDUNIT_CLKGATE_DIS REG_BIT(5) + + #define INF_UNIT_LEVEL_CLKGATE _MMIO(0x9560) + #define CGPSF_CLKGATE_DIS (1 << 3) +diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c +index 2efe1d12d5a9..3ccfc025fde2 100644 +--- a/drivers/gpu/drm/i915/intel_pm.c ++++ b/drivers/gpu/drm/i915/intel_pm.c +@@ -9194,6 +9194,17 @@ static void icl_init_clock_gating(struct drm_i915_private *dev_priv) + /* WaEnable32PlaneMode:icl */ + I915_WRITE(GEN9_CSFE_CHICKEN1_RCS, + _MASKED_BIT_ENABLE(GEN11_ENABLE_32_PLANE_MODE)); ++ ++ /* ++ * Wa_1408615072:icl,ehl (vsunit) ++ * Wa_1407596294:icl,ehl (hsunit) ++ */ ++ intel_uncore_rmw(&dev_priv->uncore, UNSLICE_UNIT_LEVEL_CLKGATE, ++ 0, VSUNIT_CLKGATE_DIS | HSUNIT_CLKGATE_DIS); ++ ++ /* Wa_1407352427:icl,ehl */ ++ intel_uncore_rmw(&dev_priv->uncore, UNSLICE_UNIT_LEVEL_CLKGATE2, ++ 0, PSDUNIT_CLKGATE_DIS); + } + + static void cnp_init_clock_gating(struct drm_i915_private *dev_priv) +diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c +index b89439ed210d..27c80c9e2b83 100644 +--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c ++++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c +@@ -488,7 +488,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, + + WARN_ON(!tcon->quirks->has_channel_0); + +- tcon->dclk_min_div = 1; ++ tcon->dclk_min_div = tcon->quirks->dclk_min_div; + tcon->dclk_max_div = 127; + sun4i_tcon0_mode_set_common(tcon, mode); + +@@ -1425,12 +1425,14 @@ static int sun8i_r40_tcon_tv_set_mux(struct sun4i_tcon *tcon, + static const struct sun4i_tcon_quirks sun4i_a10_quirks = { + .has_channel_0 = true, + .has_channel_1 = true, ++ .dclk_min_div = 4, + .set_mux = sun4i_a10_tcon_set_mux, + }; + + static const struct sun4i_tcon_quirks sun5i_a13_quirks = { + .has_channel_0 = true, + .has_channel_1 = true, ++ .dclk_min_div = 4, + .set_mux = sun5i_a13_tcon_set_mux, + }; + +@@ -1439,6 +1441,7 @@ static const struct sun4i_tcon_quirks sun6i_a31_quirks = { + .has_channel_1 = true, + .has_lvds_alt = true, + .needs_de_be_mux = true, ++ .dclk_min_div = 1, + .set_mux = sun6i_tcon_set_mux, + }; + +@@ -1446,11 +1449,13 @@ static const struct sun4i_tcon_quirks sun6i_a31s_quirks = { + .has_channel_0 = true, + .has_channel_1 = true, + .needs_de_be_mux = true, ++ .dclk_min_div = 1, + }; + + static const struct sun4i_tcon_quirks sun7i_a20_quirks = { + .has_channel_0 = true, + .has_channel_1 = true, ++ .dclk_min_div = 4, + /* Same display pipeline structure as A10 */ + .set_mux = sun4i_a10_tcon_set_mux, + }; +@@ -1458,11 +1463,13 @@ static const struct sun4i_tcon_quirks sun7i_a20_quirks = { + static const struct sun4i_tcon_quirks sun8i_a33_quirks = { + .has_channel_0 = true, + .has_lvds_alt = true, ++ .dclk_min_div = 1, + }; + + static const struct sun4i_tcon_quirks sun8i_a83t_lcd_quirks = { + .supports_lvds = true, + .has_channel_0 = true, ++ .dclk_min_div = 1, + }; + + static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = { +@@ -1476,11 +1483,13 @@ static const struct sun4i_tcon_quirks sun8i_r40_tv_quirks = { + + static const struct sun4i_tcon_quirks sun8i_v3s_quirks = { + .has_channel_0 = true, ++ .dclk_min_div = 1, + }; + + static const struct sun4i_tcon_quirks sun9i_a80_tcon_lcd_quirks = { +- .has_channel_0 = true, +- .needs_edp_reset = true, ++ .has_channel_0 = true, ++ .needs_edp_reset = true, ++ .dclk_min_div = 1, + }; + + static const struct sun4i_tcon_quirks sun9i_a80_tcon_tv_quirks = { +diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h +index f9f1fe80b206..a62ec826ae71 100644 +--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h ++++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h +@@ -224,6 +224,7 @@ struct sun4i_tcon_quirks { + bool needs_de_be_mux; /* sun6i needs mux to select backend */ + bool needs_edp_reset; /* a80 edp reset needed for tcon0 access */ + bool supports_lvds; /* Does the TCON support an LVDS output? */ ++ u8 dclk_min_div; /* minimum divider for TCON0 DCLK */ + + /* callback to handle tcon muxing options */ + int (*set_mux)(struct sun4i_tcon *, const struct drm_encoder *); +diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c +index e0b241bd3070..851fe54ea59e 100644 +--- a/drivers/hid/hid-core.c ++++ b/drivers/hid/hid-core.c +@@ -288,6 +288,12 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign + offset = report->size; + report->size += parser->global.report_size * parser->global.report_count; + ++ /* Total size check: Allow for possible report index byte */ ++ if (report->size > (HID_MAX_BUFFER_SIZE - 1) << 3) { ++ hid_err(parser->device, "report is too long\n"); ++ return -1; ++ } ++ + if (!parser->local.usage_index) /* Ignore padding fields */ + return 0; + +diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c +index 63855f275a38..dea9cc65bf80 100644 +--- a/drivers/hid/hid-input.c ++++ b/drivers/hid/hid-input.c +@@ -1132,9 +1132,15 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel + } + + mapped: +- if (device->driver->input_mapped && device->driver->input_mapped(device, +- hidinput, field, usage, &bit, &max) < 0) +- goto ignore; ++ if (device->driver->input_mapped && ++ device->driver->input_mapped(device, hidinput, field, usage, ++ &bit, &max) < 0) { ++ /* ++ * The driver indicated that no further generic handling ++ * of the usage is desired. ++ */ ++ return; ++ } + + set_bit(usage->type, input->evbit); + +@@ -1215,9 +1221,11 @@ mapped: + set_bit(MSC_SCAN, input->mscbit); + } + +-ignore: + return; + ++ignore: ++ usage->type = 0; ++ usage->code = 0; + } + + static void hidinput_handle_scroll(struct hid_usage *usage, +diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c +index bbc6ec1aa5cb..c25e95c19cad 100644 +--- a/drivers/hid/hidraw.c ++++ b/drivers/hid/hidraw.c +@@ -252,10 +252,10 @@ static __poll_t hidraw_poll(struct file *file, poll_table *wait) + + poll_wait(file, &list->hidraw->wait, wait); + if (list->head != list->tail) +- return EPOLLIN | EPOLLRDNORM | EPOLLOUT; ++ return EPOLLIN | EPOLLRDNORM; + if (!list->hidraw->exist) + return EPOLLERR | EPOLLHUP; +- return 0; ++ return EPOLLOUT | EPOLLWRNORM; + } + + static int hidraw_open(struct inode *inode, struct file *file) +diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c +index fa0cc0899827..935c3d0a3b63 100644 +--- a/drivers/hid/uhid.c ++++ b/drivers/hid/uhid.c +@@ -772,7 +772,7 @@ static __poll_t uhid_char_poll(struct file *file, poll_table *wait) + if (uhid->head != uhid->tail) + return EPOLLIN | EPOLLRDNORM; + +- return 0; ++ return EPOLLOUT | EPOLLWRNORM; + } + + static const struct file_operations uhid_fops = { +diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c +index 1f9bc4483465..c879b214a479 100644 +--- a/drivers/hid/usbhid/hiddev.c ++++ b/drivers/hid/usbhid/hiddev.c +@@ -241,12 +241,51 @@ static int hiddev_release(struct inode * inode, struct file * file) + return 0; + } + ++static int __hiddev_open(struct hiddev *hiddev, struct file *file) ++{ ++ struct hiddev_list *list; ++ int error; ++ ++ lockdep_assert_held(&hiddev->existancelock); ++ ++ list = vzalloc(sizeof(*list)); ++ if (!list) ++ return -ENOMEM; ++ ++ mutex_init(&list->thread_lock); ++ list->hiddev = hiddev; ++ ++ if (!hiddev->open++) { ++ error = hid_hw_power(hiddev->hid, PM_HINT_FULLON); ++ if (error < 0) ++ goto err_drop_count; ++ ++ error = hid_hw_open(hiddev->hid); ++ if (error < 0) ++ goto err_normal_power; ++ } ++ ++ spin_lock_irq(&hiddev->list_lock); ++ list_add_tail(&list->node, &hiddev->list); ++ spin_unlock_irq(&hiddev->list_lock); ++ ++ file->private_data = list; ++ ++ return 0; ++ ++err_normal_power: ++ hid_hw_power(hiddev->hid, PM_HINT_NORMAL); ++err_drop_count: ++ hiddev->open--; ++ vfree(list); ++ return error; ++} ++ + /* + * open file op + */ + static int hiddev_open(struct inode *inode, struct file *file) + { +- struct hiddev_list *list; + struct usb_interface *intf; + struct hid_device *hid; + struct hiddev *hiddev; +@@ -255,66 +294,14 @@ static int hiddev_open(struct inode *inode, struct file *file) + intf = usbhid_find_interface(iminor(inode)); + if (!intf) + return -ENODEV; ++ + hid = usb_get_intfdata(intf); + hiddev = hid->hiddev; + +- if (!(list = vzalloc(sizeof(struct hiddev_list)))) +- return -ENOMEM; +- mutex_init(&list->thread_lock); +- list->hiddev = hiddev; +- file->private_data = list; +- +- /* +- * no need for locking because the USB major number +- * is shared which usbcore guards against disconnect +- */ +- if (list->hiddev->exist) { +- if (!list->hiddev->open++) { +- res = hid_hw_open(hiddev->hid); +- if (res < 0) +- goto bail; +- } +- } else { +- res = -ENODEV; +- goto bail; +- } +- +- spin_lock_irq(&list->hiddev->list_lock); +- list_add_tail(&list->node, &hiddev->list); +- spin_unlock_irq(&list->hiddev->list_lock); +- + mutex_lock(&hiddev->existancelock); +- /* +- * recheck exist with existance lock held to +- * avoid opening a disconnected device +- */ +- if (!list->hiddev->exist) { +- res = -ENODEV; +- goto bail_unlock; +- } +- if (!list->hiddev->open++) +- if (list->hiddev->exist) { +- struct hid_device *hid = hiddev->hid; +- res = hid_hw_power(hid, PM_HINT_FULLON); +- if (res < 0) +- goto bail_unlock; +- res = hid_hw_open(hid); +- if (res < 0) +- goto bail_normal_power; +- } +- mutex_unlock(&hiddev->existancelock); +- return 0; +-bail_normal_power: +- hid_hw_power(hid, PM_HINT_NORMAL); +-bail_unlock: ++ res = hiddev->exist ? __hiddev_open(hiddev, file) : -ENODEV; + mutex_unlock(&hiddev->existancelock); + +- spin_lock_irq(&list->hiddev->list_lock); +- list_del(&list->node); +- spin_unlock_irq(&list->hiddev->list_lock); +-bail: +- file->private_data = NULL; +- vfree(list); + return res; + } + +diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c +index 5f6a4985f2bc..810a942eaa8e 100644 +--- a/drivers/i2c/i2c-core-base.c ++++ b/drivers/i2c/i2c-core-base.c +@@ -186,10 +186,11 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap) + * If we can set SDA, we will always create a STOP to ensure additional + * pulses will do no harm. This is achieved by letting SDA follow SCL + * half a cycle later. Check the 'incomplete_write_byte' fault injector +- * for details. ++ * for details. Note that we must honour tsu:sto, 4us, but lets use 5us ++ * here for simplicity. + */ + bri->set_scl(adap, scl); +- ndelay(RECOVERY_NDELAY / 2); ++ ndelay(RECOVERY_NDELAY); + if (bri->set_sda) + bri->set_sda(adap, scl); + ndelay(RECOVERY_NDELAY / 2); +@@ -211,7 +212,13 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap) + scl = !scl; + bri->set_scl(adap, scl); + /* Creating STOP again, see above */ +- ndelay(RECOVERY_NDELAY / 2); ++ if (scl) { ++ /* Honour minimum tsu:sto */ ++ ndelay(RECOVERY_NDELAY); ++ } else { ++ /* Honour minimum tf and thd:dat */ ++ ndelay(RECOVERY_NDELAY / 2); ++ } + if (bri->set_sda) + bri->set_sda(adap, scl); + ndelay(RECOVERY_NDELAY / 2); +diff --git a/drivers/infiniband/hw/hfi1/tid_rdma.c b/drivers/infiniband/hw/hfi1/tid_rdma.c +index e53f542b60af..8a2e0d9351e9 100644 +--- a/drivers/infiniband/hw/hfi1/tid_rdma.c ++++ b/drivers/infiniband/hw/hfi1/tid_rdma.c +@@ -4633,6 +4633,15 @@ void hfi1_rc_rcv_tid_rdma_ack(struct hfi1_packet *packet) + */ + fpsn = full_flow_psn(flow, flow->flow_state.spsn); + req->r_ack_psn = psn; ++ /* ++ * If resync_psn points to the last flow PSN for a ++ * segment and the new segment (likely from a new ++ * request) starts with a new generation number, we ++ * need to adjust resync_psn accordingly. ++ */ ++ if (flow->flow_state.generation != ++ (resync_psn >> HFI1_KDETH_BTH_SEQ_SHIFT)) ++ resync_psn = mask_psn(fpsn - 1); + flow->resync_npkts += + delta_psn(mask_psn(resync_psn + 1), fpsn); + /* +diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c +index d7dd6fcf2db0..f918fca9ada3 100644 +--- a/drivers/input/evdev.c ++++ b/drivers/input/evdev.c +@@ -224,13 +224,13 @@ static void __pass_event(struct evdev_client *client, + */ + client->tail = (client->head - 2) & (client->bufsize - 1); + +- client->buffer[client->tail].input_event_sec = +- event->input_event_sec; +- client->buffer[client->tail].input_event_usec = +- event->input_event_usec; +- client->buffer[client->tail].type = EV_SYN; +- client->buffer[client->tail].code = SYN_DROPPED; +- client->buffer[client->tail].value = 0; ++ client->buffer[client->tail] = (struct input_event) { ++ .input_event_sec = event->input_event_sec, ++ .input_event_usec = event->input_event_usec, ++ .type = EV_SYN, ++ .code = SYN_DROPPED, ++ .value = 0, ++ }; + + client->packet_head = client->tail; + } +diff --git a/drivers/input/input.c b/drivers/input/input.c +index 55086279d044..ee6c3234df36 100644 +--- a/drivers/input/input.c ++++ b/drivers/input/input.c +@@ -878,16 +878,18 @@ static int input_default_setkeycode(struct input_dev *dev, + } + } + +- __clear_bit(*old_keycode, dev->keybit); +- __set_bit(ke->keycode, dev->keybit); +- +- for (i = 0; i < dev->keycodemax; i++) { +- if (input_fetch_keycode(dev, i) == *old_keycode) { +- __set_bit(*old_keycode, dev->keybit); +- break; /* Setting the bit twice is useless, so break */ ++ if (*old_keycode <= KEY_MAX) { ++ __clear_bit(*old_keycode, dev->keybit); ++ for (i = 0; i < dev->keycodemax; i++) { ++ if (input_fetch_keycode(dev, i) == *old_keycode) { ++ __set_bit(*old_keycode, dev->keybit); ++ /* Setting the bit twice is useless, so break */ ++ break; ++ } + } + } + ++ __set_bit(ke->keycode, dev->keybit); + return 0; + } + +@@ -943,9 +945,13 @@ int input_set_keycode(struct input_dev *dev, + * Simulate keyup event if keycode is not present + * in the keymap anymore + */ +- if (test_bit(EV_KEY, dev->evbit) && +- !is_event_supported(old_keycode, dev->keybit, KEY_MAX) && +- __test_and_clear_bit(old_keycode, dev->key)) { ++ if (old_keycode > KEY_MAX) { ++ dev_warn(dev->dev.parent ?: &dev->dev, ++ "%s: got too big old keycode %#x\n", ++ __func__, old_keycode); ++ } else if (test_bit(EV_KEY, dev->evbit) && ++ !is_event_supported(old_keycode, dev->keybit, KEY_MAX) && ++ __test_and_clear_bit(old_keycode, dev->key)) { + struct input_value vals[] = { + { EV_KEY, old_keycode, 0 }, + input_value_sync +diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c +index 84051f20b18a..002654ec7040 100644 +--- a/drivers/input/misc/uinput.c ++++ b/drivers/input/misc/uinput.c +@@ -74,12 +74,16 @@ static int uinput_dev_event(struct input_dev *dev, + struct uinput_device *udev = input_get_drvdata(dev); + struct timespec64 ts; + +- udev->buff[udev->head].type = type; +- udev->buff[udev->head].code = code; +- udev->buff[udev->head].value = value; + ktime_get_ts64(&ts); +- udev->buff[udev->head].input_event_sec = ts.tv_sec; +- udev->buff[udev->head].input_event_usec = ts.tv_nsec / NSEC_PER_USEC; ++ ++ udev->buff[udev->head] = (struct input_event) { ++ .input_event_sec = ts.tv_sec, ++ .input_event_usec = ts.tv_nsec / NSEC_PER_USEC, ++ .type = type, ++ .code = code, ++ .value = value, ++ }; ++ + udev->head = (udev->head + 1) % UINPUT_BUFFER_SIZE; + + wake_up_interruptible(&udev->waitq); +diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c +index 4ce797d4259f..67aa317de6db 100644 +--- a/drivers/iommu/intel-iommu.c ++++ b/drivers/iommu/intel-iommu.c +@@ -5786,6 +5786,13 @@ static void intel_iommu_apply_resv_region(struct device *dev, + WARN_ON_ONCE(!reserve_iova(&dmar_domain->iovad, start, end)); + } + ++static struct iommu_group *intel_iommu_device_group(struct device *dev) ++{ ++ if (dev_is_pci(dev)) ++ return pci_device_group(dev); ++ return generic_device_group(dev); ++} ++ + #ifdef CONFIG_INTEL_IOMMU_SVM + struct intel_iommu *intel_svm_device_to_iommu(struct device *dev) + { +@@ -5958,7 +5965,7 @@ const struct iommu_ops intel_iommu_ops = { + .get_resv_regions = intel_iommu_get_resv_regions, + .put_resv_regions = intel_iommu_put_resv_regions, + .apply_resv_region = intel_iommu_apply_resv_region, +- .device_group = pci_device_group, ++ .device_group = intel_iommu_device_group, + .dev_has_feat = intel_iommu_dev_has_feat, + .dev_feat_enabled = intel_iommu_dev_feat_enabled, + .dev_enable_feat = intel_iommu_dev_enable_feat, +diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c +index d5d4bfa9c8fd..d797912e665a 100644 +--- a/drivers/net/can/m_can/tcan4x5x.c ++++ b/drivers/net/can/m_can/tcan4x5x.c +@@ -445,6 +445,10 @@ static int tcan4x5x_can_probe(struct spi_device *spi) + + tcan4x5x_power_enable(priv->power, 1); + ++ ret = tcan4x5x_init(mcan_class); ++ if (ret) ++ goto out_power; ++ + ret = m_can_class_register(mcan_class); + if (ret) + goto out_power; +diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c +index 8caf7af0dee2..99101d7027a8 100644 +--- a/drivers/net/can/mscan/mscan.c ++++ b/drivers/net/can/mscan/mscan.c +@@ -381,13 +381,12 @@ static int mscan_rx_poll(struct napi_struct *napi, int quota) + struct net_device *dev = napi->dev; + struct mscan_regs __iomem *regs = priv->reg_base; + struct net_device_stats *stats = &dev->stats; +- int npackets = 0; +- int ret = 1; ++ int work_done = 0; + struct sk_buff *skb; + struct can_frame *frame; + u8 canrflg; + +- while (npackets < quota) { ++ while (work_done < quota) { + canrflg = in_8(®s->canrflg); + if (!(canrflg & (MSCAN_RXF | MSCAN_ERR_IF))) + break; +@@ -408,18 +407,18 @@ static int mscan_rx_poll(struct napi_struct *napi, int quota) + + stats->rx_packets++; + stats->rx_bytes += frame->can_dlc; +- npackets++; ++ work_done++; + netif_receive_skb(skb); + } + +- if (!(in_8(®s->canrflg) & (MSCAN_RXF | MSCAN_ERR_IF))) { +- napi_complete(&priv->napi); +- clear_bit(F_RX_PROGRESS, &priv->flags); +- if (priv->can.state < CAN_STATE_BUS_OFF) +- out_8(®s->canrier, priv->shadow_canrier); +- ret = 0; ++ if (work_done < quota) { ++ if (likely(napi_complete_done(&priv->napi, work_done))) { ++ clear_bit(F_RX_PROGRESS, &priv->flags); ++ if (priv->can.state < CAN_STATE_BUS_OFF) ++ out_8(®s->canrier, priv->shadow_canrier); ++ } + } +- return ret; ++ return work_done; + } + + static irqreturn_t mscan_isr(int irq, void *dev_id) +diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c +index 2f74f6704c12..a4b4b742c80c 100644 +--- a/drivers/net/can/usb/gs_usb.c ++++ b/drivers/net/can/usb/gs_usb.c +@@ -918,7 +918,7 @@ static int gs_usb_probe(struct usb_interface *intf, + GS_USB_BREQ_HOST_FORMAT, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, + 1, +- intf->altsetting[0].desc.bInterfaceNumber, ++ intf->cur_altsetting->desc.bInterfaceNumber, + hconf, + sizeof(*hconf), + 1000); +@@ -941,7 +941,7 @@ static int gs_usb_probe(struct usb_interface *intf, + GS_USB_BREQ_DEVICE_CONFIG, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, + 1, +- intf->altsetting[0].desc.bInterfaceNumber, ++ intf->cur_altsetting->desc.bInterfaceNumber, + dconf, + sizeof(*dconf), + 1000); +diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +index 5fc0be564274..7ab87a758754 100644 +--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c ++++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +@@ -1590,7 +1590,7 @@ static int kvaser_usb_hydra_setup_endpoints(struct kvaser_usb *dev) + struct usb_endpoint_descriptor *ep; + int i; + +- iface_desc = &dev->intf->altsetting[0]; ++ iface_desc = dev->intf->cur_altsetting; + + for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { + ep = &iface_desc->endpoint[i].desc; +diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +index ae4c37e1bb75..1b9957f12459 100644 +--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c ++++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +@@ -1310,7 +1310,7 @@ static int kvaser_usb_leaf_setup_endpoints(struct kvaser_usb *dev) + struct usb_endpoint_descriptor *endpoint; + int i; + +- iface_desc = &dev->intf->altsetting[0]; ++ iface_desc = dev->intf->cur_altsetting; + + for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { + endpoint = &iface_desc->endpoint[i].desc; +diff --git a/drivers/net/wireless/ath/ath10k/usb.c b/drivers/net/wireless/ath/ath10k/usb.c +index 9ebe74ee4aef..1e0343081be9 100644 +--- a/drivers/net/wireless/ath/ath10k/usb.c ++++ b/drivers/net/wireless/ath/ath10k/usb.c +@@ -443,6 +443,7 @@ static int ath10k_usb_hif_tx_sg(struct ath10k *ar, u8 pipe_id, + ath10k_dbg(ar, ATH10K_DBG_USB_BULK, + "usb bulk transmit failed: %d\n", ret); + usb_unanchor_urb(urb); ++ usb_free_urb(urb); + ret = -EINVAL; + goto err_free_urb_to_pipe; + } +diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c +index 096334e941a1..fc1706d0647d 100644 +--- a/drivers/net/wireless/marvell/mwifiex/pcie.c ++++ b/drivers/net/wireless/marvell/mwifiex/pcie.c +@@ -1032,8 +1032,10 @@ static int mwifiex_pcie_alloc_cmdrsp_buf(struct mwifiex_adapter *adapter) + } + skb_put(skb, MWIFIEX_UPLD_SIZE); + if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, +- PCI_DMA_FROMDEVICE)) ++ PCI_DMA_FROMDEVICE)) { ++ kfree_skb(skb); + return -1; ++ } + + card->cmdrsp_buf = skb; + +diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +index 74e50566db1f..6dd835f1efc2 100644 +--- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c ++++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +@@ -229,6 +229,14 @@ static int mwifiex_process_country_ie(struct mwifiex_private *priv, + "11D: skip setting domain info in FW\n"); + return 0; + } ++ ++ if (country_ie_len > ++ (IEEE80211_COUNTRY_STRING_LEN + MWIFIEX_MAX_TRIPLET_802_11D)) { ++ mwifiex_dbg(priv->adapter, ERROR, ++ "11D: country_ie_len overflow!, deauth AP\n"); ++ return -EINVAL; ++ } ++ + memcpy(priv->adapter->country_code, &country_ie[2], 2); + + domain_info->country_code[0] = country_ie[2]; +@@ -272,8 +280,9 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, + priv->scan_block = false; + + if (bss) { +- if (adapter->region_code == 0x00) +- mwifiex_process_country_ie(priv, bss); ++ if (adapter->region_code == 0x00 && ++ mwifiex_process_country_ie(priv, bss)) ++ return -EINVAL; + + /* Allocate and fill new bss descriptor */ + bss_desc = kzalloc(sizeof(struct mwifiex_bssdescriptor), +diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +index 361248e97568..e7d96ac673b7 100644 +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -5447,6 +5447,7 @@ static int rtl8xxxu_submit_int_urb(struct ieee80211_hw *hw) + ret = usb_submit_urb(urb, GFP_KERNEL); + if (ret) { + usb_unanchor_urb(urb); ++ usb_free_urb(urb); + goto error; + } + +diff --git a/drivers/phy/motorola/phy-cpcap-usb.c b/drivers/phy/motorola/phy-cpcap-usb.c +index ead06c6c2601..9a38741d3546 100644 +--- a/drivers/phy/motorola/phy-cpcap-usb.c ++++ b/drivers/phy/motorola/phy-cpcap-usb.c +@@ -207,6 +207,19 @@ static int cpcap_phy_get_ints_state(struct cpcap_phy_ddata *ddata, + static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata); + static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata); + ++static void cpcap_usb_try_musb_mailbox(struct cpcap_phy_ddata *ddata, ++ enum musb_vbus_id_status status) ++{ ++ int error; ++ ++ error = musb_mailbox(status); ++ if (!error) ++ return; ++ ++ dev_dbg(ddata->dev, "%s: musb_mailbox failed: %i\n", ++ __func__, error); ++} ++ + static void cpcap_usb_detect(struct work_struct *work) + { + struct cpcap_phy_ddata *ddata; +@@ -226,9 +239,7 @@ static void cpcap_usb_detect(struct work_struct *work) + if (error) + goto out_err; + +- error = musb_mailbox(MUSB_ID_GROUND); +- if (error) +- goto out_err; ++ cpcap_usb_try_musb_mailbox(ddata, MUSB_ID_GROUND); + + error = regmap_update_bits(ddata->reg, CPCAP_REG_USBC3, + CPCAP_BIT_VBUSSTBY_EN | +@@ -257,9 +268,7 @@ static void cpcap_usb_detect(struct work_struct *work) + error = cpcap_usb_set_usb_mode(ddata); + if (error) + goto out_err; +- error = musb_mailbox(MUSB_ID_GROUND); +- if (error) +- goto out_err; ++ cpcap_usb_try_musb_mailbox(ddata, MUSB_ID_GROUND); + + return; + } +@@ -269,22 +278,18 @@ static void cpcap_usb_detect(struct work_struct *work) + error = cpcap_usb_set_usb_mode(ddata); + if (error) + goto out_err; +- error = musb_mailbox(MUSB_VBUS_VALID); +- if (error) +- goto out_err; ++ cpcap_usb_try_musb_mailbox(ddata, MUSB_VBUS_VALID); + + return; + } + ++ cpcap_usb_try_musb_mailbox(ddata, MUSB_VBUS_OFF); ++ + /* Default to debug UART mode */ + error = cpcap_usb_set_uart_mode(ddata); + if (error) + goto out_err; + +- error = musb_mailbox(MUSB_VBUS_OFF); +- if (error) +- goto out_err; +- + dev_dbg(ddata->dev, "set UART mode\n"); + + return; +@@ -649,9 +654,7 @@ static int cpcap_usb_phy_remove(struct platform_device *pdev) + if (error) + dev_err(ddata->dev, "could not set UART mode\n"); + +- error = musb_mailbox(MUSB_VBUS_OFF); +- if (error) +- dev_err(ddata->dev, "could not set mailbox\n"); ++ cpcap_usb_try_musb_mailbox(ddata, MUSB_VBUS_OFF); + + usb_remove_phy(&ddata->phy); + cancel_delayed_work_sync(&ddata->detect_work); +diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c +index 94ddd7d659c8..925b0004a0ed 100644 +--- a/drivers/powercap/intel_rapl_common.c ++++ b/drivers/powercap/intel_rapl_common.c +@@ -1293,6 +1293,9 @@ struct rapl_package *rapl_add_package(int cpu, struct rapl_if_priv *priv) + struct cpuinfo_x86 *c = &cpu_data(cpu); + int ret; + ++ if (!rapl_defaults) ++ return ERR_PTR(-ENODEV); ++ + rp = kzalloc(sizeof(struct rapl_package), GFP_KERNEL); + if (!rp) + return ERR_PTR(-ENOMEM); +diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c +index eea5ebbb5119..c655074c07c2 100644 +--- a/drivers/rpmsg/rpmsg_char.c ++++ b/drivers/rpmsg/rpmsg_char.c +@@ -227,8 +227,10 @@ static ssize_t rpmsg_eptdev_write_iter(struct kiocb *iocb, + if (!kbuf) + return -ENOMEM; + +- if (!copy_from_iter_full(kbuf, len, from)) +- return -EFAULT; ++ if (!copy_from_iter_full(kbuf, len, from)) { ++ ret = -EFAULT; ++ goto free_kbuf; ++ } + + if (mutex_lock_interruptible(&eptdev->ept_lock)) { + ret = -ERESTARTSYS; +diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c +index 5e2bd9f1d01e..fc32be687606 100644 +--- a/drivers/rtc/rtc-sun6i.c ++++ b/drivers/rtc/rtc-sun6i.c +@@ -380,6 +380,22 @@ static void __init sun50i_h6_rtc_clk_init(struct device_node *node) + CLK_OF_DECLARE_DRIVER(sun50i_h6_rtc_clk, "allwinner,sun50i-h6-rtc", + sun50i_h6_rtc_clk_init); + ++/* ++ * The R40 user manual is self-conflicting on whether the prescaler is ++ * fixed or configurable. The clock diagram shows it as fixed, but there ++ * is also a configurable divider in the RTC block. ++ */ ++static const struct sun6i_rtc_clk_data sun8i_r40_rtc_data = { ++ .rc_osc_rate = 16000000, ++ .fixed_prescaler = 512, ++}; ++static void __init sun8i_r40_rtc_clk_init(struct device_node *node) ++{ ++ sun6i_rtc_clk_init(node, &sun8i_r40_rtc_data); ++} ++CLK_OF_DECLARE_DRIVER(sun8i_r40_rtc_clk, "allwinner,sun8i-r40-rtc", ++ sun8i_r40_rtc_clk_init); ++ + static const struct sun6i_rtc_clk_data sun8i_v3_rtc_data = { + .rc_osc_rate = 32000, + .has_out_clk = 1, +diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c +index 29ab81df75c0..fbfce02e5b93 100644 +--- a/drivers/scsi/bfa/bfad_attr.c ++++ b/drivers/scsi/bfa/bfad_attr.c +@@ -275,8 +275,10 @@ bfad_im_get_stats(struct Scsi_Host *shost) + rc = bfa_port_get_stats(BFA_FCPORT(&bfad->bfa), + fcstats, bfad_hcb_comp, &fcomp); + spin_unlock_irqrestore(&bfad->bfad_lock, flags); +- if (rc != BFA_STATUS_OK) ++ if (rc != BFA_STATUS_OK) { ++ kfree(fcstats); + return NULL; ++ } + + wait_for_completion(&fcomp.comp); + +diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c +index dbff0f7e7cf5..ddc0dc93d08b 100644 +--- a/drivers/staging/comedi/drivers/adv_pci1710.c ++++ b/drivers/staging/comedi/drivers/adv_pci1710.c +@@ -46,8 +46,8 @@ + #define PCI171X_RANGE_UNI BIT(4) + #define PCI171X_RANGE_GAIN(x) (((x) & 0x7) << 0) + #define PCI171X_MUX_REG 0x04 /* W: A/D multiplexor control */ +-#define PCI171X_MUX_CHANH(x) (((x) & 0xf) << 8) +-#define PCI171X_MUX_CHANL(x) (((x) & 0xf) << 0) ++#define PCI171X_MUX_CHANH(x) (((x) & 0xff) << 8) ++#define PCI171X_MUX_CHANL(x) (((x) & 0xff) << 0) + #define PCI171X_MUX_CHAN(x) (PCI171X_MUX_CHANH(x) | PCI171X_MUX_CHANL(x)) + #define PCI171X_STATUS_REG 0x06 /* R: status register */ + #define PCI171X_STATUS_IRQ BIT(11) /* 1=IRQ occurred */ +diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c +index a7cac0719b8b..b5d42f411dd8 100644 +--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c ++++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c +@@ -37,6 +37,7 @@ static const struct usb_device_id rtw_usb_id_tbl[] = { + {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ + {USB_DEVICE(0x2001, 0x331B)}, /* D-Link DWA-121 rev B1 */ + {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */ ++ {USB_DEVICE(0x2357, 0x0111)}, /* TP-Link TL-WN727N v5.21 */ + {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ + {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */ + {} /* Terminating entry */ +diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c +index 8d19ae71e7cc..4e651b698617 100644 +--- a/drivers/staging/vt6656/baseband.c ++++ b/drivers/staging/vt6656/baseband.c +@@ -449,8 +449,8 @@ int vnt_vt3184_init(struct vnt_private *priv) + + memcpy(array, addr, length); + +- ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0, +- MESSAGE_REQUEST_BBREG, length, array); ++ ret = vnt_control_out_blocks(priv, VNT_REG_BLOCK_SIZE, ++ MESSAGE_REQUEST_BBREG, length, array); + if (ret) + goto end; + +diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c +index 56cd77fd9ea0..7958fc165462 100644 +--- a/drivers/staging/vt6656/card.c ++++ b/drivers/staging/vt6656/card.c +@@ -719,7 +719,7 @@ end: + */ + int vnt_radio_power_on(struct vnt_private *priv) + { +- int ret = true; ++ int ret = 0; + + vnt_exit_deep_sleep(priv); + +diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h +index 6074ceda78bf..50e1c8918040 100644 +--- a/drivers/staging/vt6656/device.h ++++ b/drivers/staging/vt6656/device.h +@@ -259,6 +259,7 @@ struct vnt_private { + u8 mac_hw; + /* netdev */ + struct usb_device *usb; ++ struct usb_interface *intf; + + u64 tsf_time; + u8 rx_rate; +diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c +index 856ba97aec4f..c26882e2bb80 100644 +--- a/drivers/staging/vt6656/main_usb.c ++++ b/drivers/staging/vt6656/main_usb.c +@@ -950,7 +950,7 @@ static const struct ieee80211_ops vnt_mac_ops = { + + int vnt_init(struct vnt_private *priv) + { +- if (!(vnt_init_registers(priv))) ++ if (vnt_init_registers(priv)) + return -EAGAIN; + + SET_IEEE80211_PERM_ADDR(priv->hw, priv->permanent_net_addr); +@@ -993,6 +993,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) + priv = hw->priv; + priv->hw = hw; + priv->usb = udev; ++ priv->intf = intf; + + vnt_set_options(priv); + +diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c +index d3304df6bd53..d977d4777e4f 100644 +--- a/drivers/staging/vt6656/usbpipe.c ++++ b/drivers/staging/vt6656/usbpipe.c +@@ -59,7 +59,9 @@ int vnt_control_out(struct vnt_private *priv, u8 request, u16 value, + + kfree(usb_buffer); + +- if (ret >= 0 && ret < (int)length) ++ if (ret == (int)length) ++ ret = 0; ++ else + ret = -EIO; + + end_unlock: +@@ -74,6 +76,23 @@ int vnt_control_out_u8(struct vnt_private *priv, u8 reg, u8 reg_off, u8 data) + reg_off, reg, sizeof(u8), &data); + } + ++int vnt_control_out_blocks(struct vnt_private *priv, ++ u16 block, u8 reg, u16 length, u8 *data) ++{ ++ int ret = 0, i; ++ ++ for (i = 0; i < length; i += block) { ++ u16 len = min_t(int, length - i, block); ++ ++ ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, ++ i, reg, len, data + i); ++ if (ret) ++ goto end; ++ } ++end: ++ return ret; ++} ++ + int vnt_control_in(struct vnt_private *priv, u8 request, u16 value, + u16 index, u16 length, u8 *buffer) + { +@@ -103,7 +122,9 @@ int vnt_control_in(struct vnt_private *priv, u8 request, u16 value, + + kfree(usb_buffer); + +- if (ret >= 0 && ret < (int)length) ++ if (ret == (int)length) ++ ret = 0; ++ else + ret = -EIO; + + end_unlock: +diff --git a/drivers/staging/vt6656/usbpipe.h b/drivers/staging/vt6656/usbpipe.h +index 95147ec7b96a..b65d9c01a211 100644 +--- a/drivers/staging/vt6656/usbpipe.h ++++ b/drivers/staging/vt6656/usbpipe.h +@@ -18,6 +18,8 @@ + + #include "device.h" + ++#define VNT_REG_BLOCK_SIZE 64 ++ + int vnt_control_out(struct vnt_private *priv, u8 request, u16 value, + u16 index, u16 length, u8 *buffer); + int vnt_control_in(struct vnt_private *priv, u8 request, u16 value, +@@ -26,6 +28,9 @@ int vnt_control_in(struct vnt_private *priv, u8 request, u16 value, + int vnt_control_out_u8(struct vnt_private *priv, u8 reg, u8 ref_off, u8 data); + int vnt_control_in_u8(struct vnt_private *priv, u8 reg, u8 reg_off, u8 *data); + ++int vnt_control_out_blocks(struct vnt_private *priv, ++ u16 block, u8 reg, u16 len, u8 *data); ++ + int vnt_start_interrupt_urb(struct vnt_private *priv); + int vnt_submit_rx_urb(struct vnt_private *priv, struct vnt_rcb *rcb); + int vnt_tx_context(struct vnt_private *priv, +diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c +index 3eb2f11a5de1..2c5250ca2801 100644 +--- a/drivers/staging/vt6656/wcmd.c ++++ b/drivers/staging/vt6656/wcmd.c +@@ -99,6 +99,7 @@ void vnt_run_command(struct work_struct *work) + if (vnt_init(priv)) { + /* If fail all ends TODO retry */ + dev_err(&priv->usb->dev, "failed to start\n"); ++ usb_set_intfdata(priv->intf, NULL); + ieee80211_free_hw(priv->hw); + return; + } +diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c +index a0ac16ee6575..a9719858c950 100644 +--- a/drivers/tty/serdev/core.c ++++ b/drivers/tty/serdev/core.c +@@ -582,6 +582,12 @@ static acpi_status acpi_serdev_register_device(struct serdev_controller *ctrl, + return AE_OK; + } + ++static const struct acpi_device_id serdev_acpi_devices_blacklist[] = { ++ { "INT3511", 0 }, ++ { "INT3512", 0 }, ++ { }, ++}; ++ + static acpi_status acpi_serdev_add_device(acpi_handle handle, u32 level, + void *data, void **return_value) + { +@@ -591,6 +597,10 @@ static acpi_status acpi_serdev_add_device(acpi_handle handle, u32 level, + if (acpi_bus_get_device(handle, &adev)) + return AE_OK; + ++ /* Skip if black listed */ ++ if (!acpi_match_device_ids(adev, serdev_acpi_devices_blacklist)) ++ return AE_OK; ++ + return acpi_serdev_register_device(ctrl, adev); + } + +diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c +index b0a6eb106edb..7c2782785736 100644 +--- a/drivers/tty/serial/serial_core.c ++++ b/drivers/tty/serial/serial_core.c +@@ -2834,6 +2834,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) + if (uport->cons && uport->dev) + of_console_check(uport->dev->of_node, uport->cons->name, uport->line); + ++ tty_port_link_device(port, drv->tty_driver, uport->line); + uart_configure_port(drv, state, uport); + + port->console = uart_console(uport); +diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c +index 4c1e75509303..02f6ca2cb1ba 100644 +--- a/drivers/usb/cdns3/gadget.c ++++ b/drivers/usb/cdns3/gadget.c +@@ -1375,13 +1375,10 @@ static void cdns3_check_usb_interrupt_proceed(struct cdns3_device *priv_dev, + */ + static irqreturn_t cdns3_device_irq_handler(int irq, void *data) + { +- struct cdns3_device *priv_dev; +- struct cdns3 *cdns = data; ++ struct cdns3_device *priv_dev = data; + irqreturn_t ret = IRQ_NONE; + u32 reg; + +- priv_dev = cdns->gadget_dev; +- + /* check USB device interrupt */ + reg = readl(&priv_dev->regs->usb_ists); + if (reg) { +@@ -1419,14 +1416,12 @@ static irqreturn_t cdns3_device_irq_handler(int irq, void *data) + */ + static irqreturn_t cdns3_device_thread_irq_handler(int irq, void *data) + { +- struct cdns3_device *priv_dev; +- struct cdns3 *cdns = data; ++ struct cdns3_device *priv_dev = data; + irqreturn_t ret = IRQ_NONE; + unsigned long flags; + int bit; + u32 reg; + +- priv_dev = cdns->gadget_dev; + spin_lock_irqsave(&priv_dev->lock, flags); + + reg = readl(&priv_dev->regs->usb_ists); +@@ -2539,7 +2534,7 @@ void cdns3_gadget_exit(struct cdns3 *cdns) + + priv_dev = cdns->gadget_dev; + +- devm_free_irq(cdns->dev, cdns->dev_irq, cdns); ++ devm_free_irq(cdns->dev, cdns->dev_irq, priv_dev); + + pm_runtime_mark_last_busy(cdns->dev); + pm_runtime_put_autosuspend(cdns->dev); +@@ -2710,7 +2705,8 @@ static int __cdns3_gadget_init(struct cdns3 *cdns) + ret = devm_request_threaded_irq(cdns->dev, cdns->dev_irq, + cdns3_device_irq_handler, + cdns3_device_thread_irq_handler, +- IRQF_SHARED, dev_name(cdns->dev), cdns); ++ IRQF_SHARED, dev_name(cdns->dev), ++ cdns->gadget_dev); + + if (ret) + goto err0; +diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c +index b45ceb91c735..48e4a5ca1835 100644 +--- a/drivers/usb/chipidea/host.c ++++ b/drivers/usb/chipidea/host.c +@@ -26,6 +26,7 @@ static int (*orig_bus_suspend)(struct usb_hcd *hcd); + + struct ehci_ci_priv { + struct regulator *reg_vbus; ++ bool enabled; + }; + + static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) +@@ -37,7 +38,7 @@ static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) + int ret = 0; + int port = HCS_N_PORTS(ehci->hcs_params); + +- if (priv->reg_vbus) { ++ if (priv->reg_vbus && enable != priv->enabled) { + if (port > 1) { + dev_warn(dev, + "Not support multi-port regulator control\n"); +@@ -53,6 +54,7 @@ static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) + enable ? "enable" : "disable", ret); + return ret; + } ++ priv->enabled = enable; + } + + if (enable && (ci->platdata->phy_mode == USBPHY_INTERFACE_MODE_HSIC)) { +diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c +index 5e92c6abe306..3e94259406d7 100644 +--- a/drivers/usb/core/config.c ++++ b/drivers/usb/core/config.c +@@ -392,12 +392,16 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, + endpoint->desc.wMaxPacketSize = cpu_to_le16(8); + } + +- /* Validate the wMaxPacketSize field */ ++ /* ++ * Validate the wMaxPacketSize field. ++ * Some devices have isochronous endpoints in altsetting 0; ++ * the USB-2 spec requires such endpoints to have wMaxPacketSize = 0 ++ * (see the end of section 5.6.3), so don't warn about them. ++ */ + maxp = usb_endpoint_maxp(&endpoint->desc); +- if (maxp == 0) { +- dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has wMaxPacketSize 0, skipping\n", ++ if (maxp == 0 && !(usb_endpoint_xfer_isoc(d) && asnum == 0)) { ++ dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n", + cfgno, inum, asnum, d->bEndpointAddress); +- goto skip_to_next_endpoint_or_interface_descriptor; + } + + /* Find the highest legal maxpacket size for this endpoint */ +diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c +index 38183ac438c6..1371b0c249ec 100644 +--- a/drivers/usb/host/ohci-da8xx.c ++++ b/drivers/usb/host/ohci-da8xx.c +@@ -415,13 +415,17 @@ static int ohci_da8xx_probe(struct platform_device *pdev) + } + + da8xx_ohci->oc_gpio = devm_gpiod_get_optional(dev, "oc", GPIOD_IN); +- if (IS_ERR(da8xx_ohci->oc_gpio)) ++ if (IS_ERR(da8xx_ohci->oc_gpio)) { ++ error = PTR_ERR(da8xx_ohci->oc_gpio); + goto err; ++ } + + if (da8xx_ohci->oc_gpio) { + oc_irq = gpiod_to_irq(da8xx_ohci->oc_gpio); +- if (oc_irq < 0) ++ if (oc_irq < 0) { ++ error = oc_irq; + goto err; ++ } + + error = devm_request_threaded_irq(dev, oc_irq, NULL, + ohci_da8xx_oc_thread, IRQF_TRIGGER_RISING | +diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c +index bd63450af76a..bf083c1f997f 100644 +--- a/drivers/usb/musb/musb_core.c ++++ b/drivers/usb/musb/musb_core.c +@@ -1840,6 +1840,9 @@ ATTRIBUTE_GROUPS(musb); + #define MUSB_QUIRK_B_INVALID_VBUS_91 (MUSB_DEVCTL_BDEVICE | \ + (2 << MUSB_DEVCTL_VBUS_SHIFT) | \ + MUSB_DEVCTL_SESSION) ++#define MUSB_QUIRK_B_DISCONNECT_99 (MUSB_DEVCTL_BDEVICE | \ ++ (3 << MUSB_DEVCTL_VBUS_SHIFT) | \ ++ MUSB_DEVCTL_SESSION) + #define MUSB_QUIRK_A_DISCONNECT_19 ((3 << MUSB_DEVCTL_VBUS_SHIFT) | \ + MUSB_DEVCTL_SESSION) + +@@ -1862,6 +1865,11 @@ static void musb_pm_runtime_check_session(struct musb *musb) + s = MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV | + MUSB_DEVCTL_HR; + switch (devctl & ~s) { ++ case MUSB_QUIRK_B_DISCONNECT_99: ++ musb_dbg(musb, "Poll devctl in case of suspend after disconnect\n"); ++ schedule_delayed_work(&musb->irq_work, ++ msecs_to_jiffies(1000)); ++ break; + case MUSB_QUIRK_B_INVALID_VBUS_91: + if (musb->quirk_retries && !musb->flush_irq_work) { + musb_dbg(musb, +@@ -2310,6 +2318,9 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) + musb_disable_interrupts(musb); + musb_writeb(musb->mregs, MUSB_DEVCTL, 0); + ++ /* MUSB_POWER_SOFTCONN might be already set, JZ4740 does this. */ ++ musb_writeb(musb->mregs, MUSB_POWER, 0); ++ + /* Init IRQ workqueue before request_irq */ + INIT_DELAYED_WORK(&musb->irq_work, musb_irq_work); + INIT_DELAYED_WORK(&musb->deassert_reset_work, musb_deassert_reset); +diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c +index 5fc6825745f2..2d3751d885b4 100644 +--- a/drivers/usb/musb/musbhsdma.c ++++ b/drivers/usb/musb/musbhsdma.c +@@ -425,7 +425,7 @@ struct dma_controller *musbhs_dma_controller_create(struct musb *musb, + controller->controller.channel_abort = dma_channel_abort; + + if (request_irq(irq, dma_controller_irq, 0, +- dev_name(musb->controller), &controller->controller)) { ++ dev_name(musb->controller), controller)) { + dev_err(dev, "request_irq %d failed!\n", irq); + musb_dma_controller_destroy(&controller->controller); + +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c +index fea09a3f491f..2d919d0e6e45 100644 +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -567,6 +567,9 @@ static void option_instat_callback(struct urb *urb); + /* Interface must have two endpoints */ + #define NUMEP2 BIT(16) + ++/* Device needs ZLP */ ++#define ZLP BIT(17) ++ + + static const struct usb_device_id option_ids[] = { + { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, +@@ -1198,6 +1201,8 @@ static const struct usb_device_id option_ids[] = { + .driver_info = NCTRL(0) | RSVD(1) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1901, 0xff), /* Telit LN940 (MBIM) */ + .driver_info = NCTRL(0) }, ++ { USB_DEVICE(TELIT_VENDOR_ID, 0x9010), /* Telit SBL FN980 flashing device */ ++ .driver_info = NCTRL(0) | ZLP }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff), + .driver_info = RSVD(1) }, +@@ -2099,6 +2104,9 @@ static int option_attach(struct usb_serial *serial) + if (!(device_flags & NCTRL(iface_desc->bInterfaceNumber))) + data->use_send_setup = 1; + ++ if (device_flags & ZLP) ++ data->use_zlp = 1; ++ + spin_lock_init(&data->susp_lock); + + usb_set_serial_data(serial, data); +diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h +index 1c120eaf4091..934e9361cf6b 100644 +--- a/drivers/usb/serial/usb-wwan.h ++++ b/drivers/usb/serial/usb-wwan.h +@@ -38,6 +38,7 @@ struct usb_wwan_intf_private { + spinlock_t susp_lock; + unsigned int suspended:1; + unsigned int use_send_setup:1; ++ unsigned int use_zlp:1; + int in_flight; + unsigned int open_ports; + void *private; +diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c +index 7e855c87e4f7..13be21aad2f4 100644 +--- a/drivers/usb/serial/usb_wwan.c ++++ b/drivers/usb/serial/usb_wwan.c +@@ -461,6 +461,7 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port, + void (*callback) (struct urb *)) + { + struct usb_serial *serial = port->serial; ++ struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial); + struct urb *urb; + + urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ +@@ -471,6 +472,9 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port, + usb_sndbulkpipe(serial->dev, endpoint) | dir, + buf, len, callback, ctx); + ++ if (intfdata->use_zlp && dir == USB_DIR_OUT) ++ urb->transfer_flags |= URB_ZERO_PACKET; ++ + return urb; + } + +diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c +index c1f7073a56de..8b4ff9fff340 100644 +--- a/drivers/usb/typec/tcpm/tcpci.c ++++ b/drivers/usb/typec/tcpm/tcpci.c +@@ -432,20 +432,30 @@ irqreturn_t tcpci_irq(struct tcpci *tcpci) + + if (status & TCPC_ALERT_RX_STATUS) { + struct pd_message msg; +- unsigned int cnt; ++ unsigned int cnt, payload_cnt; + u16 header; + + regmap_read(tcpci->regmap, TCPC_RX_BYTE_CNT, &cnt); ++ /* ++ * 'cnt' corresponds to READABLE_BYTE_COUNT in section 4.4.14 ++ * of the TCPCI spec [Rev 2.0 Ver 1.0 October 2017] and is ++ * defined in table 4-36 as one greater than the number of ++ * bytes received. And that number includes the header. So: ++ */ ++ if (cnt > 3) ++ payload_cnt = cnt - (1 + sizeof(msg.header)); ++ else ++ payload_cnt = 0; + + tcpci_read16(tcpci, TCPC_RX_HDR, &header); + msg.header = cpu_to_le16(header); + +- if (WARN_ON(cnt > sizeof(msg.payload))) +- cnt = sizeof(msg.payload); ++ if (WARN_ON(payload_cnt > sizeof(msg.payload))) ++ payload_cnt = sizeof(msg.payload); + +- if (cnt > 0) ++ if (payload_cnt > 0) + regmap_raw_read(tcpci->regmap, TCPC_RX_DATA, +- &msg.payload, cnt); ++ &msg.payload, payload_cnt); + + /* Read complete, clear RX status alert bit */ + tcpci_write16(tcpci, TCPC_ALERT, TCPC_ALERT_RX_STATUS); +diff --git a/fs/char_dev.c b/fs/char_dev.c +index 00dfe17871ac..c5e6eff5a381 100644 +--- a/fs/char_dev.c ++++ b/fs/char_dev.c +@@ -352,7 +352,7 @@ static struct kobject *cdev_get(struct cdev *p) + + if (owner && !try_module_get(owner)) + return NULL; +- kobj = kobject_get(&p->kobj); ++ kobj = kobject_get_unless_zero(&p->kobj); + if (!kobj) + module_put(owner); + return kobj; +diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c +index 487ee39b438a..013486b5125e 100644 +--- a/fs/pstore/ram.c ++++ b/fs/pstore/ram.c +@@ -583,12 +583,12 @@ static int ramoops_init_przs(const char *name, + prz_ar[i] = persistent_ram_new(*paddr, zone_sz, sig, + &cxt->ecc_info, + cxt->memtype, flags, label); ++ kfree(label); + if (IS_ERR(prz_ar[i])) { + err = PTR_ERR(prz_ar[i]); + dev_err(dev, "failed to request %s mem region (0x%zx@0x%llx): %d\n", + name, record_size, + (unsigned long long)*paddr, err); +- kfree(label); + + while (i > 0) { + i--; +@@ -629,12 +629,12 @@ static int ramoops_init_prz(const char *name, + label = kasprintf(GFP_KERNEL, "ramoops:%s", name); + *prz = persistent_ram_new(*paddr, sz, sig, &cxt->ecc_info, + cxt->memtype, PRZ_FLAG_ZAP_OLD, label); ++ kfree(label); + if (IS_ERR(*prz)) { + int err = PTR_ERR(*prz); + + dev_err(dev, "failed to request %s mem region (0x%zx@0x%llx): %d\n", + name, sz, (unsigned long long)*paddr, err); +- kfree(label); + return err; + } + +diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c +index 8823f65888f0..1f4d8c06f9be 100644 +--- a/fs/pstore/ram_core.c ++++ b/fs/pstore/ram_core.c +@@ -574,7 +574,7 @@ struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size, + /* Initialize general buffer state. */ + raw_spin_lock_init(&prz->buffer_lock); + prz->flags = flags; +- prz->label = label; ++ prz->label = kstrdup(label, GFP_KERNEL); + + ret = persistent_ram_buffer_map(start, size, prz, memtype); + if (ret) +diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h +index 9b3c720a31b1..5e3d45525bd3 100644 +--- a/include/linux/can/dev.h ++++ b/include/linux/can/dev.h +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include + + /* +@@ -91,6 +92,36 @@ struct can_priv { + #define get_can_dlc(i) (min_t(__u8, (i), CAN_MAX_DLC)) + #define get_canfd_dlc(i) (min_t(__u8, (i), CANFD_MAX_DLC)) + ++/* Check for outgoing skbs that have not been created by the CAN subsystem */ ++static inline bool can_skb_headroom_valid(struct net_device *dev, ++ struct sk_buff *skb) ++{ ++ /* af_packet creates a headroom of HH_DATA_MOD bytes which is fine */ ++ if (WARN_ON_ONCE(skb_headroom(skb) < sizeof(struct can_skb_priv))) ++ return false; ++ ++ /* af_packet does not apply CAN skb specific settings */ ++ if (skb->ip_summed == CHECKSUM_NONE) { ++ /* init headroom */ ++ can_skb_prv(skb)->ifindex = dev->ifindex; ++ can_skb_prv(skb)->skbcnt = 0; ++ ++ skb->ip_summed = CHECKSUM_UNNECESSARY; ++ ++ /* preform proper loopback on capable devices */ ++ if (dev->flags & IFF_ECHO) ++ skb->pkt_type = PACKET_LOOPBACK; ++ else ++ skb->pkt_type = PACKET_HOST; ++ ++ skb_reset_mac_header(skb); ++ skb_reset_network_header(skb); ++ skb_reset_transport_header(skb); ++ } ++ ++ return true; ++} ++ + /* Drop a given socketbuffer if it does not contain a valid CAN frame. */ + static inline bool can_dropped_invalid_skb(struct net_device *dev, + struct sk_buff *skb) +@@ -108,6 +139,9 @@ static inline bool can_dropped_invalid_skb(struct net_device *dev, + } else + goto inval_skb; + ++ if (!can_skb_headroom_valid(dev, skb)) ++ goto inval_skb; ++ + return false; + + inval_skb: +diff --git a/include/trace/events/preemptirq.h b/include/trace/events/preemptirq.h +index 95fba0471e5b..3f249e150c0c 100644 +--- a/include/trace/events/preemptirq.h ++++ b/include/trace/events/preemptirq.h +@@ -18,13 +18,13 @@ DECLARE_EVENT_CLASS(preemptirq_template, + TP_ARGS(ip, parent_ip), + + TP_STRUCT__entry( +- __field(u32, caller_offs) +- __field(u32, parent_offs) ++ __field(s32, caller_offs) ++ __field(s32, parent_offs) + ), + + TP_fast_assign( +- __entry->caller_offs = (u32)(ip - (unsigned long)_stext); +- __entry->parent_offs = (u32)(parent_ip - (unsigned long)_stext); ++ __entry->caller_offs = (s32)(ip - (unsigned long)_stext); ++ __entry->parent_offs = (s32)(parent_ip - (unsigned long)_stext); + ), + + TP_printk("caller=%pS parent=%pS", +diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h +index f056b2a00d5c..9a61c28ed3ae 100644 +--- a/include/uapi/linux/input.h ++++ b/include/uapi/linux/input.h +@@ -34,6 +34,7 @@ struct input_event { + __kernel_ulong_t __sec; + #if defined(__sparc__) && defined(__arch64__) + unsigned int __usec; ++ unsigned int __pad; + #else + __kernel_ulong_t __usec; + #endif +diff --git a/kernel/fork.c b/kernel/fork.c +index 6cabc124378c..755d8160e001 100644 +--- a/kernel/fork.c ++++ b/kernel/fork.c +@@ -2513,6 +2513,16 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, + #endif + + #ifdef __ARCH_WANT_SYS_CLONE3 ++ ++/* ++ * copy_thread implementations handle CLONE_SETTLS by reading the TLS value from ++ * the registers containing the syscall arguments for clone. This doesn't work ++ * with clone3 since the TLS value is passed in clone_args instead. ++ */ ++#ifndef CONFIG_HAVE_COPY_THREAD_TLS ++#error clone3 requires copy_thread_tls support in arch ++#endif ++ + noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs, + struct clone_args __user *uargs, + size_t usize) +diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c +index 5e43b9664eca..617e297f46dc 100644 +--- a/kernel/trace/trace_sched_wakeup.c ++++ b/kernel/trace/trace_sched_wakeup.c +@@ -630,7 +630,7 @@ static void start_wakeup_tracer(struct trace_array *tr) + if (ret) { + pr_info("wakeup trace: Couldn't activate tracepoint" + " probe to kernel_sched_migrate_task\n"); +- return; ++ goto fail_deprobe_sched_switch; + } + + wakeup_reset(tr); +@@ -648,6 +648,8 @@ static void start_wakeup_tracer(struct trace_array *tr) + printk(KERN_ERR "failed to start wakeup tracer\n"); + + return; ++fail_deprobe_sched_switch: ++ unregister_trace_sched_switch(probe_wakeup_sched_switch, NULL); + fail_deprobe_wake_new: + unregister_trace_sched_wakeup_new(probe_wakeup, NULL); + fail_deprobe: +diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c +index 4df9a209f7ca..c557f42a9397 100644 +--- a/kernel/trace/trace_stack.c ++++ b/kernel/trace/trace_stack.c +@@ -283,6 +283,11 @@ static void check_stack(unsigned long ip, unsigned long *stack) + local_irq_restore(flags); + } + ++/* Some archs may not define MCOUNT_INSN_SIZE */ ++#ifndef MCOUNT_INSN_SIZE ++# define MCOUNT_INSN_SIZE 0 ++#endif ++ + static void + stack_trace_call(unsigned long ip, unsigned long parent_ip, + struct ftrace_ops *op, struct pt_regs *pt_regs) +diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c +index 214154b47d56..069f72edb264 100644 +--- a/net/ipv4/netfilter/arp_tables.c ++++ b/net/ipv4/netfilter/arp_tables.c +@@ -384,10 +384,11 @@ next: ; + return 1; + } + +-static inline int check_target(struct arpt_entry *e, const char *name) ++static int check_target(struct arpt_entry *e, struct net *net, const char *name) + { + struct xt_entry_target *t = arpt_get_target(e); + struct xt_tgchk_param par = { ++ .net = net, + .table = name, + .entryinfo = e, + .target = t->u.kernel.target, +@@ -399,8 +400,9 @@ static inline int check_target(struct arpt_entry *e, const char *name) + return xt_check_target(&par, t->u.target_size - sizeof(*t), 0, false); + } + +-static inline int +-find_check_entry(struct arpt_entry *e, const char *name, unsigned int size, ++static int ++find_check_entry(struct arpt_entry *e, struct net *net, const char *name, ++ unsigned int size, + struct xt_percpu_counter_alloc_state *alloc_state) + { + struct xt_entry_target *t; +@@ -419,7 +421,7 @@ find_check_entry(struct arpt_entry *e, const char *name, unsigned int size, + } + t->u.kernel.target = target; + +- ret = check_target(e, name); ++ ret = check_target(e, net, name); + if (ret) + goto err; + return 0; +@@ -512,7 +514,9 @@ static inline void cleanup_entry(struct arpt_entry *e) + /* Checks and translates the user-supplied table segment (held in + * newinfo). + */ +-static int translate_table(struct xt_table_info *newinfo, void *entry0, ++static int translate_table(struct net *net, ++ struct xt_table_info *newinfo, ++ void *entry0, + const struct arpt_replace *repl) + { + struct xt_percpu_counter_alloc_state alloc_state = { 0 }; +@@ -569,7 +573,7 @@ static int translate_table(struct xt_table_info *newinfo, void *entry0, + /* Finally, each sanity check must pass */ + i = 0; + xt_entry_foreach(iter, entry0, newinfo->size) { +- ret = find_check_entry(iter, repl->name, repl->size, ++ ret = find_check_entry(iter, net, repl->name, repl->size, + &alloc_state); + if (ret != 0) + break; +@@ -974,7 +978,7 @@ static int do_replace(struct net *net, const void __user *user, + goto free_newinfo; + } + +- ret = translate_table(newinfo, loc_cpu_entry, &tmp); ++ ret = translate_table(net, newinfo, loc_cpu_entry, &tmp); + if (ret != 0) + goto free_newinfo; + +@@ -1149,7 +1153,8 @@ compat_copy_entry_from_user(struct compat_arpt_entry *e, void **dstptr, + } + } + +-static int translate_compat_table(struct xt_table_info **pinfo, ++static int translate_compat_table(struct net *net, ++ struct xt_table_info **pinfo, + void **pentry0, + const struct compat_arpt_replace *compatr) + { +@@ -1217,7 +1222,7 @@ static int translate_compat_table(struct xt_table_info **pinfo, + repl.num_counters = 0; + repl.counters = NULL; + repl.size = newinfo->size; +- ret = translate_table(newinfo, entry1, &repl); ++ ret = translate_table(net, newinfo, entry1, &repl); + if (ret) + goto free_newinfo; + +@@ -1270,7 +1275,7 @@ static int compat_do_replace(struct net *net, void __user *user, + goto free_newinfo; + } + +- ret = translate_compat_table(&newinfo, &loc_cpu_entry, &tmp); ++ ret = translate_compat_table(net, &newinfo, &loc_cpu_entry, &tmp); + if (ret != 0) + goto free_newinfo; + +@@ -1546,7 +1551,7 @@ int arpt_register_table(struct net *net, + loc_cpu_entry = newinfo->entries; + memcpy(loc_cpu_entry, repl->entries, repl->size); + +- ret = translate_table(newinfo, loc_cpu_entry, repl); ++ ret = translate_table(net, newinfo, loc_cpu_entry, repl); + if (ret != 0) + goto out_free; + +diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c +index d73d1828216a..d8143a8c034d 100644 +--- a/net/netfilter/ipset/ip_set_core.c ++++ b/net/netfilter/ipset/ip_set_core.c +@@ -1658,6 +1658,7 @@ static int ip_set_utest(struct net *net, struct sock *ctnl, struct sk_buff *skb, + struct ip_set *set; + struct nlattr *tb[IPSET_ATTR_ADT_MAX + 1] = {}; + int ret = 0; ++ u32 lineno; + + if (unlikely(protocol_min_failed(attr) || + !attr[IPSET_ATTR_SETNAME] || +@@ -1674,7 +1675,7 @@ static int ip_set_utest(struct net *net, struct sock *ctnl, struct sk_buff *skb, + return -IPSET_ERR_PROTOCOL; + + rcu_read_lock_bh(); +- ret = set->variant->uadt(set, tb, IPSET_TEST, NULL, 0, 0); ++ ret = set->variant->uadt(set, tb, IPSET_TEST, &lineno, 0, 0); + rcu_read_unlock_bh(); + /* Userspace can't trigger element to be re-added */ + if (ret == -EAGAIN) +diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c +index b6b14db3955b..b3f4a334f9d7 100644 +--- a/net/netfilter/nf_conntrack_proto_dccp.c ++++ b/net/netfilter/nf_conntrack_proto_dccp.c +@@ -677,6 +677,9 @@ static int dccp_timeout_nlattr_to_obj(struct nlattr *tb[], + unsigned int *timeouts = data; + int i; + ++ if (!timeouts) ++ timeouts = dn->dccp_timeout; ++ + /* set default DCCP timeouts. */ + for (i=0; idccp_timeout[i]; +diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c +index fce3d93f1541..0399ae8f1188 100644 +--- a/net/netfilter/nf_conntrack_proto_sctp.c ++++ b/net/netfilter/nf_conntrack_proto_sctp.c +@@ -594,6 +594,9 @@ static int sctp_timeout_nlattr_to_obj(struct nlattr *tb[], + struct nf_sctp_net *sn = nf_sctp_pernet(net); + int i; + ++ if (!timeouts) ++ timeouts = sn->timeouts; ++ + /* set default SCTP timeouts. */ + for (i=0; itimeouts[i]; +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 252888f426de..d293488dc3dd 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -412,6 +412,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) + case 0x10ec0672: + alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ + break; ++ case 0x10ec0222: + case 0x10ec0623: + alc_update_coef_idx(codec, 0x19, 1<<13, 0); + break; +@@ -430,6 +431,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) + break; + case 0x10ec0899: + case 0x10ec0900: ++ case 0x10ec0b00: + case 0x10ec1168: + case 0x10ec1220: + alc_update_coef_idx(codec, 0x7, 1<<1, 0); +@@ -2526,6 +2528,7 @@ static int patch_alc882(struct hda_codec *codec) + case 0x10ec0882: + case 0x10ec0885: + case 0x10ec0900: ++ case 0x10ec0b00: + case 0x10ec1220: + break; + default: +@@ -7257,6 +7260,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), + SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), + SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), ++ SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1), + SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1), + SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), + SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), +@@ -9295,6 +9299,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = { + HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662), + HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882), + HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882), ++ HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882), + HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882), + HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882), + {} /* terminator */ +diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c +index a81c2066499f..82184036437b 100644 +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1397,6 +1397,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) + case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ + case USB_ID(0x0556, 0x0014): /* Phoenix Audio TMX320VC */ + case USB_ID(0x05A3, 0x9420): /* ELP HD USB Camera */ ++ case USB_ID(0x05a7, 0x1020): /* Bose Companion 5 */ + case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */ + case USB_ID(0x1395, 0x740a): /* Sennheiser DECT */ + case USB_ID(0x1901, 0x0191): /* GE B850V3 CP2114 audio interface */ diff --git a/patch/kernel/odroidxu4-current/03-patch-5.4.12-13.patch b/patch/kernel/odroidxu4-current/03-patch-5.4.12-13.patch new file mode 100644 index 000000000..253c8ad8d --- /dev/null +++ b/patch/kernel/odroidxu4-current/03-patch-5.4.12-13.patch @@ -0,0 +1,8010 @@ +diff --git a/Documentation/ABI/stable/sysfs-driver-mlxreg-io b/Documentation/ABI/stable/sysfs-driver-mlxreg-io +index 8ca498447aeb..05601a90a9b6 100644 +--- a/Documentation/ABI/stable/sysfs-driver-mlxreg-io ++++ b/Documentation/ABI/stable/sysfs-driver-mlxreg-io +@@ -29,13 +29,13 @@ Description: This file shows the system fans direction: + + The files are read only. + +-What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/jtag_enable ++What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld3_version + + Date: November 2018 + KernelVersion: 5.0 + Contact: Vadim Pasternak + Description: These files show with which CPLD versions have been burned +- on LED board. ++ on LED or Gearbox board. + + The files are read only. + +@@ -121,6 +121,15 @@ Description: These files show the system reset cause, as following: ComEx + + The files are read only. + ++What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld4_version ++Date: November 2018 ++KernelVersion: 5.0 ++Contact: Vadim Pasternak ++Description: These files show with which CPLD versions have been burned ++ on LED board. ++ ++ The files are read only. ++ + Date: June 2019 + KernelVersion: 5.3 + Contact: Vadim Pasternak +diff --git a/Documentation/ABI/testing/sysfs-bus-mei b/Documentation/ABI/testing/sysfs-bus-mei +index 6bd45346ac7e..3f8701e8fa24 100644 +--- a/Documentation/ABI/testing/sysfs-bus-mei ++++ b/Documentation/ABI/testing/sysfs-bus-mei +@@ -4,7 +4,7 @@ KernelVersion: 3.10 + Contact: Samuel Ortiz + linux-mei@linux.intel.com + Description: Stores the same MODALIAS value emitted by uevent +- Format: mei::: ++ Format: mei::: + + What: /sys/bus/mei/devices/.../name + Date: May 2015 +diff --git a/Documentation/admin-guide/device-mapper/index.rst b/Documentation/admin-guide/device-mapper/index.rst +index c77c58b8f67b..d8dec8911eb3 100644 +--- a/Documentation/admin-guide/device-mapper/index.rst ++++ b/Documentation/admin-guide/device-mapper/index.rst +@@ -8,6 +8,7 @@ Device Mapper + cache-policies + cache + delay ++ dm-clone + dm-crypt + dm-flakey + dm-init +diff --git a/Documentation/devicetree/bindings/reset/brcm,brcmstb-reset.txt b/Documentation/devicetree/bindings/reset/brcm,brcmstb-reset.txt +index 6e5341b4f891..ee59409640f2 100644 +--- a/Documentation/devicetree/bindings/reset/brcm,brcmstb-reset.txt ++++ b/Documentation/devicetree/bindings/reset/brcm,brcmstb-reset.txt +@@ -22,6 +22,6 @@ Example: + }; + + ðernet_switch { +- resets = <&reset>; ++ resets = <&reset 26>; + reset-names = "switch"; + }; +diff --git a/Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt b/Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt +index d6d5207fa996..17ff3892f439 100644 +--- a/Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt ++++ b/Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt +@@ -2,9 +2,11 @@ MT8183 with MT6358, TS3A227 and MAX98357 CODECS + + Required properties: + - compatible : "mediatek,mt8183_mt6358_ts3a227_max98357" +-- mediatek,headset-codec: the phandles of ts3a227 codecs + - mediatek,platform: the phandle of MT8183 ASoC platform + ++Optional properties: ++- mediatek,headset-codec: the phandles of ts3a227 codecs ++ + Example: + + sound { +diff --git a/Documentation/networking/j1939.rst b/Documentation/networking/j1939.rst +index dc60b13fcd09..f5be243d250a 100644 +--- a/Documentation/networking/j1939.rst ++++ b/Documentation/networking/j1939.rst +@@ -339,7 +339,7 @@ To claim an address following code example can be used: + .pgn = J1939_PGN_ADDRESS_CLAIMED, + .pgn_mask = J1939_PGN_PDU1_MAX, + }, { +- .pgn = J1939_PGN_ADDRESS_REQUEST, ++ .pgn = J1939_PGN_REQUEST, + .pgn_mask = J1939_PGN_PDU1_MAX, + }, { + .pgn = J1939_PGN_ADDRESS_COMMANDED, +diff --git a/Documentation/scsi/smartpqi.txt b/Documentation/scsi/smartpqi.txt +index 201f80c7c050..df129f55ace5 100644 +--- a/Documentation/scsi/smartpqi.txt ++++ b/Documentation/scsi/smartpqi.txt +@@ -29,7 +29,7 @@ smartpqi specific entries in /sys + smartpqi host attributes: + ------------------------- + /sys/class/scsi_host/host*/rescan +- /sys/class/scsi_host/host*/version ++ /sys/class/scsi_host/host*/driver_version + + The host rescan attribute is a write only attribute. Writing to this + attribute will trigger the driver to scan for new, changed, or removed +diff --git a/MAINTAINERS b/MAINTAINERS +index 9d3a5c54a41d..4f7ac27d8651 100644 +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -6973,6 +6973,7 @@ L: linux-acpi@vger.kernel.org + S: Maintained + F: Documentation/firmware-guide/acpi/gpio-properties.rst + F: drivers/gpio/gpiolib-acpi.c ++F: drivers/gpio/gpiolib-acpi.h + + GPIO IR Transmitter + M: Sean Young +diff --git a/Makefile b/Makefile +index 45c6264f1108..d4cf4700ae3f 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 12 ++SUBLEVEL = 13 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi +index 04ad2fb22b9a..dba3488492f1 100644 +--- a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi ++++ b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi +@@ -623,6 +623,8 @@ + l21 { + regulator-min-microvolt = <2950000>; + regulator-max-microvolt = <2950000>; ++ regulator-allow-set-load; ++ regulator-system-load = <200000>; + }; + l22 { + regulator-min-microvolt = <3300000>; +diff --git a/arch/arm64/crypto/aes-neonbs-glue.c b/arch/arm64/crypto/aes-neonbs-glue.c +index ea873b8904c4..e3e27349a9fe 100644 +--- a/arch/arm64/crypto/aes-neonbs-glue.c ++++ b/arch/arm64/crypto/aes-neonbs-glue.c +@@ -384,7 +384,7 @@ static int __xts_crypt(struct skcipher_request *req, bool encrypt, + goto xts_tail; + + kernel_neon_end(); +- skcipher_walk_done(&walk, nbytes); ++ err = skcipher_walk_done(&walk, nbytes); + } + + if (err || likely(!tail)) +diff --git a/arch/hexagon/include/asm/atomic.h b/arch/hexagon/include/asm/atomic.h +index 12cd9231c4b8..0231d69c8bf2 100644 +--- a/arch/hexagon/include/asm/atomic.h ++++ b/arch/hexagon/include/asm/atomic.h +@@ -91,7 +91,7 @@ static inline void atomic_##op(int i, atomic_t *v) \ + "1: %0 = memw_locked(%1);\n" \ + " %0 = "#op "(%0,%2);\n" \ + " memw_locked(%1,P3)=%0;\n" \ +- " if !P3 jump 1b;\n" \ ++ " if (!P3) jump 1b;\n" \ + : "=&r" (output) \ + : "r" (&v->counter), "r" (i) \ + : "memory", "p3" \ +@@ -107,7 +107,7 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \ + "1: %0 = memw_locked(%1);\n" \ + " %0 = "#op "(%0,%2);\n" \ + " memw_locked(%1,P3)=%0;\n" \ +- " if !P3 jump 1b;\n" \ ++ " if (!P3) jump 1b;\n" \ + : "=&r" (output) \ + : "r" (&v->counter), "r" (i) \ + : "memory", "p3" \ +@@ -124,7 +124,7 @@ static inline int atomic_fetch_##op(int i, atomic_t *v) \ + "1: %0 = memw_locked(%2);\n" \ + " %1 = "#op "(%0,%3);\n" \ + " memw_locked(%2,P3)=%1;\n" \ +- " if !P3 jump 1b;\n" \ ++ " if (!P3) jump 1b;\n" \ + : "=&r" (output), "=&r" (val) \ + : "r" (&v->counter), "r" (i) \ + : "memory", "p3" \ +@@ -173,7 +173,7 @@ static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u) + " }" + " memw_locked(%2, p3) = %1;" + " {" +- " if !p3 jump 1b;" ++ " if (!p3) jump 1b;" + " }" + "2:" + : "=&r" (__oldval), "=&r" (tmp) +diff --git a/arch/hexagon/include/asm/bitops.h b/arch/hexagon/include/asm/bitops.h +index 47384b094b94..71429f756af0 100644 +--- a/arch/hexagon/include/asm/bitops.h ++++ b/arch/hexagon/include/asm/bitops.h +@@ -38,7 +38,7 @@ static inline int test_and_clear_bit(int nr, volatile void *addr) + "1: R12 = memw_locked(R10);\n" + " { P0 = tstbit(R12,R11); R12 = clrbit(R12,R11); }\n" + " memw_locked(R10,P1) = R12;\n" +- " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n" ++ " {if (!P1) jump 1b; %0 = mux(P0,#1,#0);}\n" + : "=&r" (oldval) + : "r" (addr), "r" (nr) + : "r10", "r11", "r12", "p0", "p1", "memory" +@@ -62,7 +62,7 @@ static inline int test_and_set_bit(int nr, volatile void *addr) + "1: R12 = memw_locked(R10);\n" + " { P0 = tstbit(R12,R11); R12 = setbit(R12,R11); }\n" + " memw_locked(R10,P1) = R12;\n" +- " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n" ++ " {if (!P1) jump 1b; %0 = mux(P0,#1,#0);}\n" + : "=&r" (oldval) + : "r" (addr), "r" (nr) + : "r10", "r11", "r12", "p0", "p1", "memory" +@@ -88,7 +88,7 @@ static inline int test_and_change_bit(int nr, volatile void *addr) + "1: R12 = memw_locked(R10);\n" + " { P0 = tstbit(R12,R11); R12 = togglebit(R12,R11); }\n" + " memw_locked(R10,P1) = R12;\n" +- " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n" ++ " {if (!P1) jump 1b; %0 = mux(P0,#1,#0);}\n" + : "=&r" (oldval) + : "r" (addr), "r" (nr) + : "r10", "r11", "r12", "p0", "p1", "memory" +@@ -223,7 +223,7 @@ static inline int ffs(int x) + int r; + + asm("{ P0 = cmp.eq(%1,#0); %0 = ct0(%1);}\n" +- "{ if P0 %0 = #0; if !P0 %0 = add(%0,#1);}\n" ++ "{ if (P0) %0 = #0; if (!P0) %0 = add(%0,#1);}\n" + : "=&r" (r) + : "r" (x) + : "p0"); +diff --git a/arch/hexagon/include/asm/cmpxchg.h b/arch/hexagon/include/asm/cmpxchg.h +index 6091322c3af9..92b8a02e588a 100644 +--- a/arch/hexagon/include/asm/cmpxchg.h ++++ b/arch/hexagon/include/asm/cmpxchg.h +@@ -30,7 +30,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, + __asm__ __volatile__ ( + "1: %0 = memw_locked(%1);\n" /* load into retval */ + " memw_locked(%1,P0) = %2;\n" /* store into memory */ +- " if !P0 jump 1b;\n" ++ " if (!P0) jump 1b;\n" + : "=&r" (retval) + : "r" (ptr), "r" (x) + : "memory", "p0" +diff --git a/arch/hexagon/include/asm/futex.h b/arch/hexagon/include/asm/futex.h +index cb635216a732..0191f7c7193e 100644 +--- a/arch/hexagon/include/asm/futex.h ++++ b/arch/hexagon/include/asm/futex.h +@@ -16,7 +16,7 @@ + /* For example: %1 = %4 */ \ + insn \ + "2: memw_locked(%3,p2) = %1;\n" \ +- " if !p2 jump 1b;\n" \ ++ " if (!p2) jump 1b;\n" \ + " %1 = #0;\n" \ + "3:\n" \ + ".section .fixup,\"ax\"\n" \ +@@ -84,10 +84,10 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval, + "1: %1 = memw_locked(%3)\n" + " {\n" + " p2 = cmp.eq(%1,%4)\n" +- " if !p2.new jump:NT 3f\n" ++ " if (!p2.new) jump:NT 3f\n" + " }\n" + "2: memw_locked(%3,p2) = %5\n" +- " if !p2 jump 1b\n" ++ " if (!p2) jump 1b\n" + "3:\n" + ".section .fixup,\"ax\"\n" + "4: %0 = #%6\n" +diff --git a/arch/hexagon/include/asm/spinlock.h b/arch/hexagon/include/asm/spinlock.h +index bfe07d842ff3..ef103b73bec8 100644 +--- a/arch/hexagon/include/asm/spinlock.h ++++ b/arch/hexagon/include/asm/spinlock.h +@@ -30,9 +30,9 @@ static inline void arch_read_lock(arch_rwlock_t *lock) + __asm__ __volatile__( + "1: R6 = memw_locked(%0);\n" + " { P3 = cmp.ge(R6,#0); R6 = add(R6,#1);}\n" +- " { if !P3 jump 1b; }\n" ++ " { if (!P3) jump 1b; }\n" + " memw_locked(%0,P3) = R6;\n" +- " { if !P3 jump 1b; }\n" ++ " { if (!P3) jump 1b; }\n" + : + : "r" (&lock->lock) + : "memory", "r6", "p3" +@@ -46,7 +46,7 @@ static inline void arch_read_unlock(arch_rwlock_t *lock) + "1: R6 = memw_locked(%0);\n" + " R6 = add(R6,#-1);\n" + " memw_locked(%0,P3) = R6\n" +- " if !P3 jump 1b;\n" ++ " if (!P3) jump 1b;\n" + : + : "r" (&lock->lock) + : "memory", "r6", "p3" +@@ -61,7 +61,7 @@ static inline int arch_read_trylock(arch_rwlock_t *lock) + __asm__ __volatile__( + " R6 = memw_locked(%1);\n" + " { %0 = #0; P3 = cmp.ge(R6,#0); R6 = add(R6,#1);}\n" +- " { if !P3 jump 1f; }\n" ++ " { if (!P3) jump 1f; }\n" + " memw_locked(%1,P3) = R6;\n" + " { %0 = P3 }\n" + "1:\n" +@@ -78,9 +78,9 @@ static inline void arch_write_lock(arch_rwlock_t *lock) + __asm__ __volatile__( + "1: R6 = memw_locked(%0)\n" + " { P3 = cmp.eq(R6,#0); R6 = #-1;}\n" +- " { if !P3 jump 1b; }\n" ++ " { if (!P3) jump 1b; }\n" + " memw_locked(%0,P3) = R6;\n" +- " { if !P3 jump 1b; }\n" ++ " { if (!P3) jump 1b; }\n" + : + : "r" (&lock->lock) + : "memory", "r6", "p3" +@@ -94,7 +94,7 @@ static inline int arch_write_trylock(arch_rwlock_t *lock) + __asm__ __volatile__( + " R6 = memw_locked(%1)\n" + " { %0 = #0; P3 = cmp.eq(R6,#0); R6 = #-1;}\n" +- " { if !P3 jump 1f; }\n" ++ " { if (!P3) jump 1f; }\n" + " memw_locked(%1,P3) = R6;\n" + " %0 = P3;\n" + "1:\n" +@@ -117,9 +117,9 @@ static inline void arch_spin_lock(arch_spinlock_t *lock) + __asm__ __volatile__( + "1: R6 = memw_locked(%0);\n" + " P3 = cmp.eq(R6,#0);\n" +- " { if !P3 jump 1b; R6 = #1; }\n" ++ " { if (!P3) jump 1b; R6 = #1; }\n" + " memw_locked(%0,P3) = R6;\n" +- " { if !P3 jump 1b; }\n" ++ " { if (!P3) jump 1b; }\n" + : + : "r" (&lock->lock) + : "memory", "r6", "p3" +@@ -139,7 +139,7 @@ static inline unsigned int arch_spin_trylock(arch_spinlock_t *lock) + __asm__ __volatile__( + " R6 = memw_locked(%1);\n" + " P3 = cmp.eq(R6,#0);\n" +- " { if !P3 jump 1f; R6 = #1; %0 = #0; }\n" ++ " { if (!P3) jump 1f; R6 = #1; %0 = #0; }\n" + " memw_locked(%1,P3) = R6;\n" + " %0 = P3;\n" + "1:\n" +diff --git a/arch/hexagon/kernel/stacktrace.c b/arch/hexagon/kernel/stacktrace.c +index 35f29423fda8..5ed02f699479 100644 +--- a/arch/hexagon/kernel/stacktrace.c ++++ b/arch/hexagon/kernel/stacktrace.c +@@ -11,8 +11,6 @@ + #include + #include + +-register unsigned long current_frame_pointer asm("r30"); +- + struct stackframe { + unsigned long fp; + unsigned long rets; +@@ -30,7 +28,7 @@ void save_stack_trace(struct stack_trace *trace) + + low = (unsigned long)task_stack_page(current); + high = low + THREAD_SIZE; +- fp = current_frame_pointer; ++ fp = (unsigned long)__builtin_frame_address(0); + + while (fp >= low && fp <= (high - sizeof(*frame))) { + frame = (struct stackframe *)fp; +diff --git a/arch/hexagon/kernel/vm_entry.S b/arch/hexagon/kernel/vm_entry.S +index 12242c27e2df..4023fdbea490 100644 +--- a/arch/hexagon/kernel/vm_entry.S ++++ b/arch/hexagon/kernel/vm_entry.S +@@ -369,7 +369,7 @@ ret_from_fork: + R26.L = #LO(do_work_pending); + R0 = #VM_INT_DISABLE; + } +- if P0 jump check_work_pending ++ if (P0) jump check_work_pending + { + R0 = R25; + callr R24 +diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile +index 172801ed35b8..d859f079b771 100644 +--- a/arch/mips/boot/compressed/Makefile ++++ b/arch/mips/boot/compressed/Makefile +@@ -29,6 +29,9 @@ KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY__ \ + -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \ + -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS) + ++# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in. ++KCOV_INSTRUMENT := n ++ + # decompressor objects (linked with vmlinuz) + vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o + +diff --git a/arch/mips/include/asm/vdso/gettimeofday.h b/arch/mips/include/asm/vdso/gettimeofday.h +index b08825531e9f..0ae9b4cbc153 100644 +--- a/arch/mips/include/asm/vdso/gettimeofday.h ++++ b/arch/mips/include/asm/vdso/gettimeofday.h +@@ -26,8 +26,6 @@ + + #define __VDSO_USE_SYSCALL ULLONG_MAX + +-#ifdef CONFIG_MIPS_CLOCK_VSYSCALL +- + static __always_inline long gettimeofday_fallback( + struct __kernel_old_timeval *_tv, + struct timezone *_tz) +@@ -48,17 +46,6 @@ static __always_inline long gettimeofday_fallback( + return error ? -ret : ret; + } + +-#else +- +-static __always_inline long gettimeofday_fallback( +- struct __kernel_old_timeval *_tv, +- struct timezone *_tz) +-{ +- return -1; +-} +- +-#endif +- + static __always_inline long clock_gettime_fallback( + clockid_t _clkid, + struct __kernel_timespec *_ts) +diff --git a/arch/mips/kernel/cacheinfo.c b/arch/mips/kernel/cacheinfo.c +index f777e44653d5..47312c529410 100644 +--- a/arch/mips/kernel/cacheinfo.c ++++ b/arch/mips/kernel/cacheinfo.c +@@ -50,6 +50,25 @@ static int __init_cache_level(unsigned int cpu) + return 0; + } + ++static void fill_cpumask_siblings(int cpu, cpumask_t *cpu_map) ++{ ++ int cpu1; ++ ++ for_each_possible_cpu(cpu1) ++ if (cpus_are_siblings(cpu, cpu1)) ++ cpumask_set_cpu(cpu1, cpu_map); ++} ++ ++static void fill_cpumask_cluster(int cpu, cpumask_t *cpu_map) ++{ ++ int cpu1; ++ int cluster = cpu_cluster(&cpu_data[cpu]); ++ ++ for_each_possible_cpu(cpu1) ++ if (cpu_cluster(&cpu_data[cpu1]) == cluster) ++ cpumask_set_cpu(cpu1, cpu_map); ++} ++ + static int __populate_cache_leaves(unsigned int cpu) + { + struct cpuinfo_mips *c = ¤t_cpu_data; +@@ -57,14 +76,20 @@ static int __populate_cache_leaves(unsigned int cpu) + struct cacheinfo *this_leaf = this_cpu_ci->info_list; + + if (c->icache.waysize) { ++ /* L1 caches are per core */ ++ fill_cpumask_siblings(cpu, &this_leaf->shared_cpu_map); + populate_cache(dcache, this_leaf, 1, CACHE_TYPE_DATA); ++ fill_cpumask_siblings(cpu, &this_leaf->shared_cpu_map); + populate_cache(icache, this_leaf, 1, CACHE_TYPE_INST); + } else { + populate_cache(dcache, this_leaf, 1, CACHE_TYPE_UNIFIED); + } + +- if (c->scache.waysize) ++ if (c->scache.waysize) { ++ /* L2 cache is per cluster */ ++ fill_cpumask_cluster(cpu, &this_leaf->shared_cpu_map); + populate_cache(scache, this_leaf, 2, CACHE_TYPE_UNIFIED); ++ } + + if (c->tcache.waysize) + populate_cache(tcache, this_leaf, 3, CACHE_TYPE_UNIFIED); +diff --git a/arch/mips/pci/pci-xtalk-bridge.c b/arch/mips/pci/pci-xtalk-bridge.c +index 7b4d40354ee7..30017d5945bc 100644 +--- a/arch/mips/pci/pci-xtalk-bridge.c ++++ b/arch/mips/pci/pci-xtalk-bridge.c +@@ -279,16 +279,15 @@ static int bridge_set_affinity(struct irq_data *d, const struct cpumask *mask, + struct bridge_irq_chip_data *data = d->chip_data; + int bit = d->parent_data->hwirq; + int pin = d->hwirq; +- nasid_t nasid; + int ret, cpu; + + ret = irq_chip_set_affinity_parent(d, mask, force); + if (ret >= 0) { + cpu = cpumask_first_and(mask, cpu_online_mask); +- nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu)); ++ data->nnasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu)); + bridge_write(data->bc, b_int_addr[pin].addr, + (((data->bc->intr_addr >> 30) & 0x30000) | +- bit | (nasid << 8))); ++ bit | (data->nasid << 8))); + bridge_read(data->bc, b_wid_tflush); + } + return ret; +diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c +index 37be04975831..79a2f6bd2b5a 100644 +--- a/arch/mips/sgi-ip27/ip27-irq.c ++++ b/arch/mips/sgi-ip27/ip27-irq.c +@@ -73,6 +73,9 @@ static void setup_hub_mask(struct hub_irq_data *hd, const struct cpumask *mask) + int cpu; + + cpu = cpumask_first_and(mask, cpu_online_mask); ++ if (cpu >= nr_cpu_ids) ++ cpu = cpumask_any(cpu_online_mask); ++ + nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu)); + hd->cpu = cpu; + if (!cputoslice(cpu)) { +@@ -139,6 +142,7 @@ static int hub_domain_alloc(struct irq_domain *domain, unsigned int virq, + /* use CPU connected to nearest hub */ + hub = hub_data(NASID_TO_COMPACT_NODEID(info->nasid)); + setup_hub_mask(hd, &hub->h_cpus); ++ info->nasid = cpu_to_node(hd->cpu); + + /* Make sure it's not already pending when we connect it. */ + REMOTE_HUB_CLR_INTR(info->nasid, swlevel); +diff --git a/arch/mips/vdso/vgettimeofday.c b/arch/mips/vdso/vgettimeofday.c +index 6ebdc37c89fc..6b83b6376a4b 100644 +--- a/arch/mips/vdso/vgettimeofday.c ++++ b/arch/mips/vdso/vgettimeofday.c +@@ -17,12 +17,22 @@ int __vdso_clock_gettime(clockid_t clock, + return __cvdso_clock_gettime32(clock, ts); + } + ++#ifdef CONFIG_MIPS_CLOCK_VSYSCALL ++ ++/* ++ * This is behind the ifdef so that we don't provide the symbol when there's no ++ * possibility of there being a usable clocksource, because there's nothing we ++ * can do without it. When libc fails the symbol lookup it should fall back on ++ * the standard syscall path. ++ */ + int __vdso_gettimeofday(struct __kernel_old_timeval *tv, + struct timezone *tz) + { + return __cvdso_gettimeofday(tv, tz); + } + ++#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */ ++ + int __vdso_clock_getres(clockid_t clock_id, + struct old_timespec32 *res) + { +@@ -43,12 +53,22 @@ int __vdso_clock_gettime(clockid_t clock, + return __cvdso_clock_gettime(clock, ts); + } + ++#ifdef CONFIG_MIPS_CLOCK_VSYSCALL ++ ++/* ++ * This is behind the ifdef so that we don't provide the symbol when there's no ++ * possibility of there being a usable clocksource, because there's nothing we ++ * can do without it. When libc fails the symbol lookup it should fall back on ++ * the standard syscall path. ++ */ + int __vdso_gettimeofday(struct __kernel_old_timeval *tv, + struct timezone *tz) + { + return __cvdso_gettimeofday(tv, tz); + } + ++#endif /* CONFIG_MIPS_CLOCK_VSYSCALL */ ++ + int __vdso_clock_getres(clockid_t clock_id, + struct __kernel_timespec *res) + { +diff --git a/arch/nds32/include/asm/cacheflush.h b/arch/nds32/include/asm/cacheflush.h +index d9ac7e6408ef..caddded56e77 100644 +--- a/arch/nds32/include/asm/cacheflush.h ++++ b/arch/nds32/include/asm/cacheflush.h +@@ -9,7 +9,11 @@ + #define PG_dcache_dirty PG_arch_1 + + void flush_icache_range(unsigned long start, unsigned long end); ++#define flush_icache_range flush_icache_range ++ + void flush_icache_page(struct vm_area_struct *vma, struct page *page); ++#define flush_icache_page flush_icache_page ++ + #ifdef CONFIG_CPU_CACHE_ALIASING + void flush_cache_mm(struct mm_struct *mm); + void flush_cache_dup_mm(struct mm_struct *mm); +@@ -40,12 +44,11 @@ void invalidate_kernel_vmap_range(void *addr, int size); + #define flush_dcache_mmap_unlock(mapping) xa_unlock_irq(&(mapping)->i_pages) + + #else +-#include +-#undef flush_icache_range +-#undef flush_icache_page +-#undef flush_icache_user_range + void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, + unsigned long addr, int len); ++#define flush_icache_user_range flush_icache_user_range ++ ++#include + #endif + + #endif /* __NDS32_CACHEFLUSH_H__ */ +diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c +index 2825d004dece..c0bea75ac27b 100644 +--- a/arch/powerpc/platforms/powernv/pci.c ++++ b/arch/powerpc/platforms/powernv/pci.c +@@ -945,6 +945,23 @@ void __init pnv_pci_init(void) + if (!firmware_has_feature(FW_FEATURE_OPAL)) + return; + ++#ifdef CONFIG_PCIEPORTBUS ++ /* ++ * On PowerNV PCIe devices are (currently) managed in cooperation ++ * with firmware. This isn't *strictly* required, but there's enough ++ * assumptions baked into both firmware and the platform code that ++ * it's unwise to allow the portbus services to be used. ++ * ++ * We need to fix this eventually, but for now set this flag to disable ++ * the portbus driver. The AER service isn't required since that AER ++ * events are handled via EEH. The pciehp hotplug driver can't work ++ * without kernel changes (and portbus binding breaks pnv_php). The ++ * other services also require some thinking about how we're going ++ * to integrate them. ++ */ ++ pcie_ports_disabled = true; ++#endif ++ + /* Look for IODA IO-Hubs. */ + for_each_compatible_node(np, NULL, "ibm,ioda-hub") { + pnv_pci_init_ioda_hub(np); +diff --git a/arch/riscv/mm/cacheflush.c b/arch/riscv/mm/cacheflush.c +index 3f15938dec89..c54bd3c79955 100644 +--- a/arch/riscv/mm/cacheflush.c ++++ b/arch/riscv/mm/cacheflush.c +@@ -14,6 +14,7 @@ void flush_icache_all(void) + { + sbi_remote_fence_i(NULL); + } ++EXPORT_SYMBOL(flush_icache_all); + + /* + * Performs an icache flush for the given MM context. RISC-V has no direct +diff --git a/arch/x86/entry/syscall_32.c b/arch/x86/entry/syscall_32.c +index aa3336a7cb15..7d17b3addbbb 100644 +--- a/arch/x86/entry/syscall_32.c ++++ b/arch/x86/entry/syscall_32.c +@@ -10,13 +10,11 @@ + #ifdef CONFIG_IA32_EMULATION + /* On X86_64, we use struct pt_regs * to pass parameters to syscalls */ + #define __SYSCALL_I386(nr, sym, qual) extern asmlinkage long sym(const struct pt_regs *); +- +-/* this is a lie, but it does not hurt as sys_ni_syscall just returns -EINVAL */ +-extern asmlinkage long sys_ni_syscall(const struct pt_regs *); +- ++#define __sys_ni_syscall __ia32_sys_ni_syscall + #else /* CONFIG_IA32_EMULATION */ + #define __SYSCALL_I386(nr, sym, qual) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); + extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); ++#define __sys_ni_syscall sys_ni_syscall + #endif /* CONFIG_IA32_EMULATION */ + + #include +@@ -29,6 +27,6 @@ __visible const sys_call_ptr_t ia32_sys_call_table[__NR_syscall_compat_max+1] = + * Smells like a compiler bug -- it doesn't work + * when the & below is removed. + */ +- [0 ... __NR_syscall_compat_max] = &sys_ni_syscall, ++ [0 ... __NR_syscall_compat_max] = &__sys_ni_syscall, + #include + }; +diff --git a/arch/x86/entry/syscall_64.c b/arch/x86/entry/syscall_64.c +index b1bf31713374..adf619a856e8 100644 +--- a/arch/x86/entry/syscall_64.c ++++ b/arch/x86/entry/syscall_64.c +@@ -4,11 +4,17 @@ + #include + #include + #include ++#include + #include + #include + +-/* this is a lie, but it does not hurt as sys_ni_syscall just returns -EINVAL */ +-extern asmlinkage long sys_ni_syscall(const struct pt_regs *); ++extern asmlinkage long sys_ni_syscall(void); ++ ++SYSCALL_DEFINE0(ni_syscall) ++{ ++ return sys_ni_syscall(); ++} ++ + #define __SYSCALL_64(nr, sym, qual) extern asmlinkage long sym(const struct pt_regs *); + #define __SYSCALL_X32(nr, sym, qual) __SYSCALL_64(nr, sym, qual) + #include +@@ -23,7 +29,7 @@ asmlinkage const sys_call_ptr_t sys_call_table[__NR_syscall_max+1] = { + * Smells like a compiler bug -- it doesn't work + * when the & below is removed. + */ +- [0 ... __NR_syscall_max] = &sys_ni_syscall, ++ [0 ... __NR_syscall_max] = &__x64_sys_ni_syscall, + #include + }; + +@@ -40,7 +46,7 @@ asmlinkage const sys_call_ptr_t x32_sys_call_table[__NR_syscall_x32_max+1] = { + * Smells like a compiler bug -- it doesn't work + * when the & below is removed. + */ +- [0 ... __NR_syscall_x32_max] = &sys_ni_syscall, ++ [0 ... __NR_syscall_x32_max] = &__x64_sys_ni_syscall, + #include + }; + +diff --git a/arch/x86/entry/syscalls/syscall_32.tbl b/arch/x86/entry/syscalls/syscall_32.tbl +index 3fe02546aed3..15908eb9b17e 100644 +--- a/arch/x86/entry/syscalls/syscall_32.tbl ++++ b/arch/x86/entry/syscalls/syscall_32.tbl +@@ -124,13 +124,13 @@ + 110 i386 iopl sys_iopl __ia32_sys_iopl + 111 i386 vhangup sys_vhangup __ia32_sys_vhangup + 112 i386 idle +-113 i386 vm86old sys_vm86old sys_ni_syscall ++113 i386 vm86old sys_vm86old __ia32_sys_ni_syscall + 114 i386 wait4 sys_wait4 __ia32_compat_sys_wait4 + 115 i386 swapoff sys_swapoff __ia32_sys_swapoff + 116 i386 sysinfo sys_sysinfo __ia32_compat_sys_sysinfo + 117 i386 ipc sys_ipc __ia32_compat_sys_ipc + 118 i386 fsync sys_fsync __ia32_sys_fsync +-119 i386 sigreturn sys_sigreturn sys32_sigreturn ++119 i386 sigreturn sys_sigreturn __ia32_compat_sys_sigreturn + 120 i386 clone sys_clone __ia32_compat_sys_x86_clone + 121 i386 setdomainname sys_setdomainname __ia32_sys_setdomainname + 122 i386 uname sys_newuname __ia32_sys_newuname +@@ -177,14 +177,14 @@ + 163 i386 mremap sys_mremap __ia32_sys_mremap + 164 i386 setresuid sys_setresuid16 __ia32_sys_setresuid16 + 165 i386 getresuid sys_getresuid16 __ia32_sys_getresuid16 +-166 i386 vm86 sys_vm86 sys_ni_syscall ++166 i386 vm86 sys_vm86 __ia32_sys_ni_syscall + 167 i386 query_module + 168 i386 poll sys_poll __ia32_sys_poll + 169 i386 nfsservctl + 170 i386 setresgid sys_setresgid16 __ia32_sys_setresgid16 + 171 i386 getresgid sys_getresgid16 __ia32_sys_getresgid16 + 172 i386 prctl sys_prctl __ia32_sys_prctl +-173 i386 rt_sigreturn sys_rt_sigreturn sys32_rt_sigreturn ++173 i386 rt_sigreturn sys_rt_sigreturn __ia32_compat_sys_rt_sigreturn + 174 i386 rt_sigaction sys_rt_sigaction __ia32_compat_sys_rt_sigaction + 175 i386 rt_sigprocmask sys_rt_sigprocmask __ia32_compat_sys_rt_sigprocmask + 176 i386 rt_sigpending sys_rt_sigpending __ia32_compat_sys_rt_sigpending +diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c +index 1cee10091b9f..30416d7f19d4 100644 +--- a/arch/x86/ia32/ia32_signal.c ++++ b/arch/x86/ia32/ia32_signal.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -118,7 +119,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, + return err; + } + +-asmlinkage long sys32_sigreturn(void) ++COMPAT_SYSCALL_DEFINE0(sigreturn) + { + struct pt_regs *regs = current_pt_regs(); + struct sigframe_ia32 __user *frame = (struct sigframe_ia32 __user *)(regs->sp-8); +@@ -144,7 +145,7 @@ badframe: + return 0; + } + +-asmlinkage long sys32_rt_sigreturn(void) ++COMPAT_SYSCALL_DEFINE0(rt_sigreturn) + { + struct pt_regs *regs = current_pt_regs(); + struct rt_sigframe_ia32 __user *frame; +diff --git a/arch/x86/include/asm/syscall_wrapper.h b/arch/x86/include/asm/syscall_wrapper.h +index 90eb70df0b18..e2389ce9bf58 100644 +--- a/arch/x86/include/asm/syscall_wrapper.h ++++ b/arch/x86/include/asm/syscall_wrapper.h +@@ -6,6 +6,8 @@ + #ifndef _ASM_X86_SYSCALL_WRAPPER_H + #define _ASM_X86_SYSCALL_WRAPPER_H + ++struct pt_regs; ++ + /* Mapping of registers to parameters for syscalls on x86-64 and x32 */ + #define SC_X86_64_REGS_TO_ARGS(x, ...) \ + __MAP(x,__SC_ARGS \ +@@ -28,13 +30,21 @@ + * kernel/sys_ni.c and SYS_NI in kernel/time/posix-stubs.c to cover this + * case as well. + */ ++#define __IA32_COMPAT_SYS_STUB0(x, name) \ ++ asmlinkage long __ia32_compat_sys_##name(const struct pt_regs *regs);\ ++ ALLOW_ERROR_INJECTION(__ia32_compat_sys_##name, ERRNO); \ ++ asmlinkage long __ia32_compat_sys_##name(const struct pt_regs *regs)\ ++ { \ ++ return __se_compat_sys_##name(); \ ++ } ++ + #define __IA32_COMPAT_SYS_STUBx(x, name, ...) \ + asmlinkage long __ia32_compat_sys##name(const struct pt_regs *regs);\ + ALLOW_ERROR_INJECTION(__ia32_compat_sys##name, ERRNO); \ + asmlinkage long __ia32_compat_sys##name(const struct pt_regs *regs)\ + { \ + return __se_compat_sys##name(SC_IA32_REGS_TO_ARGS(x,__VA_ARGS__));\ +- } \ ++ } + + #define __IA32_SYS_STUBx(x, name, ...) \ + asmlinkage long __ia32_sys##name(const struct pt_regs *regs); \ +@@ -56,9 +66,15 @@ + SYSCALL_ALIAS(__ia32_sys_##sname, __x64_sys_##sname); \ + asmlinkage long __x64_sys_##sname(const struct pt_regs *__unused) + +-#define COND_SYSCALL(name) \ +- cond_syscall(__x64_sys_##name); \ +- cond_syscall(__ia32_sys_##name) ++#define COND_SYSCALL(name) \ ++ asmlinkage __weak long __x64_sys_##name(const struct pt_regs *__unused) \ ++ { \ ++ return sys_ni_syscall(); \ ++ } \ ++ asmlinkage __weak long __ia32_sys_##name(const struct pt_regs *__unused)\ ++ { \ ++ return sys_ni_syscall(); \ ++ } + + #define SYS_NI(name) \ + SYSCALL_ALIAS(__x64_sys_##name, sys_ni_posix_timers); \ +@@ -76,15 +92,24 @@ + * of the x86-64-style parameter ordering of x32 syscalls. The syscalls common + * with x86_64 obviously do not need such care. + */ ++#define __X32_COMPAT_SYS_STUB0(x, name, ...) \ ++ asmlinkage long __x32_compat_sys_##name(const struct pt_regs *regs);\ ++ ALLOW_ERROR_INJECTION(__x32_compat_sys_##name, ERRNO); \ ++ asmlinkage long __x32_compat_sys_##name(const struct pt_regs *regs)\ ++ { \ ++ return __se_compat_sys_##name();\ ++ } ++ + #define __X32_COMPAT_SYS_STUBx(x, name, ...) \ + asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs);\ + ALLOW_ERROR_INJECTION(__x32_compat_sys##name, ERRNO); \ + asmlinkage long __x32_compat_sys##name(const struct pt_regs *regs)\ + { \ + return __se_compat_sys##name(SC_X86_64_REGS_TO_ARGS(x,__VA_ARGS__));\ +- } \ ++ } + + #else /* CONFIG_X86_X32 */ ++#define __X32_COMPAT_SYS_STUB0(x, name) + #define __X32_COMPAT_SYS_STUBx(x, name, ...) + #endif /* CONFIG_X86_X32 */ + +@@ -95,6 +120,17 @@ + * mapping of registers to parameters, we need to generate stubs for each + * of them. + */ ++#define COMPAT_SYSCALL_DEFINE0(name) \ ++ static long __se_compat_sys_##name(void); \ ++ static inline long __do_compat_sys_##name(void); \ ++ __IA32_COMPAT_SYS_STUB0(x, name) \ ++ __X32_COMPAT_SYS_STUB0(x, name) \ ++ static long __se_compat_sys_##name(void) \ ++ { \ ++ return __do_compat_sys_##name(); \ ++ } \ ++ static inline long __do_compat_sys_##name(void) ++ + #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ + static long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \ + static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ +@@ -190,7 +226,11 @@ + #endif + + #ifndef COND_SYSCALL +-#define COND_SYSCALL(name) cond_syscall(__x64_sys_##name) ++#define COND_SYSCALL(name) \ ++ asmlinkage __weak long __x64_sys_##name(const struct pt_regs *__unused) \ ++ { \ ++ return sys_ni_syscall(); \ ++ } + #endif + + #ifndef SYS_NI +@@ -202,7 +242,6 @@ + * For VSYSCALLS, we need to declare these three syscalls with the new + * pt_regs-based calling convention for in-kernel use. + */ +-struct pt_regs; + asmlinkage long __x64_sys_getcpu(const struct pt_regs *regs); + asmlinkage long __x64_sys_gettimeofday(const struct pt_regs *regs); + asmlinkage long __x64_sys_time(const struct pt_regs *regs); +diff --git a/block/bio.c b/block/bio.c +index c822ceb7c4de..906da3581a3e 100644 +--- a/block/bio.c ++++ b/block/bio.c +@@ -535,6 +535,16 @@ void zero_fill_bio_iter(struct bio *bio, struct bvec_iter start) + } + EXPORT_SYMBOL(zero_fill_bio_iter); + ++/** ++ * bio_truncate - truncate the bio to small size of @new_size ++ * @bio: the bio to be truncated ++ * @new_size: new size for truncating the bio ++ * ++ * Description: ++ * Truncate the bio to new size of @new_size. If bio_op(bio) is ++ * REQ_OP_READ, zero the truncated part. This function should only ++ * be used for handling corner cases, such as bio eod. ++ */ + void bio_truncate(struct bio *bio, unsigned new_size) + { + struct bio_vec bv; +@@ -545,7 +555,7 @@ void bio_truncate(struct bio *bio, unsigned new_size) + if (new_size >= bio->bi_iter.bi_size) + return; + +- if (bio_data_dir(bio) != READ) ++ if (bio_op(bio) != REQ_OP_READ) + goto exit; + + bio_for_each_segment(bv, bio, iter) { +diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c +index c1601edd70e3..e2c8ab408bed 100644 +--- a/crypto/algif_skcipher.c ++++ b/crypto/algif_skcipher.c +@@ -56,7 +56,7 @@ static int _skcipher_recvmsg(struct socket *sock, struct msghdr *msg, + struct alg_sock *pask = alg_sk(psk); + struct af_alg_ctx *ctx = ask->private; + struct crypto_skcipher *tfm = pask->private; +- unsigned int bs = crypto_skcipher_blocksize(tfm); ++ unsigned int bs = crypto_skcipher_chunksize(tfm); + struct af_alg_async_req *areq; + int err = 0; + size_t len = 0; +diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c +index 27a95c86a80b..4fc294c2f9e8 100644 +--- a/drivers/clk/clk.c ++++ b/drivers/clk/clk.c +@@ -3886,6 +3886,7 @@ void clk_unregister(struct clk *clk) + __func__, clk->core->name); + + kref_put(&clk->core->ref, __clk_release); ++ free_clk(clk); + unlock: + clk_prepare_unlock(); + } +diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c +index d43b4a3c0de8..047f1d8fe323 100644 +--- a/drivers/clk/imx/clk-pll14xx.c ++++ b/drivers/clk/imx/clk-pll14xx.c +@@ -112,43 +112,17 @@ static unsigned long clk_pll1443x_recalc_rate(struct clk_hw *hw, + return fvco; + } + +-static inline bool clk_pll1416x_mp_change(const struct imx_pll14xx_rate_table *rate, ++static inline bool clk_pll14xx_mp_change(const struct imx_pll14xx_rate_table *rate, + u32 pll_div) + { + u32 old_mdiv, old_pdiv; + +- old_mdiv = (pll_div >> MDIV_SHIFT) & MDIV_MASK; +- old_pdiv = (pll_div >> PDIV_SHIFT) & PDIV_MASK; ++ old_mdiv = (pll_div & MDIV_MASK) >> MDIV_SHIFT; ++ old_pdiv = (pll_div & PDIV_MASK) >> PDIV_SHIFT; + + return rate->mdiv != old_mdiv || rate->pdiv != old_pdiv; + } + +-static inline bool clk_pll1443x_mpk_change(const struct imx_pll14xx_rate_table *rate, +- u32 pll_div_ctl0, u32 pll_div_ctl1) +-{ +- u32 old_mdiv, old_pdiv, old_kdiv; +- +- old_mdiv = (pll_div_ctl0 >> MDIV_SHIFT) & MDIV_MASK; +- old_pdiv = (pll_div_ctl0 >> PDIV_SHIFT) & PDIV_MASK; +- old_kdiv = (pll_div_ctl1 >> KDIV_SHIFT) & KDIV_MASK; +- +- return rate->mdiv != old_mdiv || rate->pdiv != old_pdiv || +- rate->kdiv != old_kdiv; +-} +- +-static inline bool clk_pll1443x_mp_change(const struct imx_pll14xx_rate_table *rate, +- u32 pll_div_ctl0, u32 pll_div_ctl1) +-{ +- u32 old_mdiv, old_pdiv, old_kdiv; +- +- old_mdiv = (pll_div_ctl0 >> MDIV_SHIFT) & MDIV_MASK; +- old_pdiv = (pll_div_ctl0 >> PDIV_SHIFT) & PDIV_MASK; +- old_kdiv = (pll_div_ctl1 >> KDIV_SHIFT) & KDIV_MASK; +- +- return rate->mdiv != old_mdiv || rate->pdiv != old_pdiv || +- rate->kdiv != old_kdiv; +-} +- + static int clk_pll14xx_wait_lock(struct clk_pll14xx *pll) + { + u32 val; +@@ -174,7 +148,7 @@ static int clk_pll1416x_set_rate(struct clk_hw *hw, unsigned long drate, + + tmp = readl_relaxed(pll->base + 4); + +- if (!clk_pll1416x_mp_change(rate, tmp)) { ++ if (!clk_pll14xx_mp_change(rate, tmp)) { + tmp &= ~(SDIV_MASK) << SDIV_SHIFT; + tmp |= rate->sdiv << SDIV_SHIFT; + writel_relaxed(tmp, pll->base + 4); +@@ -239,13 +213,15 @@ static int clk_pll1443x_set_rate(struct clk_hw *hw, unsigned long drate, + } + + tmp = readl_relaxed(pll->base + 4); +- div_val = readl_relaxed(pll->base + 8); + +- if (!clk_pll1443x_mpk_change(rate, tmp, div_val)) { ++ if (!clk_pll14xx_mp_change(rate, tmp)) { + tmp &= ~(SDIV_MASK) << SDIV_SHIFT; + tmp |= rate->sdiv << SDIV_SHIFT; + writel_relaxed(tmp, pll->base + 4); + ++ tmp = rate->kdiv << KDIV_SHIFT; ++ writel_relaxed(tmp, pll->base + 8); ++ + return 0; + } + +diff --git a/drivers/clk/meson/axg-audio.c b/drivers/clk/meson/axg-audio.c +index 18b23cdf679c..aa2522624fd3 100644 +--- a/drivers/clk/meson/axg-audio.c ++++ b/drivers/clk/meson/axg-audio.c +@@ -1001,7 +1001,7 @@ static const struct regmap_config axg_audio_regmap_cfg = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +- .max_register = AUDIO_CLK_PDMIN_CTRL1, ++ .max_register = AUDIO_CLK_SPDIFOUT_B_CTRL, + }; + + struct audioclk_data { +diff --git a/drivers/crypto/cavium/nitrox/nitrox_main.c b/drivers/crypto/cavium/nitrox/nitrox_main.c +index bc924980e10c..c4632d84c9a1 100644 +--- a/drivers/crypto/cavium/nitrox/nitrox_main.c ++++ b/drivers/crypto/cavium/nitrox/nitrox_main.c +@@ -103,8 +103,7 @@ static void write_to_ucd_unit(struct nitrox_device *ndev, u32 ucode_size, + offset = UCD_UCODE_LOAD_BLOCK_NUM; + nitrox_write_csr(ndev, offset, block_num); + +- code_size = ucode_size; +- code_size = roundup(code_size, 8); ++ code_size = roundup(ucode_size, 16); + while (code_size) { + data = ucode_data[i]; + /* write 8 bytes at a time */ +@@ -220,11 +219,11 @@ static int nitrox_load_fw(struct nitrox_device *ndev) + + /* write block number and firmware length + * bit:<2:0> block number +- * bit:3 is set SE uses 32KB microcode +- * bit:3 is clear SE uses 64KB microcode ++ * bit:3 is set AE uses 32KB microcode ++ * bit:3 is clear AE uses 64KB microcode + */ + core_2_eid_val.value = 0ULL; +- core_2_eid_val.ucode_blk = 0; ++ core_2_eid_val.ucode_blk = 2; + if (ucode_size <= CNN55XX_UCD_BLOCK_SIZE) + core_2_eid_val.ucode_len = 1; + else +diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c +index 940485112d15..73a899e6f837 100644 +--- a/drivers/crypto/geode-aes.c ++++ b/drivers/crypto/geode-aes.c +@@ -10,7 +10,7 @@ + #include + #include + #include +-#include ++#include + + #include + #include +@@ -24,12 +24,12 @@ static spinlock_t lock; + + /* Write a 128 bit field (either a writable key or IV) */ + static inline void +-_writefield(u32 offset, void *value) ++_writefield(u32 offset, const void *value) + { + int i; + + for (i = 0; i < 4; i++) +- iowrite32(((u32 *) value)[i], _iobase + offset + (i * 4)); ++ iowrite32(((const u32 *) value)[i], _iobase + offset + (i * 4)); + } + + /* Read a 128 bit field (either a writable key or IV) */ +@@ -43,12 +43,12 @@ _readfield(u32 offset, void *value) + } + + static int +-do_crypt(void *src, void *dst, int len, u32 flags) ++do_crypt(const void *src, void *dst, u32 len, u32 flags) + { + u32 status; + u32 counter = AES_OP_TIMEOUT; + +- iowrite32(virt_to_phys(src), _iobase + AES_SOURCEA_REG); ++ iowrite32(virt_to_phys((void *)src), _iobase + AES_SOURCEA_REG); + iowrite32(virt_to_phys(dst), _iobase + AES_DSTA_REG); + iowrite32(len, _iobase + AES_LENA_REG); + +@@ -65,16 +65,14 @@ do_crypt(void *src, void *dst, int len, u32 flags) + return counter ? 0 : 1; + } + +-static unsigned int +-geode_aes_crypt(struct geode_aes_op *op) ++static void ++geode_aes_crypt(const struct geode_aes_tfm_ctx *tctx, const void *src, ++ void *dst, u32 len, u8 *iv, int mode, int dir) + { + u32 flags = 0; + unsigned long iflags; + int ret; + +- if (op->len == 0) +- return 0; +- + /* If the source and destination is the same, then + * we need to turn on the coherent flags, otherwise + * we don't need to worry +@@ -82,32 +80,28 @@ geode_aes_crypt(struct geode_aes_op *op) + + flags |= (AES_CTRL_DCA | AES_CTRL_SCA); + +- if (op->dir == AES_DIR_ENCRYPT) ++ if (dir == AES_DIR_ENCRYPT) + flags |= AES_CTRL_ENCRYPT; + + /* Start the critical section */ + + spin_lock_irqsave(&lock, iflags); + +- if (op->mode == AES_MODE_CBC) { ++ if (mode == AES_MODE_CBC) { + flags |= AES_CTRL_CBC; +- _writefield(AES_WRITEIV0_REG, op->iv); ++ _writefield(AES_WRITEIV0_REG, iv); + } + +- if (!(op->flags & AES_FLAGS_HIDDENKEY)) { +- flags |= AES_CTRL_WRKEY; +- _writefield(AES_WRITEKEY0_REG, op->key); +- } ++ flags |= AES_CTRL_WRKEY; ++ _writefield(AES_WRITEKEY0_REG, tctx->key); + +- ret = do_crypt(op->src, op->dst, op->len, flags); ++ ret = do_crypt(src, dst, len, flags); + BUG_ON(ret); + +- if (op->mode == AES_MODE_CBC) +- _readfield(AES_WRITEIV0_REG, op->iv); ++ if (mode == AES_MODE_CBC) ++ _readfield(AES_WRITEIV0_REG, iv); + + spin_unlock_irqrestore(&lock, iflags); +- +- return op->len; + } + + /* CRYPTO-API Functions */ +@@ -115,13 +109,13 @@ geode_aes_crypt(struct geode_aes_op *op) + static int geode_setkey_cip(struct crypto_tfm *tfm, const u8 *key, + unsigned int len) + { +- struct geode_aes_op *op = crypto_tfm_ctx(tfm); ++ struct geode_aes_tfm_ctx *tctx = crypto_tfm_ctx(tfm); + unsigned int ret; + +- op->keylen = len; ++ tctx->keylen = len; + + if (len == AES_KEYSIZE_128) { +- memcpy(op->key, key, len); ++ memcpy(tctx->key, key, len); + return 0; + } + +@@ -134,132 +128,93 @@ static int geode_setkey_cip(struct crypto_tfm *tfm, const u8 *key, + /* + * The requested key size is not supported by HW, do a fallback + */ +- op->fallback.cip->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; +- op->fallback.cip->base.crt_flags |= (tfm->crt_flags & CRYPTO_TFM_REQ_MASK); ++ tctx->fallback.cip->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; ++ tctx->fallback.cip->base.crt_flags |= ++ (tfm->crt_flags & CRYPTO_TFM_REQ_MASK); + +- ret = crypto_cipher_setkey(op->fallback.cip, key, len); ++ ret = crypto_cipher_setkey(tctx->fallback.cip, key, len); + if (ret) { + tfm->crt_flags &= ~CRYPTO_TFM_RES_MASK; +- tfm->crt_flags |= (op->fallback.cip->base.crt_flags & CRYPTO_TFM_RES_MASK); ++ tfm->crt_flags |= (tctx->fallback.cip->base.crt_flags & ++ CRYPTO_TFM_RES_MASK); + } + return ret; + } + +-static int geode_setkey_blk(struct crypto_tfm *tfm, const u8 *key, +- unsigned int len) ++static int geode_setkey_skcipher(struct crypto_skcipher *tfm, const u8 *key, ++ unsigned int len) + { +- struct geode_aes_op *op = crypto_tfm_ctx(tfm); ++ struct geode_aes_tfm_ctx *tctx = crypto_skcipher_ctx(tfm); + unsigned int ret; + +- op->keylen = len; ++ tctx->keylen = len; + + if (len == AES_KEYSIZE_128) { +- memcpy(op->key, key, len); ++ memcpy(tctx->key, key, len); + return 0; + } + + if (len != AES_KEYSIZE_192 && len != AES_KEYSIZE_256) { + /* not supported at all */ +- tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; ++ crypto_skcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); + return -EINVAL; + } + + /* + * The requested key size is not supported by HW, do a fallback + */ +- crypto_sync_skcipher_clear_flags(op->fallback.blk, CRYPTO_TFM_REQ_MASK); +- crypto_sync_skcipher_set_flags(op->fallback.blk, +- tfm->crt_flags & CRYPTO_TFM_REQ_MASK); +- +- ret = crypto_sync_skcipher_setkey(op->fallback.blk, key, len); +- if (ret) { +- tfm->crt_flags &= ~CRYPTO_TFM_RES_MASK; +- tfm->crt_flags |= crypto_sync_skcipher_get_flags(op->fallback.blk) & +- CRYPTO_TFM_RES_MASK; +- } ++ crypto_skcipher_clear_flags(tctx->fallback.skcipher, ++ CRYPTO_TFM_REQ_MASK); ++ crypto_skcipher_set_flags(tctx->fallback.skcipher, ++ crypto_skcipher_get_flags(tfm) & ++ CRYPTO_TFM_REQ_MASK); ++ ret = crypto_skcipher_setkey(tctx->fallback.skcipher, key, len); ++ crypto_skcipher_set_flags(tfm, ++ crypto_skcipher_get_flags(tctx->fallback.skcipher) & ++ CRYPTO_TFM_RES_MASK); + return ret; + } + +-static int fallback_blk_dec(struct blkcipher_desc *desc, +- struct scatterlist *dst, struct scatterlist *src, +- unsigned int nbytes) +-{ +- struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); +- SYNC_SKCIPHER_REQUEST_ON_STACK(req, op->fallback.blk); +- +- skcipher_request_set_sync_tfm(req, op->fallback.blk); +- skcipher_request_set_callback(req, 0, NULL, NULL); +- skcipher_request_set_crypt(req, src, dst, nbytes, desc->info); +- +- return crypto_skcipher_decrypt(req); +-} +- +-static int fallback_blk_enc(struct blkcipher_desc *desc, +- struct scatterlist *dst, struct scatterlist *src, +- unsigned int nbytes) +-{ +- struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); +- SYNC_SKCIPHER_REQUEST_ON_STACK(req, op->fallback.blk); +- +- skcipher_request_set_sync_tfm(req, op->fallback.blk); +- skcipher_request_set_callback(req, 0, NULL, NULL); +- skcipher_request_set_crypt(req, src, dst, nbytes, desc->info); +- +- return crypto_skcipher_encrypt(req); +-} +- + static void + geode_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) + { +- struct geode_aes_op *op = crypto_tfm_ctx(tfm); ++ const struct geode_aes_tfm_ctx *tctx = crypto_tfm_ctx(tfm); + +- if (unlikely(op->keylen != AES_KEYSIZE_128)) { +- crypto_cipher_encrypt_one(op->fallback.cip, out, in); ++ if (unlikely(tctx->keylen != AES_KEYSIZE_128)) { ++ crypto_cipher_encrypt_one(tctx->fallback.cip, out, in); + return; + } + +- op->src = (void *) in; +- op->dst = (void *) out; +- op->mode = AES_MODE_ECB; +- op->flags = 0; +- op->len = AES_BLOCK_SIZE; +- op->dir = AES_DIR_ENCRYPT; +- +- geode_aes_crypt(op); ++ geode_aes_crypt(tctx, in, out, AES_BLOCK_SIZE, NULL, ++ AES_MODE_ECB, AES_DIR_ENCRYPT); + } + + + static void + geode_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) + { +- struct geode_aes_op *op = crypto_tfm_ctx(tfm); ++ const struct geode_aes_tfm_ctx *tctx = crypto_tfm_ctx(tfm); + +- if (unlikely(op->keylen != AES_KEYSIZE_128)) { +- crypto_cipher_decrypt_one(op->fallback.cip, out, in); ++ if (unlikely(tctx->keylen != AES_KEYSIZE_128)) { ++ crypto_cipher_decrypt_one(tctx->fallback.cip, out, in); + return; + } + +- op->src = (void *) in; +- op->dst = (void *) out; +- op->mode = AES_MODE_ECB; +- op->flags = 0; +- op->len = AES_BLOCK_SIZE; +- op->dir = AES_DIR_DECRYPT; +- +- geode_aes_crypt(op); ++ geode_aes_crypt(tctx, in, out, AES_BLOCK_SIZE, NULL, ++ AES_MODE_ECB, AES_DIR_DECRYPT); + } + + static int fallback_init_cip(struct crypto_tfm *tfm) + { + const char *name = crypto_tfm_alg_name(tfm); +- struct geode_aes_op *op = crypto_tfm_ctx(tfm); ++ struct geode_aes_tfm_ctx *tctx = crypto_tfm_ctx(tfm); + +- op->fallback.cip = crypto_alloc_cipher(name, 0, +- CRYPTO_ALG_NEED_FALLBACK); ++ tctx->fallback.cip = crypto_alloc_cipher(name, 0, ++ CRYPTO_ALG_NEED_FALLBACK); + +- if (IS_ERR(op->fallback.cip)) { ++ if (IS_ERR(tctx->fallback.cip)) { + printk(KERN_ERR "Error allocating fallback algo %s\n", name); +- return PTR_ERR(op->fallback.cip); ++ return PTR_ERR(tctx->fallback.cip); + } + + return 0; +@@ -267,10 +222,9 @@ static int fallback_init_cip(struct crypto_tfm *tfm) + + static void fallback_exit_cip(struct crypto_tfm *tfm) + { +- struct geode_aes_op *op = crypto_tfm_ctx(tfm); ++ struct geode_aes_tfm_ctx *tctx = crypto_tfm_ctx(tfm); + +- crypto_free_cipher(op->fallback.cip); +- op->fallback.cip = NULL; ++ crypto_free_cipher(tctx->fallback.cip); + } + + static struct crypto_alg geode_alg = { +@@ -283,7 +237,7 @@ static struct crypto_alg geode_alg = { + .cra_init = fallback_init_cip, + .cra_exit = fallback_exit_cip, + .cra_blocksize = AES_BLOCK_SIZE, +- .cra_ctxsize = sizeof(struct geode_aes_op), ++ .cra_ctxsize = sizeof(struct geode_aes_tfm_ctx), + .cra_module = THIS_MODULE, + .cra_u = { + .cipher = { +@@ -296,220 +250,126 @@ static struct crypto_alg geode_alg = { + } + }; + +-static int +-geode_cbc_decrypt(struct blkcipher_desc *desc, +- struct scatterlist *dst, struct scatterlist *src, +- unsigned int nbytes) ++static int geode_init_skcipher(struct crypto_skcipher *tfm) + { +- struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); +- struct blkcipher_walk walk; +- int err, ret; +- +- if (nbytes % AES_BLOCK_SIZE) +- return -EINVAL; +- +- if (unlikely(op->keylen != AES_KEYSIZE_128)) +- return fallback_blk_dec(desc, dst, src, nbytes); ++ const char *name = crypto_tfm_alg_name(&tfm->base); ++ struct geode_aes_tfm_ctx *tctx = crypto_skcipher_ctx(tfm); + +- blkcipher_walk_init(&walk, dst, src, nbytes); +- err = blkcipher_walk_virt(desc, &walk); +- op->iv = walk.iv; +- +- while ((nbytes = walk.nbytes)) { +- op->src = walk.src.virt.addr, +- op->dst = walk.dst.virt.addr; +- op->mode = AES_MODE_CBC; +- op->len = nbytes - (nbytes % AES_BLOCK_SIZE); +- op->dir = AES_DIR_DECRYPT; +- +- ret = geode_aes_crypt(op); +- +- nbytes -= ret; +- err = blkcipher_walk_done(desc, &walk, nbytes); ++ tctx->fallback.skcipher = ++ crypto_alloc_skcipher(name, 0, CRYPTO_ALG_NEED_FALLBACK | ++ CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tctx->fallback.skcipher)) { ++ printk(KERN_ERR "Error allocating fallback algo %s\n", name); ++ return PTR_ERR(tctx->fallback.skcipher); + } + +- return err; ++ crypto_skcipher_set_reqsize(tfm, sizeof(struct skcipher_request) + ++ crypto_skcipher_reqsize(tctx->fallback.skcipher)); ++ return 0; + } + +-static int +-geode_cbc_encrypt(struct blkcipher_desc *desc, +- struct scatterlist *dst, struct scatterlist *src, +- unsigned int nbytes) ++static void geode_exit_skcipher(struct crypto_skcipher *tfm) + { +- struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); +- struct blkcipher_walk walk; +- int err, ret; ++ struct geode_aes_tfm_ctx *tctx = crypto_skcipher_ctx(tfm); + +- if (nbytes % AES_BLOCK_SIZE) +- return -EINVAL; +- +- if (unlikely(op->keylen != AES_KEYSIZE_128)) +- return fallback_blk_enc(desc, dst, src, nbytes); ++ crypto_free_skcipher(tctx->fallback.skcipher); ++} + +- blkcipher_walk_init(&walk, dst, src, nbytes); +- err = blkcipher_walk_virt(desc, &walk); +- op->iv = walk.iv; ++static int geode_skcipher_crypt(struct skcipher_request *req, int mode, int dir) ++{ ++ struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); ++ const struct geode_aes_tfm_ctx *tctx = crypto_skcipher_ctx(tfm); ++ struct skcipher_walk walk; ++ unsigned int nbytes; ++ int err; ++ ++ if (unlikely(tctx->keylen != AES_KEYSIZE_128)) { ++ struct skcipher_request *subreq = skcipher_request_ctx(req); ++ ++ *subreq = *req; ++ skcipher_request_set_tfm(subreq, tctx->fallback.skcipher); ++ if (dir == AES_DIR_DECRYPT) ++ return crypto_skcipher_decrypt(subreq); ++ else ++ return crypto_skcipher_encrypt(subreq); ++ } + +- while ((nbytes = walk.nbytes)) { +- op->src = walk.src.virt.addr, +- op->dst = walk.dst.virt.addr; +- op->mode = AES_MODE_CBC; +- op->len = nbytes - (nbytes % AES_BLOCK_SIZE); +- op->dir = AES_DIR_ENCRYPT; ++ err = skcipher_walk_virt(&walk, req, false); + +- ret = geode_aes_crypt(op); +- nbytes -= ret; +- err = blkcipher_walk_done(desc, &walk, nbytes); ++ while ((nbytes = walk.nbytes) != 0) { ++ geode_aes_crypt(tctx, walk.src.virt.addr, walk.dst.virt.addr, ++ round_down(nbytes, AES_BLOCK_SIZE), ++ walk.iv, mode, dir); ++ err = skcipher_walk_done(&walk, nbytes % AES_BLOCK_SIZE); + } + + return err; + } + +-static int fallback_init_blk(struct crypto_tfm *tfm) ++static int geode_cbc_encrypt(struct skcipher_request *req) + { +- const char *name = crypto_tfm_alg_name(tfm); +- struct geode_aes_op *op = crypto_tfm_ctx(tfm); +- +- op->fallback.blk = crypto_alloc_sync_skcipher(name, 0, +- CRYPTO_ALG_NEED_FALLBACK); +- if (IS_ERR(op->fallback.blk)) { +- printk(KERN_ERR "Error allocating fallback algo %s\n", name); +- return PTR_ERR(op->fallback.blk); +- } +- +- return 0; ++ return geode_skcipher_crypt(req, AES_MODE_CBC, AES_DIR_ENCRYPT); + } + +-static void fallback_exit_blk(struct crypto_tfm *tfm) ++static int geode_cbc_decrypt(struct skcipher_request *req) + { +- struct geode_aes_op *op = crypto_tfm_ctx(tfm); +- +- crypto_free_sync_skcipher(op->fallback.blk); +- op->fallback.blk = NULL; ++ return geode_skcipher_crypt(req, AES_MODE_CBC, AES_DIR_DECRYPT); + } + +-static struct crypto_alg geode_cbc_alg = { +- .cra_name = "cbc(aes)", +- .cra_driver_name = "cbc-aes-geode", +- .cra_priority = 400, +- .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | +- CRYPTO_ALG_KERN_DRIVER_ONLY | +- CRYPTO_ALG_NEED_FALLBACK, +- .cra_init = fallback_init_blk, +- .cra_exit = fallback_exit_blk, +- .cra_blocksize = AES_BLOCK_SIZE, +- .cra_ctxsize = sizeof(struct geode_aes_op), +- .cra_alignmask = 15, +- .cra_type = &crypto_blkcipher_type, +- .cra_module = THIS_MODULE, +- .cra_u = { +- .blkcipher = { +- .min_keysize = AES_MIN_KEY_SIZE, +- .max_keysize = AES_MAX_KEY_SIZE, +- .setkey = geode_setkey_blk, +- .encrypt = geode_cbc_encrypt, +- .decrypt = geode_cbc_decrypt, +- .ivsize = AES_BLOCK_SIZE, +- } +- } +-}; +- +-static int +-geode_ecb_decrypt(struct blkcipher_desc *desc, +- struct scatterlist *dst, struct scatterlist *src, +- unsigned int nbytes) ++static int geode_ecb_encrypt(struct skcipher_request *req) + { +- struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); +- struct blkcipher_walk walk; +- int err, ret; +- +- if (nbytes % AES_BLOCK_SIZE) +- return -EINVAL; +- +- if (unlikely(op->keylen != AES_KEYSIZE_128)) +- return fallback_blk_dec(desc, dst, src, nbytes); +- +- blkcipher_walk_init(&walk, dst, src, nbytes); +- err = blkcipher_walk_virt(desc, &walk); +- +- while ((nbytes = walk.nbytes)) { +- op->src = walk.src.virt.addr, +- op->dst = walk.dst.virt.addr; +- op->mode = AES_MODE_ECB; +- op->len = nbytes - (nbytes % AES_BLOCK_SIZE); +- op->dir = AES_DIR_DECRYPT; +- +- ret = geode_aes_crypt(op); +- nbytes -= ret; +- err = blkcipher_walk_done(desc, &walk, nbytes); +- } +- +- return err; ++ return geode_skcipher_crypt(req, AES_MODE_ECB, AES_DIR_ENCRYPT); + } + +-static int +-geode_ecb_encrypt(struct blkcipher_desc *desc, +- struct scatterlist *dst, struct scatterlist *src, +- unsigned int nbytes) ++static int geode_ecb_decrypt(struct skcipher_request *req) + { +- struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); +- struct blkcipher_walk walk; +- int err, ret; +- +- if (nbytes % AES_BLOCK_SIZE) +- return -EINVAL; +- +- if (unlikely(op->keylen != AES_KEYSIZE_128)) +- return fallback_blk_enc(desc, dst, src, nbytes); +- +- blkcipher_walk_init(&walk, dst, src, nbytes); +- err = blkcipher_walk_virt(desc, &walk); +- +- while ((nbytes = walk.nbytes)) { +- op->src = walk.src.virt.addr, +- op->dst = walk.dst.virt.addr; +- op->mode = AES_MODE_ECB; +- op->len = nbytes - (nbytes % AES_BLOCK_SIZE); +- op->dir = AES_DIR_ENCRYPT; +- +- ret = geode_aes_crypt(op); +- nbytes -= ret; +- ret = blkcipher_walk_done(desc, &walk, nbytes); +- } +- +- return err; ++ return geode_skcipher_crypt(req, AES_MODE_ECB, AES_DIR_DECRYPT); + } + +-static struct crypto_alg geode_ecb_alg = { +- .cra_name = "ecb(aes)", +- .cra_driver_name = "ecb-aes-geode", +- .cra_priority = 400, +- .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | +- CRYPTO_ALG_KERN_DRIVER_ONLY | +- CRYPTO_ALG_NEED_FALLBACK, +- .cra_init = fallback_init_blk, +- .cra_exit = fallback_exit_blk, +- .cra_blocksize = AES_BLOCK_SIZE, +- .cra_ctxsize = sizeof(struct geode_aes_op), +- .cra_alignmask = 15, +- .cra_type = &crypto_blkcipher_type, +- .cra_module = THIS_MODULE, +- .cra_u = { +- .blkcipher = { +- .min_keysize = AES_MIN_KEY_SIZE, +- .max_keysize = AES_MAX_KEY_SIZE, +- .setkey = geode_setkey_blk, +- .encrypt = geode_ecb_encrypt, +- .decrypt = geode_ecb_decrypt, +- } +- } ++static struct skcipher_alg geode_skcipher_algs[] = { ++ { ++ .base.cra_name = "cbc(aes)", ++ .base.cra_driver_name = "cbc-aes-geode", ++ .base.cra_priority = 400, ++ .base.cra_flags = CRYPTO_ALG_KERN_DRIVER_ONLY | ++ CRYPTO_ALG_NEED_FALLBACK, ++ .base.cra_blocksize = AES_BLOCK_SIZE, ++ .base.cra_ctxsize = sizeof(struct geode_aes_tfm_ctx), ++ .base.cra_alignmask = 15, ++ .base.cra_module = THIS_MODULE, ++ .init = geode_init_skcipher, ++ .exit = geode_exit_skcipher, ++ .setkey = geode_setkey_skcipher, ++ .encrypt = geode_cbc_encrypt, ++ .decrypt = geode_cbc_decrypt, ++ .min_keysize = AES_MIN_KEY_SIZE, ++ .max_keysize = AES_MAX_KEY_SIZE, ++ .ivsize = AES_BLOCK_SIZE, ++ }, { ++ .base.cra_name = "ecb(aes)", ++ .base.cra_driver_name = "ecb-aes-geode", ++ .base.cra_priority = 400, ++ .base.cra_flags = CRYPTO_ALG_KERN_DRIVER_ONLY | ++ CRYPTO_ALG_NEED_FALLBACK, ++ .base.cra_blocksize = AES_BLOCK_SIZE, ++ .base.cra_ctxsize = sizeof(struct geode_aes_tfm_ctx), ++ .base.cra_alignmask = 15, ++ .base.cra_module = THIS_MODULE, ++ .init = geode_init_skcipher, ++ .exit = geode_exit_skcipher, ++ .setkey = geode_setkey_skcipher, ++ .encrypt = geode_ecb_encrypt, ++ .decrypt = geode_ecb_decrypt, ++ .min_keysize = AES_MIN_KEY_SIZE, ++ .max_keysize = AES_MAX_KEY_SIZE, ++ }, + }; + + static void geode_aes_remove(struct pci_dev *dev) + { + crypto_unregister_alg(&geode_alg); +- crypto_unregister_alg(&geode_ecb_alg); +- crypto_unregister_alg(&geode_cbc_alg); ++ crypto_unregister_skciphers(geode_skcipher_algs, ++ ARRAY_SIZE(geode_skcipher_algs)); + + pci_iounmap(dev, _iobase); + _iobase = NULL; +@@ -547,20 +407,14 @@ static int geode_aes_probe(struct pci_dev *dev, const struct pci_device_id *id) + if (ret) + goto eiomap; + +- ret = crypto_register_alg(&geode_ecb_alg); ++ ret = crypto_register_skciphers(geode_skcipher_algs, ++ ARRAY_SIZE(geode_skcipher_algs)); + if (ret) + goto ealg; + +- ret = crypto_register_alg(&geode_cbc_alg); +- if (ret) +- goto eecb; +- + dev_notice(&dev->dev, "GEODE AES engine enabled.\n"); + return 0; + +- eecb: +- crypto_unregister_alg(&geode_ecb_alg); +- + ealg: + crypto_unregister_alg(&geode_alg); + +diff --git a/drivers/crypto/geode-aes.h b/drivers/crypto/geode-aes.h +index f8a86898ac22..6d0a0cdc7647 100644 +--- a/drivers/crypto/geode-aes.h ++++ b/drivers/crypto/geode-aes.h +@@ -46,21 +46,10 @@ + + #define AES_OP_TIMEOUT 0x50000 + +-struct geode_aes_op { +- +- void *src; +- void *dst; +- +- u32 mode; +- u32 dir; +- u32 flags; +- int len; +- ++struct geode_aes_tfm_ctx { + u8 key[AES_KEYSIZE_128]; +- u8 *iv; +- + union { +- struct crypto_sync_skcipher *blk; ++ struct crypto_skcipher *skcipher; + struct crypto_cipher *cip; + } fallback; + u32 keylen; +diff --git a/drivers/crypto/hisilicon/Kconfig b/drivers/crypto/hisilicon/Kconfig +index ebaf91e0146d..504daff7687d 100644 +--- a/drivers/crypto/hisilicon/Kconfig ++++ b/drivers/crypto/hisilicon/Kconfig +@@ -17,6 +17,7 @@ config CRYPTO_DEV_HISI_SEC + config CRYPTO_DEV_HISI_QM + tristate + depends on ARM64 && PCI && PCI_MSI ++ select NEED_SG_DMA_LENGTH + help + HiSilicon accelerator engines use a common queue management + interface. Specific engine driver may use this module. +diff --git a/drivers/crypto/virtio/virtio_crypto_algs.c b/drivers/crypto/virtio/virtio_crypto_algs.c +index 673fb29fda53..82b316b2f537 100644 +--- a/drivers/crypto/virtio/virtio_crypto_algs.c ++++ b/drivers/crypto/virtio/virtio_crypto_algs.c +@@ -435,6 +435,11 @@ __virtio_crypto_ablkcipher_do_req(struct virtio_crypto_sym_request *vc_sym_req, + goto free; + } + memcpy(iv, req->info, ivsize); ++ if (!vc_sym_req->encrypt) ++ scatterwalk_map_and_copy(req->info, req->src, ++ req->nbytes - AES_BLOCK_SIZE, ++ AES_BLOCK_SIZE, 0); ++ + sg_init_one(&iv_sg, iv, ivsize); + sgs[num_out++] = &iv_sg; + vc_sym_req->iv = iv; +@@ -571,6 +576,10 @@ static void virtio_crypto_ablkcipher_finalize_req( + struct ablkcipher_request *req, + int err) + { ++ if (vc_sym_req->encrypt) ++ scatterwalk_map_and_copy(req->info, req->dst, ++ req->nbytes - AES_BLOCK_SIZE, ++ AES_BLOCK_SIZE, 0); + crypto_finalize_ablkcipher_request(vc_sym_req->base.dataq->engine, + req, err); + kzfree(vc_sym_req->iv); +diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig +index defe1d438710..af4a3ccb96b3 100644 +--- a/drivers/devfreq/Kconfig ++++ b/drivers/devfreq/Kconfig +@@ -99,6 +99,7 @@ config ARM_TEGRA_DEVFREQ + ARCH_TEGRA_210_SOC || \ + COMPILE_TEST + select PM_OPP ++ depends on COMMON_CLK + help + This adds the DEVFREQ driver for the Tegra family of SoCs. + It reads ACTMON counters of memory controllers and adjusts the +diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c +index c90c798e5ec3..0585d749d935 100644 +--- a/drivers/dma/dw/platform.c ++++ b/drivers/dma/dw/platform.c +@@ -66,7 +66,7 @@ static int dw_probe(struct platform_device *pdev) + + data->chip = chip; + +- chip->clk = devm_clk_get(chip->dev, "hclk"); ++ chip->clk = devm_clk_get_optional(chip->dev, "hclk"); + if (IS_ERR(chip->clk)) + return PTR_ERR(chip->clk); + err = clk_prepare_enable(chip->clk); +diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c +index 1a422a8b43cf..18c011e57592 100644 +--- a/drivers/dma/ioat/dma.c ++++ b/drivers/dma/ioat/dma.c +@@ -377,10 +377,11 @@ ioat_alloc_ring(struct dma_chan *c, int order, gfp_t flags) + + descs->virt = dma_alloc_coherent(to_dev(ioat_chan), + SZ_2M, &descs->hw, flags); +- if (!descs->virt && (i > 0)) { ++ if (!descs->virt) { + int idx; + + for (idx = 0; idx < i; idx++) { ++ descs = &ioat_chan->descs[idx]; + dma_free_coherent(to_dev(ioat_chan), SZ_2M, + descs->virt, descs->hw); + descs->virt = NULL; +diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c +index 4b36c8810517..d05471653224 100644 +--- a/drivers/dma/k3dma.c ++++ b/drivers/dma/k3dma.c +@@ -229,9 +229,11 @@ static irqreturn_t k3_dma_int_handler(int irq, void *dev_id) + c = p->vchan; + if (c && (tc1 & BIT(i))) { + spin_lock_irqsave(&c->vc.lock, flags); +- vchan_cookie_complete(&p->ds_run->vd); +- p->ds_done = p->ds_run; +- p->ds_run = NULL; ++ if (p->ds_run != NULL) { ++ vchan_cookie_complete(&p->ds_run->vd); ++ p->ds_done = p->ds_run; ++ p->ds_run = NULL; ++ } + spin_unlock_irqrestore(&c->vc.lock, flags); + } + if (c && (tc2 & BIT(i))) { +@@ -271,6 +273,10 @@ static int k3_dma_start_txd(struct k3_dma_chan *c) + if (BIT(c->phy->idx) & k3_dma_get_chan_stat(d)) + return -EAGAIN; + ++ /* Avoid losing track of ds_run if a transaction is in flight */ ++ if (c->phy->ds_run) ++ return -EAGAIN; ++ + if (vd) { + struct k3_dma_desc_sw *ds = + container_of(vd, struct k3_dma_desc_sw, vd); +diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c +index a031cbcdf6ef..d72a3a5507b0 100644 +--- a/drivers/gpio/gpio-mpc8xxx.c ++++ b/drivers/gpio/gpio-mpc8xxx.c +@@ -346,6 +346,7 @@ static int mpc8xxx_probe(struct platform_device *pdev) + return -ENOMEM; + + gc = &mpc8xxx_gc->gc; ++ gc->parent = &pdev->dev; + + if (of_property_read_bool(np, "little-endian")) { + ret = bgpio_init(gc, &pdev->dev, 4, +diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c +index cd475ff4bcad..7835aad6d162 100644 +--- a/drivers/gpio/gpio-zynq.c ++++ b/drivers/gpio/gpio-zynq.c +@@ -681,6 +681,8 @@ static void zynq_gpio_restore_context(struct zynq_gpio *gpio) + unsigned int bank_num; + + for (bank_num = 0; bank_num < gpio->p_data->max_bank; bank_num++) { ++ writel_relaxed(ZYNQ_GPIO_IXR_DISABLE_ALL, gpio->base_addr + ++ ZYNQ_GPIO_INTDIS_OFFSET(bank_num)); + writel_relaxed(gpio->context.datalsw[bank_num], + gpio->base_addr + + ZYNQ_GPIO_DATA_LSW_OFFSET(bank_num)); +@@ -690,9 +692,6 @@ static void zynq_gpio_restore_context(struct zynq_gpio *gpio) + writel_relaxed(gpio->context.dirm[bank_num], + gpio->base_addr + + ZYNQ_GPIO_DIRM_OFFSET(bank_num)); +- writel_relaxed(gpio->context.int_en[bank_num], +- gpio->base_addr + +- ZYNQ_GPIO_INTEN_OFFSET(bank_num)); + writel_relaxed(gpio->context.int_type[bank_num], + gpio->base_addr + + ZYNQ_GPIO_INTTYPE_OFFSET(bank_num)); +@@ -702,6 +701,9 @@ static void zynq_gpio_restore_context(struct zynq_gpio *gpio) + writel_relaxed(gpio->context.int_any[bank_num], + gpio->base_addr + + ZYNQ_GPIO_INTANY_OFFSET(bank_num)); ++ writel_relaxed(~(gpio->context.int_en[bank_num]), ++ gpio->base_addr + ++ ZYNQ_GPIO_INTEN_OFFSET(bank_num)); + } + } + +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c +index 99d19f80440e..3d9524a2abc4 100644 +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -4328,8 +4328,9 @@ static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, + + if (chip->ngpio <= p->chip_hwnum) { + dev_err(dev, +- "requested GPIO %d is out of range [0..%d] for chip %s\n", +- idx, chip->ngpio, chip->label); ++ "requested GPIO %u (%u) is out of range [0..%u] for chip %s\n", ++ idx, p->chip_hwnum, chip->ngpio - 1, ++ chip->label); + return ERR_PTR(-EINVAL); + } + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h +index bd37df5dd6d0..d1e278e999ee 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h +@@ -813,6 +813,7 @@ struct amdgpu_device { + uint8_t *bios; + uint32_t bios_size; + struct amdgpu_bo *stolen_vga_memory; ++ struct amdgpu_bo *discovery_memory; + uint32_t bios_scratch_reg_offset; + uint32_t bios_scratch[AMDGPU_BIOS_NUM_SCRATCH]; + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +index 1481899f86c1..71198c5318e1 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +@@ -136,7 +136,7 @@ static int amdgpu_discovery_read_binary(struct amdgpu_device *adev, uint8_t *bin + { + uint32_t *p = (uint32_t *)binary; + uint64_t vram_size = (uint64_t)RREG32(mmRCC_CONFIG_MEMSIZE) << 20; +- uint64_t pos = vram_size - BINARY_MAX_SIZE; ++ uint64_t pos = vram_size - DISCOVERY_TMR_SIZE; + unsigned long flags; + + while (pos < vram_size) { +@@ -179,7 +179,7 @@ int amdgpu_discovery_init(struct amdgpu_device *adev) + uint16_t checksum; + int r; + +- adev->discovery = kzalloc(BINARY_MAX_SIZE, GFP_KERNEL); ++ adev->discovery = kzalloc(DISCOVERY_TMR_SIZE, GFP_KERNEL); + if (!adev->discovery) + return -ENOMEM; + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h +index 85b8c4d4d576..5a6693d7d269 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h +@@ -24,6 +24,8 @@ + #ifndef __AMDGPU_DISCOVERY__ + #define __AMDGPU_DISCOVERY__ + ++#define DISCOVERY_TMR_SIZE (64 << 10) ++ + int amdgpu_discovery_init(struct amdgpu_device *adev); + void amdgpu_discovery_fini(struct amdgpu_device *adev); + int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev); +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +index 7289e1b4fb60..28361a9c5add 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +@@ -342,6 +342,67 @@ int amdgpu_bo_create_kernel(struct amdgpu_device *adev, + return 0; + } + ++/** ++ * amdgpu_bo_create_kernel_at - create BO for kernel use at specific location ++ * ++ * @adev: amdgpu device object ++ * @offset: offset of the BO ++ * @size: size of the BO ++ * @domain: where to place it ++ * @bo_ptr: used to initialize BOs in structures ++ * @cpu_addr: optional CPU address mapping ++ * ++ * Creates a kernel BO at a specific offset in the address space of the domain. ++ * ++ * Returns: ++ * 0 on success, negative error code otherwise. ++ */ ++int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev, ++ uint64_t offset, uint64_t size, uint32_t domain, ++ struct amdgpu_bo **bo_ptr, void **cpu_addr) ++{ ++ struct ttm_operation_ctx ctx = { false, false }; ++ unsigned int i; ++ int r; ++ ++ offset &= PAGE_MASK; ++ size = ALIGN(size, PAGE_SIZE); ++ ++ r = amdgpu_bo_create_reserved(adev, size, PAGE_SIZE, domain, bo_ptr, ++ NULL, NULL); ++ if (r) ++ return r; ++ ++ /* ++ * Remove the original mem node and create a new one at the request ++ * position. ++ */ ++ for (i = 0; i < (*bo_ptr)->placement.num_placement; ++i) { ++ (*bo_ptr)->placements[i].fpfn = offset >> PAGE_SHIFT; ++ (*bo_ptr)->placements[i].lpfn = (offset + size) >> PAGE_SHIFT; ++ } ++ ++ ttm_bo_mem_put(&(*bo_ptr)->tbo, &(*bo_ptr)->tbo.mem); ++ r = ttm_bo_mem_space(&(*bo_ptr)->tbo, &(*bo_ptr)->placement, ++ &(*bo_ptr)->tbo.mem, &ctx); ++ if (r) ++ goto error; ++ ++ if (cpu_addr) { ++ r = amdgpu_bo_kmap(*bo_ptr, cpu_addr); ++ if (r) ++ goto error; ++ } ++ ++ amdgpu_bo_unreserve(*bo_ptr); ++ return 0; ++ ++error: ++ amdgpu_bo_unreserve(*bo_ptr); ++ amdgpu_bo_unref(bo_ptr); ++ return r; ++} ++ + /** + * amdgpu_bo_free_kernel - free BO for kernel use + * +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +index 658f4c9779b7..4fcea23ee516 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +@@ -237,6 +237,9 @@ int amdgpu_bo_create_kernel(struct amdgpu_device *adev, + unsigned long size, int align, + u32 domain, struct amdgpu_bo **bo_ptr, + u64 *gpu_addr, void **cpu_addr); ++int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev, ++ uint64_t offset, uint64_t size, uint32_t domain, ++ struct amdgpu_bo **bo_ptr, void **cpu_addr); + void amdgpu_bo_free_kernel(struct amdgpu_bo **bo, u64 *gpu_addr, + void **cpu_addr); + int amdgpu_bo_kmap(struct amdgpu_bo *bo, void **ptr); +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +index 016ea274b955..9c5cbc47edf1 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +@@ -65,12 +65,6 @@ const char *ras_block_string[] = { + /* inject address is 52 bits */ + #define RAS_UMC_INJECT_ADDR_LIMIT (0x1ULL << 52) + +-static int amdgpu_ras_reserve_vram(struct amdgpu_device *adev, +- uint64_t offset, uint64_t size, +- struct amdgpu_bo **bo_ptr); +-static int amdgpu_ras_release_vram(struct amdgpu_device *adev, +- struct amdgpu_bo **bo_ptr); +- + static ssize_t amdgpu_ras_debugfs_read(struct file *f, char __user *buf, + size_t size, loff_t *pos) + { +@@ -1214,75 +1208,6 @@ static void amdgpu_ras_do_recovery(struct work_struct *work) + atomic_set(&ras->in_recovery, 0); + } + +-static int amdgpu_ras_release_vram(struct amdgpu_device *adev, +- struct amdgpu_bo **bo_ptr) +-{ +- /* no need to free it actually. */ +- amdgpu_bo_free_kernel(bo_ptr, NULL, NULL); +- return 0; +-} +- +-/* reserve vram with size@offset */ +-static int amdgpu_ras_reserve_vram(struct amdgpu_device *adev, +- uint64_t offset, uint64_t size, +- struct amdgpu_bo **bo_ptr) +-{ +- struct ttm_operation_ctx ctx = { false, false }; +- struct amdgpu_bo_param bp; +- int r = 0; +- int i; +- struct amdgpu_bo *bo; +- +- if (bo_ptr) +- *bo_ptr = NULL; +- memset(&bp, 0, sizeof(bp)); +- bp.size = size; +- bp.byte_align = PAGE_SIZE; +- bp.domain = AMDGPU_GEM_DOMAIN_VRAM; +- bp.flags = AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | +- AMDGPU_GEM_CREATE_NO_CPU_ACCESS; +- bp.type = ttm_bo_type_kernel; +- bp.resv = NULL; +- +- r = amdgpu_bo_create(adev, &bp, &bo); +- if (r) +- return -EINVAL; +- +- r = amdgpu_bo_reserve(bo, false); +- if (r) +- goto error_reserve; +- +- offset = ALIGN(offset, PAGE_SIZE); +- for (i = 0; i < bo->placement.num_placement; ++i) { +- bo->placements[i].fpfn = offset >> PAGE_SHIFT; +- bo->placements[i].lpfn = (offset + size) >> PAGE_SHIFT; +- } +- +- ttm_bo_mem_put(&bo->tbo, &bo->tbo.mem); +- r = ttm_bo_mem_space(&bo->tbo, &bo->placement, &bo->tbo.mem, &ctx); +- if (r) +- goto error_pin; +- +- r = amdgpu_bo_pin_restricted(bo, +- AMDGPU_GEM_DOMAIN_VRAM, +- offset, +- offset + size); +- if (r) +- goto error_pin; +- +- if (bo_ptr) +- *bo_ptr = bo; +- +- amdgpu_bo_unreserve(bo); +- return r; +- +-error_pin: +- amdgpu_bo_unreserve(bo); +-error_reserve: +- amdgpu_bo_unref(&bo); +- return r; +-} +- + /* alloc/realloc bps array */ + static int amdgpu_ras_realloc_eh_data_space(struct amdgpu_device *adev, + struct ras_err_handler_data *data, int pages) +@@ -1345,7 +1270,7 @@ int amdgpu_ras_reserve_bad_pages(struct amdgpu_device *adev) + struct amdgpu_ras *con = amdgpu_ras_get_context(adev); + struct ras_err_handler_data *data; + uint64_t bp; +- struct amdgpu_bo *bo; ++ struct amdgpu_bo *bo = NULL; + int i; + + if (!con || !con->eh_data) +@@ -1359,12 +1284,14 @@ int amdgpu_ras_reserve_bad_pages(struct amdgpu_device *adev) + for (i = data->last_reserved; i < data->count; i++) { + bp = data->bps[i].bp; + +- if (amdgpu_ras_reserve_vram(adev, bp << PAGE_SHIFT, +- PAGE_SIZE, &bo)) ++ if (amdgpu_bo_create_kernel_at(adev, bp << PAGE_SHIFT, PAGE_SIZE, ++ AMDGPU_GEM_DOMAIN_VRAM, ++ &bo, NULL)) + DRM_ERROR("RAS ERROR: reserve vram %llx fail\n", bp); + + data->bps[i].bo = bo; + data->last_reserved = i + 1; ++ bo = NULL; + } + out: + mutex_unlock(&con->recovery_lock); +@@ -1390,7 +1317,7 @@ static int amdgpu_ras_release_bad_pages(struct amdgpu_device *adev) + for (i = data->last_reserved - 1; i >= 0; i--) { + bo = data->bps[i].bo; + +- amdgpu_ras_release_vram(adev, &bo); ++ amdgpu_bo_free_kernel(&bo, NULL, NULL); + + data->bps[i].bo = bo; + data->last_reserved = i; +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +index c0e41f1f0c23..f15ded1ce905 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +@@ -1639,81 +1639,25 @@ static void amdgpu_ttm_fw_reserve_vram_fini(struct amdgpu_device *adev) + */ + static int amdgpu_ttm_fw_reserve_vram_init(struct amdgpu_device *adev) + { +- struct ttm_operation_ctx ctx = { false, false }; +- struct amdgpu_bo_param bp; +- int r = 0; +- int i; +- u64 vram_size = adev->gmc.visible_vram_size; +- u64 offset = adev->fw_vram_usage.start_offset; +- u64 size = adev->fw_vram_usage.size; +- struct amdgpu_bo *bo; +- +- memset(&bp, 0, sizeof(bp)); +- bp.size = adev->fw_vram_usage.size; +- bp.byte_align = PAGE_SIZE; +- bp.domain = AMDGPU_GEM_DOMAIN_VRAM; +- bp.flags = AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | +- AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS; +- bp.type = ttm_bo_type_kernel; +- bp.resv = NULL; ++ uint64_t vram_size = adev->gmc.visible_vram_size; ++ int r; ++ + adev->fw_vram_usage.va = NULL; + adev->fw_vram_usage.reserved_bo = NULL; + +- if (adev->fw_vram_usage.size > 0 && +- adev->fw_vram_usage.size <= vram_size) { +- +- r = amdgpu_bo_create(adev, &bp, +- &adev->fw_vram_usage.reserved_bo); +- if (r) +- goto error_create; +- +- r = amdgpu_bo_reserve(adev->fw_vram_usage.reserved_bo, false); +- if (r) +- goto error_reserve; +- +- /* remove the original mem node and create a new one at the +- * request position +- */ +- bo = adev->fw_vram_usage.reserved_bo; +- offset = ALIGN(offset, PAGE_SIZE); +- for (i = 0; i < bo->placement.num_placement; ++i) { +- bo->placements[i].fpfn = offset >> PAGE_SHIFT; +- bo->placements[i].lpfn = (offset + size) >> PAGE_SHIFT; +- } +- +- ttm_bo_mem_put(&bo->tbo, &bo->tbo.mem); +- r = ttm_bo_mem_space(&bo->tbo, &bo->placement, +- &bo->tbo.mem, &ctx); +- if (r) +- goto error_pin; +- +- r = amdgpu_bo_pin_restricted(adev->fw_vram_usage.reserved_bo, +- AMDGPU_GEM_DOMAIN_VRAM, +- adev->fw_vram_usage.start_offset, +- (adev->fw_vram_usage.start_offset + +- adev->fw_vram_usage.size)); +- if (r) +- goto error_pin; +- r = amdgpu_bo_kmap(adev->fw_vram_usage.reserved_bo, +- &adev->fw_vram_usage.va); +- if (r) +- goto error_kmap; +- +- amdgpu_bo_unreserve(adev->fw_vram_usage.reserved_bo); +- } +- return r; ++ if (adev->fw_vram_usage.size == 0 || ++ adev->fw_vram_usage.size > vram_size) ++ return 0; + +-error_kmap: +- amdgpu_bo_unpin(adev->fw_vram_usage.reserved_bo); +-error_pin: +- amdgpu_bo_unreserve(adev->fw_vram_usage.reserved_bo); +-error_reserve: +- amdgpu_bo_unref(&adev->fw_vram_usage.reserved_bo); +-error_create: +- adev->fw_vram_usage.va = NULL; +- adev->fw_vram_usage.reserved_bo = NULL; ++ return amdgpu_bo_create_kernel_at(adev, ++ adev->fw_vram_usage.start_offset, ++ adev->fw_vram_usage.size, ++ AMDGPU_GEM_DOMAIN_VRAM, ++ &adev->fw_vram_usage.reserved_bo, ++ &adev->fw_vram_usage.va); + return r; + } ++ + /** + * amdgpu_ttm_init - Init the memory management (ttm) as well as various + * gtt/vram related fields. +@@ -1786,6 +1730,20 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) + NULL, &stolen_vga_buf); + if (r) + return r; ++ ++ /* ++ * reserve one TMR (64K) memory at the top of VRAM which holds ++ * IP Discovery data and is protected by PSP. ++ */ ++ r = amdgpu_bo_create_kernel_at(adev, ++ adev->gmc.real_vram_size - DISCOVERY_TMR_SIZE, ++ DISCOVERY_TMR_SIZE, ++ AMDGPU_GEM_DOMAIN_VRAM, ++ &adev->discovery_memory, ++ NULL); ++ if (r) ++ return r; ++ + DRM_INFO("amdgpu: %uM of VRAM memory ready\n", + (unsigned) (adev->gmc.real_vram_size / (1024 * 1024))); + +@@ -1850,6 +1808,9 @@ void amdgpu_ttm_late_init(struct amdgpu_device *adev) + void *stolen_vga_buf; + /* return the VGA stolen memory (if any) back to VRAM */ + amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, &stolen_vga_buf); ++ ++ /* return the IP Discovery TMR memory back to VRAM */ ++ amdgpu_bo_free_kernel(&adev->discovery_memory, NULL, NULL); + } + + /** +diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +index c9ba2ec6d038..ab4a0d8545dc 100644 +--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c ++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +@@ -1038,17 +1038,10 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev) + case CHIP_VEGA20: + break; + case CHIP_RAVEN: +- /* Disable GFXOFF on original raven. There are combinations +- * of sbios and platforms that are not stable. +- */ +- if (!(adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8)) +- adev->pm.pp_feature &= ~PP_GFXOFF_MASK; +- else if (!(adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8) +- &&((adev->gfx.rlc_fw_version != 106 && +- adev->gfx.rlc_fw_version < 531) || +- (adev->gfx.rlc_fw_version == 53815) || +- (adev->gfx.rlc_feature_version < 1) || +- !adev->gfx.rlc.is_rlc_v2_1)) ++ if (!(adev->rev_id >= 0x8 || ++ adev->pdev->device == 0x15d8) && ++ (adev->pm.fw_version < 0x41e2b || /* not raven1 fresh */ ++ !adev->gfx.rlc.is_rlc_v2_1)) /* without rlc save restore ucodes */ + adev->pm.pp_feature &= ~PP_GFXOFF_MASK; + + if (adev->pm.pp_feature & PP_GFXOFF_MASK) +diff --git a/drivers/gpu/drm/amd/include/discovery.h b/drivers/gpu/drm/amd/include/discovery.h +index 5dcb776548d8..7ec4331e67f2 100644 +--- a/drivers/gpu/drm/amd/include/discovery.h ++++ b/drivers/gpu/drm/amd/include/discovery.h +@@ -25,7 +25,6 @@ + #define _DISCOVERY_H_ + + #define PSP_HEADER_SIZE 256 +-#define BINARY_MAX_SIZE (64 << 10) + #define BINARY_SIGNATURE 0x28211407 + #define DISCOVERY_TABLE_SIGNATURE 0x53445049 + +diff --git a/drivers/gpu/drm/arm/malidp_mw.c b/drivers/gpu/drm/arm/malidp_mw.c +index 875a3a9eabfa..7d0e7b031e44 100644 +--- a/drivers/gpu/drm/arm/malidp_mw.c ++++ b/drivers/gpu/drm/arm/malidp_mw.c +@@ -56,7 +56,7 @@ malidp_mw_connector_mode_valid(struct drm_connector *connector, + return MODE_OK; + } + +-const struct drm_connector_helper_funcs malidp_mw_connector_helper_funcs = { ++static const struct drm_connector_helper_funcs malidp_mw_connector_helper_funcs = { + .get_modes = malidp_mw_connector_get_modes, + .mode_valid = malidp_mw_connector_mode_valid, + }; +diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c +index 6fb7d74ff553..bc7cc32140f8 100644 +--- a/drivers/gpu/drm/tegra/drm.c ++++ b/drivers/gpu/drm/tegra/drm.c +@@ -201,19 +201,19 @@ hub: + if (tegra->hub) + tegra_display_hub_cleanup(tegra->hub); + device: +- host1x_device_exit(device); +-fbdev: +- drm_kms_helper_poll_fini(drm); +- tegra_drm_fb_free(drm); +-config: +- drm_mode_config_cleanup(drm); +- + if (tegra->domain) { + mutex_destroy(&tegra->mm_lock); + drm_mm_takedown(&tegra->mm); + put_iova_domain(&tegra->carveout.domain); + iova_cache_put(); + } ++ ++ host1x_device_exit(device); ++fbdev: ++ drm_kms_helper_poll_fini(drm); ++ tegra_drm_fb_free(drm); ++config: ++ drm_mode_config_cleanup(drm); + domain: + if (tegra->domain) + iommu_domain_free(tegra->domain); +diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c +index a662394f6892..0a88ef11b9d3 100644 +--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c ++++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c +@@ -463,29 +463,25 @@ out: + } + + static int virtio_gpu_wait_ioctl(struct drm_device *dev, void *data, +- struct drm_file *file) ++ struct drm_file *file) + { + struct drm_virtgpu_3d_wait *args = data; +- struct drm_gem_object *obj; +- long timeout = 15 * HZ; ++ struct drm_gem_object *gobj = NULL; ++ struct virtio_gpu_object *qobj = NULL; + int ret; ++ bool nowait = false; + +- obj = drm_gem_object_lookup(file, args->handle); +- if (obj == NULL) ++ gobj = drm_gem_object_lookup(file, args->handle); ++ if (gobj == NULL) + return -ENOENT; + +- if (args->flags & VIRTGPU_WAIT_NOWAIT) { +- ret = dma_resv_test_signaled_rcu(obj->resv, true); +- } else { +- ret = dma_resv_wait_timeout_rcu(obj->resv, true, true, +- timeout); +- } +- if (ret == 0) +- ret = -EBUSY; +- else if (ret > 0) +- ret = 0; ++ qobj = gem_to_virtio_gpu_obj(gobj); + +- drm_gem_object_put_unlocked(obj); ++ if (args->flags & VIRTGPU_WAIT_NOWAIT) ++ nowait = true; ++ ret = virtio_gpu_object_wait(qobj, nowait); ++ ++ drm_gem_object_put_unlocked(gobj); + return ret; + } + +diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c +index c25e95c19cad..b382c6bf2c5c 100644 +--- a/drivers/hid/hidraw.c ++++ b/drivers/hid/hidraw.c +@@ -249,13 +249,14 @@ out: + static __poll_t hidraw_poll(struct file *file, poll_table *wait) + { + struct hidraw_list *list = file->private_data; ++ __poll_t mask = EPOLLOUT | EPOLLWRNORM; /* hidraw is always writable */ + + poll_wait(file, &list->hidraw->wait, wait); + if (list->head != list->tail) +- return EPOLLIN | EPOLLRDNORM; ++ mask |= EPOLLIN | EPOLLRDNORM; + if (!list->hidraw->exist) +- return EPOLLERR | EPOLLHUP; +- return EPOLLOUT | EPOLLWRNORM; ++ mask |= EPOLLERR | EPOLLHUP; ++ return mask; + } + + static int hidraw_open(struct inode *inode, struct file *file) +diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c +index 935c3d0a3b63..8fe3efcb8327 100644 +--- a/drivers/hid/uhid.c ++++ b/drivers/hid/uhid.c +@@ -766,13 +766,14 @@ unlock: + static __poll_t uhid_char_poll(struct file *file, poll_table *wait) + { + struct uhid_device *uhid = file->private_data; ++ __poll_t mask = EPOLLOUT | EPOLLWRNORM; /* uhid is always writable */ + + poll_wait(file, &uhid->waitq, wait); + + if (uhid->head != uhid->tail) +- return EPOLLIN | EPOLLRDNORM; ++ mask |= EPOLLIN | EPOLLRDNORM; + +- return EPOLLOUT | EPOLLWRNORM; ++ return mask; + } + + static const struct file_operations uhid_fops = { +diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c +index e01b2b57e724..5ab901ad615d 100644 +--- a/drivers/i2c/busses/i2c-bcm2835.c ++++ b/drivers/i2c/busses/i2c-bcm2835.c +@@ -58,6 +58,7 @@ struct bcm2835_i2c_dev { + struct i2c_adapter adapter; + struct completion completion; + struct i2c_msg *curr_msg; ++ struct clk *bus_clk; + int num_msgs; + u32 msg_err; + u8 *msg_buf; +@@ -404,7 +405,6 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) + struct resource *mem, *irq; + int ret; + struct i2c_adapter *adap; +- struct clk *bus_clk; + struct clk *mclk; + u32 bus_clk_rate; + +@@ -427,11 +427,11 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) + return PTR_ERR(mclk); + } + +- bus_clk = bcm2835_i2c_register_div(&pdev->dev, mclk, i2c_dev); ++ i2c_dev->bus_clk = bcm2835_i2c_register_div(&pdev->dev, mclk, i2c_dev); + +- if (IS_ERR(bus_clk)) { ++ if (IS_ERR(i2c_dev->bus_clk)) { + dev_err(&pdev->dev, "Could not register clock\n"); +- return PTR_ERR(bus_clk); ++ return PTR_ERR(i2c_dev->bus_clk); + } + + ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency", +@@ -442,13 +442,13 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) + bus_clk_rate = 100000; + } + +- ret = clk_set_rate_exclusive(bus_clk, bus_clk_rate); ++ ret = clk_set_rate_exclusive(i2c_dev->bus_clk, bus_clk_rate); + if (ret < 0) { + dev_err(&pdev->dev, "Could not set clock frequency\n"); + return ret; + } + +- ret = clk_prepare_enable(bus_clk); ++ ret = clk_prepare_enable(i2c_dev->bus_clk); + if (ret) { + dev_err(&pdev->dev, "Couldn't prepare clock"); + return ret; +@@ -491,10 +491,9 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) + static int bcm2835_i2c_remove(struct platform_device *pdev) + { + struct bcm2835_i2c_dev *i2c_dev = platform_get_drvdata(pdev); +- struct clk *bus_clk = devm_clk_get(i2c_dev->dev, "div"); + +- clk_rate_exclusive_put(bus_clk); +- clk_disable_unprepare(bus_clk); ++ clk_rate_exclusive_put(i2c_dev->bus_clk); ++ clk_disable_unprepare(i2c_dev->bus_clk); + + free_irq(i2c_dev->irq, i2c_dev); + i2c_del_adapter(&i2c_dev->adapter); +diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c +index 7b966a41d623..cf7b59d97802 100644 +--- a/drivers/iio/imu/adis16480.c ++++ b/drivers/iio/imu/adis16480.c +@@ -454,12 +454,14 @@ static int adis16480_get_calibbias(struct iio_dev *indio_dev, + case IIO_MAGN: + case IIO_PRESSURE: + ret = adis_read_reg_16(&st->adis, reg, &val16); +- *bias = sign_extend32(val16, 15); ++ if (ret == 0) ++ *bias = sign_extend32(val16, 15); + break; + case IIO_ANGL_VEL: + case IIO_ACCEL: + ret = adis_read_reg_32(&st->adis, reg, &val32); +- *bias = sign_extend32(val32, 31); ++ if (ret == 0) ++ *bias = sign_extend32(val32, 31); + break; + default: + ret = -EINVAL; +diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +index 28e011b35f21..3e0528793d95 100644 +--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c ++++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +@@ -152,9 +152,10 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { + .addr = 0x10, + .mask = GENMASK(4, 3), + }, +- .fs_avl[0] = { IIO_DEGREE_TO_RAD(245), 0x0 }, +- .fs_avl[1] = { IIO_DEGREE_TO_RAD(500), 0x1 }, +- .fs_avl[2] = { IIO_DEGREE_TO_RAD(2000), 0x3 }, ++ ++ .fs_avl[0] = { IIO_DEGREE_TO_RAD(8750), 0x0 }, ++ .fs_avl[1] = { IIO_DEGREE_TO_RAD(17500), 0x1 }, ++ .fs_avl[2] = { IIO_DEGREE_TO_RAD(70000), 0x3 }, + .fs_len = 3, + }, + }, +diff --git a/drivers/infiniband/core/counters.c b/drivers/infiniband/core/counters.c +index 023478107f0e..46dd50ff7c85 100644 +--- a/drivers/infiniband/core/counters.c ++++ b/drivers/infiniband/core/counters.c +@@ -466,10 +466,15 @@ static struct rdma_counter *rdma_get_counter_by_id(struct ib_device *dev, + int rdma_counter_bind_qpn(struct ib_device *dev, u8 port, + u32 qp_num, u32 counter_id) + { ++ struct rdma_port_counter *port_counter; + struct rdma_counter *counter; + struct ib_qp *qp; + int ret; + ++ port_counter = &dev->port_data[port].port_counter; ++ if (port_counter->mode.mode == RDMA_COUNTER_MODE_AUTO) ++ return -EINVAL; ++ + qp = rdma_counter_get_qp(dev, qp_num); + if (!qp) + return -ENOENT; +@@ -506,6 +511,7 @@ err: + int rdma_counter_bind_qpn_alloc(struct ib_device *dev, u8 port, + u32 qp_num, u32 *counter_id) + { ++ struct rdma_port_counter *port_counter; + struct rdma_counter *counter; + struct ib_qp *qp; + int ret; +@@ -513,9 +519,13 @@ int rdma_counter_bind_qpn_alloc(struct ib_device *dev, u8 port, + if (!rdma_is_port_valid(dev, port)) + return -EINVAL; + +- if (!dev->port_data[port].port_counter.hstats) ++ port_counter = &dev->port_data[port].port_counter; ++ if (!port_counter->hstats) + return -EOPNOTSUPP; + ++ if (port_counter->mode.mode == RDMA_COUNTER_MODE_AUTO) ++ return -EINVAL; ++ + qp = rdma_counter_get_qp(dev, qp_num); + if (!qp) + return -ENOENT; +diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c +index b4149dc9e824..ebc3e3d4a6e2 100644 +--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c ++++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c +@@ -3323,8 +3323,10 @@ int bnxt_re_dereg_mr(struct ib_mr *ib_mr, struct ib_udata *udata) + int rc; + + rc = bnxt_qplib_free_mrw(&rdev->qplib_res, &mr->qplib_mr); +- if (rc) ++ if (rc) { + dev_err(rdev_to_dev(rdev), "Dereg MR failed: %#x\n", rc); ++ return rc; ++ } + + if (mr->pages) { + rc = bnxt_qplib_free_fast_reg_page_list(&rdev->qplib_res, +diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c +index 958c1ff9c515..4d07d22bfa7b 100644 +--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c ++++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c +@@ -2283,13 +2283,13 @@ static int bnxt_qplib_cq_process_req(struct bnxt_qplib_cq *cq, + /* Add qp to flush list of the CQ */ + bnxt_qplib_add_flush_qp(qp); + } else { ++ /* Before we complete, do WA 9060 */ ++ if (do_wa9060(qp, cq, cq_cons, sw_sq_cons, ++ cqe_sq_cons)) { ++ *lib_qp = qp; ++ goto out; ++ } + if (swq->flags & SQ_SEND_FLAGS_SIGNAL_COMP) { +- /* Before we complete, do WA 9060 */ +- if (do_wa9060(qp, cq, cq_cons, sw_sq_cons, +- cqe_sq_cons)) { +- *lib_qp = qp; +- goto out; +- } + cqe->status = CQ_REQ_STATUS_OK; + cqe++; + (*budget)--; +diff --git a/drivers/infiniband/hw/hfi1/iowait.c b/drivers/infiniband/hw/hfi1/iowait.c +index adb4a1ba921b..5836fe7b2817 100644 +--- a/drivers/infiniband/hw/hfi1/iowait.c ++++ b/drivers/infiniband/hw/hfi1/iowait.c +@@ -81,7 +81,9 @@ void iowait_init(struct iowait *wait, u32 tx_limit, + void iowait_cancel_work(struct iowait *w) + { + cancel_work_sync(&iowait_get_ib_work(w)->iowork); +- cancel_work_sync(&iowait_get_tid_work(w)->iowork); ++ /* Make sure that the iowork for TID RDMA is used */ ++ if (iowait_get_tid_work(w)->iowork.func) ++ cancel_work_sync(&iowait_get_tid_work(w)->iowork); + } + + /** +diff --git a/drivers/infiniband/hw/hns/Kconfig b/drivers/infiniband/hw/hns/Kconfig +index d602b698b57e..4921c1e40ccd 100644 +--- a/drivers/infiniband/hw/hns/Kconfig ++++ b/drivers/infiniband/hw/hns/Kconfig +@@ -1,23 +1,34 @@ + # SPDX-License-Identifier: GPL-2.0-only + config INFINIBAND_HNS +- bool "HNS RoCE Driver" ++ tristate "HNS RoCE Driver" + depends on NET_VENDOR_HISILICON + depends on ARM64 || (COMPILE_TEST && 64BIT) ++ depends on (HNS_DSAF && HNS_ENET) || HNS3 + ---help--- + This is a RoCE/RDMA driver for the Hisilicon RoCE engine. The engine + is used in Hisilicon Hip06 and more further ICT SoC based on + platform device. + ++ To compile HIP06 or HIP08 driver as module, choose M here. ++ + config INFINIBAND_HNS_HIP06 +- tristate "Hisilicon Hip06 Family RoCE support" ++ bool "Hisilicon Hip06 Family RoCE support" + depends on INFINIBAND_HNS && HNS && HNS_DSAF && HNS_ENET ++ depends on INFINIBAND_HNS=m || (HNS_DSAF=y && HNS_ENET=y) + ---help--- + RoCE driver support for Hisilicon RoCE engine in Hisilicon Hip06 and + Hip07 SoC. These RoCE engines are platform devices. + ++ To compile this driver, choose Y here: if INFINIBAND_HNS is m, this ++ module will be called hns-roce-hw-v1 ++ + config INFINIBAND_HNS_HIP08 +- tristate "Hisilicon Hip08 Family RoCE support" ++ bool "Hisilicon Hip08 Family RoCE support" + depends on INFINIBAND_HNS && PCI && HNS3 ++ depends on INFINIBAND_HNS=m || HNS3=y + ---help--- + RoCE driver support for Hisilicon RoCE engine in Hisilicon Hip08 SoC. + The RoCE engine is a PCI device. ++ ++ To compile this driver, choose Y here: if INFINIBAND_HNS is m, this ++ module will be called hns-roce-hw-v2. +diff --git a/drivers/infiniband/hw/hns/Makefile b/drivers/infiniband/hw/hns/Makefile +index 449a2d81319d..e105945b94a1 100644 +--- a/drivers/infiniband/hw/hns/Makefile ++++ b/drivers/infiniband/hw/hns/Makefile +@@ -9,8 +9,12 @@ hns-roce-objs := hns_roce_main.o hns_roce_cmd.o hns_roce_pd.o \ + hns_roce_ah.o hns_roce_hem.o hns_roce_mr.o hns_roce_qp.o \ + hns_roce_cq.o hns_roce_alloc.o hns_roce_db.o hns_roce_srq.o hns_roce_restrack.o + ++ifdef CONFIG_INFINIBAND_HNS_HIP06 + hns-roce-hw-v1-objs := hns_roce_hw_v1.o $(hns-roce-objs) +-obj-$(CONFIG_INFINIBAND_HNS_HIP06) += hns-roce-hw-v1.o ++obj-$(CONFIG_INFINIBAND_HNS) += hns-roce-hw-v1.o ++endif + ++ifdef CONFIG_INFINIBAND_HNS_HIP08 + hns-roce-hw-v2-objs := hns_roce_hw_v2.o hns_roce_hw_v2_dfx.o $(hns-roce-objs) +-obj-$(CONFIG_INFINIBAND_HNS_HIP08) += hns-roce-hw-v2.o ++obj-$(CONFIG_INFINIBAND_HNS) += hns-roce-hw-v2.o ++endif +diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +index e82567fcdeb7..79294f278b26 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c ++++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +@@ -389,7 +389,7 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp, + roce_set_field(ud_sq_wqe->byte_36, + V2_UD_SEND_WQE_BYTE_36_VLAN_M, + V2_UD_SEND_WQE_BYTE_36_VLAN_S, +- le16_to_cpu(ah->av.vlan)); ++ ah->av.vlan); + roce_set_field(ud_sq_wqe->byte_36, + V2_UD_SEND_WQE_BYTE_36_HOPLIMIT_M, + V2_UD_SEND_WQE_BYTE_36_HOPLIMIT_S, +@@ -4650,16 +4650,14 @@ static int hns_roce_v2_destroy_qp_common(struct hns_roce_dev *hr_dev, + { + struct hns_roce_cq *send_cq, *recv_cq; + struct ib_device *ibdev = &hr_dev->ib_dev; +- int ret; ++ int ret = 0; + + if (hr_qp->ibqp.qp_type == IB_QPT_RC && hr_qp->state != IB_QPS_RESET) { + /* Modify qp to reset before destroying qp */ + ret = hns_roce_v2_modify_qp(&hr_qp->ibqp, NULL, 0, + hr_qp->state, IB_QPS_RESET); +- if (ret) { ++ if (ret) + ibdev_err(ibdev, "modify QP to Reset failed.\n"); +- return ret; +- } + } + + send_cq = to_hr_cq(hr_qp->ibqp.send_cq); +@@ -4715,7 +4713,7 @@ static int hns_roce_v2_destroy_qp_common(struct hns_roce_dev *hr_dev, + kfree(hr_qp->rq_inl_buf.wqe_list); + } + +- return 0; ++ return ret; + } + + static int hns_roce_v2_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata) +@@ -4725,11 +4723,9 @@ static int hns_roce_v2_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata) + int ret; + + ret = hns_roce_v2_destroy_qp_common(hr_dev, hr_qp, udata); +- if (ret) { ++ if (ret) + ibdev_err(&hr_dev->ib_dev, "Destroy qp 0x%06lx failed(%d)\n", + hr_qp->qpn, ret); +- return ret; +- } + + if (hr_qp->ibqp.qp_type == IB_QPT_GSI) + kfree(hr_to_hr_sqp(hr_qp)); +@@ -6092,11 +6088,11 @@ static void hns_roce_v2_write_srqc(struct hns_roce_dev *hr_dev, + roce_set_field(srq_context->byte_44_idxbufpgsz_addr, + SRQC_BYTE_44_SRQ_IDX_BA_PG_SZ_M, + SRQC_BYTE_44_SRQ_IDX_BA_PG_SZ_S, +- hr_dev->caps.idx_ba_pg_sz); ++ hr_dev->caps.idx_ba_pg_sz + PG_SHIFT_OFFSET); + roce_set_field(srq_context->byte_44_idxbufpgsz_addr, + SRQC_BYTE_44_SRQ_IDX_BUF_PG_SZ_M, + SRQC_BYTE_44_SRQ_IDX_BUF_PG_SZ_S, +- hr_dev->caps.idx_buf_pg_sz); ++ hr_dev->caps.idx_buf_pg_sz + PG_SHIFT_OFFSET); + + srq_context->idx_nxt_blk_addr = + cpu_to_le32(mtts_idx[1] >> PAGE_ADDR_SHIFT); +diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h +index 43219d2f7de0..76a14db7028d 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.h ++++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.h +@@ -87,8 +87,8 @@ + #define HNS_ROCE_V2_MTT_ENTRY_SZ 64 + #define HNS_ROCE_V2_CQE_ENTRY_SIZE 32 + #define HNS_ROCE_V2_SCCC_ENTRY_SZ 32 +-#define HNS_ROCE_V2_QPC_TIMER_ENTRY_SZ 4096 +-#define HNS_ROCE_V2_CQC_TIMER_ENTRY_SZ 4096 ++#define HNS_ROCE_V2_QPC_TIMER_ENTRY_SZ PAGE_SIZE ++#define HNS_ROCE_V2_CQC_TIMER_ENTRY_SZ PAGE_SIZE + #define HNS_ROCE_V2_PAGE_SIZE_SUPPORTED 0xFFFFF000 + #define HNS_ROCE_V2_MAX_INNER_MTPT_NUM 2 + #define HNS_ROCE_INVALID_LKEY 0x100 +diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c +index bd78ff90d998..8dd2d666f687 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_qp.c ++++ b/drivers/infiniband/hw/hns/hns_roce_qp.c +@@ -332,9 +332,8 @@ static int check_sq_size_with_integrity(struct hns_roce_dev *hr_dev, + u8 max_sq_stride = ilog2(roundup_sq_stride); + + /* Sanity check SQ size before proceeding */ +- if ((u32)(1 << ucmd->log_sq_bb_count) > hr_dev->caps.max_wqes || +- ucmd->log_sq_stride > max_sq_stride || +- ucmd->log_sq_stride < HNS_ROCE_IB_MIN_SQ_STRIDE) { ++ if (ucmd->log_sq_stride > max_sq_stride || ++ ucmd->log_sq_stride < HNS_ROCE_IB_MIN_SQ_STRIDE) { + ibdev_err(&hr_dev->ib_dev, "check SQ size error!\n"); + return -EINVAL; + } +@@ -358,13 +357,16 @@ static int hns_roce_set_user_sq_size(struct hns_roce_dev *hr_dev, + u32 max_cnt; + int ret; + ++ if (check_shl_overflow(1, ucmd->log_sq_bb_count, &hr_qp->sq.wqe_cnt) || ++ hr_qp->sq.wqe_cnt > hr_dev->caps.max_wqes) ++ return -EINVAL; ++ + ret = check_sq_size_with_integrity(hr_dev, cap, ucmd); + if (ret) { + ibdev_err(&hr_dev->ib_dev, "Sanity check sq size failed\n"); + return ret; + } + +- hr_qp->sq.wqe_cnt = 1 << ucmd->log_sq_bb_count; + hr_qp->sq.wqe_shift = ucmd->log_sq_stride; + + max_cnt = max(1U, cap->max_send_sge); +diff --git a/drivers/infiniband/hw/hns/hns_roce_restrack.c b/drivers/infiniband/hw/hns/hns_roce_restrack.c +index 06871731ac43..39c08217e861 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_restrack.c ++++ b/drivers/infiniband/hw/hns/hns_roce_restrack.c +@@ -95,7 +95,7 @@ static int hns_roce_fill_res_cq_entry(struct sk_buff *msg, + + ret = hr_dev->dfx->query_cqc_info(hr_dev, hr_cq->cqn, (int *)context); + if (ret) +- goto err; ++ return -EINVAL; + + table_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_DRIVER); + if (!table_attr) { +diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c +index 7019c12005f4..99d563dba91b 100644 +--- a/drivers/infiniband/hw/mlx5/mr.c ++++ b/drivers/infiniband/hw/mlx5/mr.c +@@ -428,7 +428,7 @@ struct mlx5_ib_mr *mlx5_mr_cache_alloc(struct mlx5_ib_dev *dev, int entry) + + if (entry < 0 || entry >= MAX_MR_CACHE_ENTRIES) { + mlx5_ib_err(dev, "cache entry %d is out of range\n", entry); +- return NULL; ++ return ERR_PTR(-EINVAL); + } + + ent = &cache->ent[entry]; +diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw/siw_cm.c +index 8c1931a57f4a..0454561718d9 100644 +--- a/drivers/infiniband/sw/siw/siw_cm.c ++++ b/drivers/infiniband/sw/siw/siw_cm.c +@@ -1867,14 +1867,7 @@ static int siw_listen_address(struct iw_cm_id *id, int backlog, + list_add_tail(&cep->listenq, (struct list_head *)id->provider_data); + cep->state = SIW_EPSTATE_LISTENING; + +- if (addr_family == AF_INET) +- siw_dbg(id->device, "Listen at laddr %pI4 %u\n", +- &(((struct sockaddr_in *)laddr)->sin_addr), +- ((struct sockaddr_in *)laddr)->sin_port); +- else +- siw_dbg(id->device, "Listen at laddr %pI6 %u\n", +- &(((struct sockaddr_in6 *)laddr)->sin6_addr), +- ((struct sockaddr_in6 *)laddr)->sin6_port); ++ siw_dbg(id->device, "Listen at laddr %pISp\n", laddr); + + return 0; + +diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c +index e25c70a56be6..02b92e3cd9a8 100644 +--- a/drivers/infiniband/ulp/srpt/ib_srpt.c ++++ b/drivers/infiniband/ulp/srpt/ib_srpt.c +@@ -1364,9 +1364,11 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch, + struct srpt_send_ioctx *ioctx, u64 tag, + int status) + { ++ struct se_cmd *cmd = &ioctx->cmd; + struct srp_rsp *srp_rsp; + const u8 *sense_data; + int sense_data_len, max_sense_len; ++ u32 resid = cmd->residual_count; + + /* + * The lowest bit of all SAM-3 status codes is zero (see also +@@ -1388,6 +1390,28 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch, + srp_rsp->tag = tag; + srp_rsp->status = status; + ++ if (cmd->se_cmd_flags & SCF_UNDERFLOW_BIT) { ++ if (cmd->data_direction == DMA_TO_DEVICE) { ++ /* residual data from an underflow write */ ++ srp_rsp->flags = SRP_RSP_FLAG_DOUNDER; ++ srp_rsp->data_out_res_cnt = cpu_to_be32(resid); ++ } else if (cmd->data_direction == DMA_FROM_DEVICE) { ++ /* residual data from an underflow read */ ++ srp_rsp->flags = SRP_RSP_FLAG_DIUNDER; ++ srp_rsp->data_in_res_cnt = cpu_to_be32(resid); ++ } ++ } else if (cmd->se_cmd_flags & SCF_OVERFLOW_BIT) { ++ if (cmd->data_direction == DMA_TO_DEVICE) { ++ /* residual data from an overflow write */ ++ srp_rsp->flags = SRP_RSP_FLAG_DOOVER; ++ srp_rsp->data_out_res_cnt = cpu_to_be32(resid); ++ } else if (cmd->data_direction == DMA_FROM_DEVICE) { ++ /* residual data from an overflow read */ ++ srp_rsp->flags = SRP_RSP_FLAG_DIOVER; ++ srp_rsp->data_in_res_cnt = cpu_to_be32(resid); ++ } ++ } ++ + if (sense_data_len) { + BUILD_BUG_ON(MIN_MAX_RSP_SIZE <= sizeof(*srp_rsp)); + max_sense_len = ch->max_ti_iu_len - sizeof(*srp_rsp); +diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c +index 67aa317de6db..e84c5dfe146f 100644 +--- a/drivers/iommu/intel-iommu.c ++++ b/drivers/iommu/intel-iommu.c +@@ -5593,8 +5593,10 @@ static int intel_iommu_add_device(struct device *dev) + + group = iommu_group_get_for_dev(dev); + +- if (IS_ERR(group)) +- return PTR_ERR(group); ++ if (IS_ERR(group)) { ++ ret = PTR_ERR(group); ++ goto unlink; ++ } + + iommu_group_put(group); + +@@ -5620,7 +5622,8 @@ static int intel_iommu_add_device(struct device *dev) + if (!get_private_domain_for_dev(dev)) { + dev_warn(dev, + "Failed to get a private domain.\n"); +- return -ENOMEM; ++ ret = -ENOMEM; ++ goto unlink; + } + + dev_info(dev, +@@ -5635,6 +5638,10 @@ static int intel_iommu_add_device(struct device *dev) + } + + return 0; ++ ++unlink: ++ iommu_device_unlink(&iommu->iommu, dev); ++ return ret; + } + + static void intel_iommu_remove_device(struct device *dev) +diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c +index 24248aa8a7e5..cd3c0ea56657 100644 +--- a/drivers/iommu/iommu.c ++++ b/drivers/iommu/iommu.c +@@ -751,6 +751,7 @@ err_put_group: + mutex_unlock(&group->mutex); + dev->iommu_group = NULL; + kobject_put(group->devices_kobj); ++ sysfs_remove_link(group->devices_kobj, device->name); + err_free_name: + kfree(device->name); + err_remove_link: +diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c +index 67a483c1a935..c2f6c78fee44 100644 +--- a/drivers/iommu/mtk_iommu.c ++++ b/drivers/iommu/mtk_iommu.c +@@ -219,22 +219,37 @@ static void mtk_iommu_tlb_sync(void *cookie) + static void mtk_iommu_tlb_flush_walk(unsigned long iova, size_t size, + size_t granule, void *cookie) + { ++ struct mtk_iommu_data *data = cookie; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&data->tlb_lock, flags); + mtk_iommu_tlb_add_flush_nosync(iova, size, granule, false, cookie); + mtk_iommu_tlb_sync(cookie); ++ spin_unlock_irqrestore(&data->tlb_lock, flags); + } + + static void mtk_iommu_tlb_flush_leaf(unsigned long iova, size_t size, + size_t granule, void *cookie) + { ++ struct mtk_iommu_data *data = cookie; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&data->tlb_lock, flags); + mtk_iommu_tlb_add_flush_nosync(iova, size, granule, true, cookie); + mtk_iommu_tlb_sync(cookie); ++ spin_unlock_irqrestore(&data->tlb_lock, flags); + } + + static void mtk_iommu_tlb_flush_page_nosync(struct iommu_iotlb_gather *gather, + unsigned long iova, size_t granule, + void *cookie) + { ++ struct mtk_iommu_data *data = cookie; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&data->tlb_lock, flags); + mtk_iommu_tlb_add_flush_nosync(iova, granule, granule, true, cookie); ++ spin_unlock_irqrestore(&data->tlb_lock, flags); + } + + static const struct iommu_flush_ops mtk_iommu_flush_ops = { +@@ -447,13 +462,18 @@ static size_t mtk_iommu_unmap(struct iommu_domain *domain, + + static void mtk_iommu_flush_iotlb_all(struct iommu_domain *domain) + { +- mtk_iommu_tlb_sync(mtk_iommu_get_m4u_data()); ++ mtk_iommu_tlb_flush_all(mtk_iommu_get_m4u_data()); + } + + static void mtk_iommu_iotlb_sync(struct iommu_domain *domain, + struct iommu_iotlb_gather *gather) + { +- mtk_iommu_tlb_sync(mtk_iommu_get_m4u_data()); ++ struct mtk_iommu_data *data = mtk_iommu_get_m4u_data(); ++ unsigned long flags; ++ ++ spin_lock_irqsave(&data->tlb_lock, flags); ++ mtk_iommu_tlb_sync(data); ++ spin_unlock_irqrestore(&data->tlb_lock, flags); + } + + static phys_addr_t mtk_iommu_iova_to_phys(struct iommu_domain *domain, +@@ -733,6 +753,7 @@ static int mtk_iommu_probe(struct platform_device *pdev) + if (ret) + return ret; + ++ spin_lock_init(&data->tlb_lock); + list_add_tail(&data->list, &m4ulist); + + if (!iommu_present(&platform_bus_type)) +diff --git a/drivers/iommu/mtk_iommu.h b/drivers/iommu/mtk_iommu.h +index fc0f16eabacd..8cae22de7663 100644 +--- a/drivers/iommu/mtk_iommu.h ++++ b/drivers/iommu/mtk_iommu.h +@@ -58,6 +58,7 @@ struct mtk_iommu_data { + struct iommu_group *m4u_group; + bool enable_4GB; + bool tlb_flush_active; ++ spinlock_t tlb_lock; /* lock for tlb range flush */ + + struct iommu_device iommu; + const struct mtk_iommu_plat_data *plat_data; +diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c +index a5b2448c0abc..af482620f94a 100644 +--- a/drivers/media/i2c/ov6650.c ++++ b/drivers/media/i2c/ov6650.c +@@ -201,7 +201,6 @@ struct ov6650 { + unsigned long pclk_max; /* from resolution and format */ + struct v4l2_fract tpf; /* as requested with s_frame_interval */ + u32 code; +- enum v4l2_colorspace colorspace; + }; + + +@@ -214,6 +213,17 @@ static u32 ov6650_codes[] = { + MEDIA_BUS_FMT_Y8_1X8, + }; + ++static const struct v4l2_mbus_framefmt ov6650_def_fmt = { ++ .width = W_CIF, ++ .height = H_CIF, ++ .code = MEDIA_BUS_FMT_SBGGR8_1X8, ++ .colorspace = V4L2_COLORSPACE_SRGB, ++ .field = V4L2_FIELD_NONE, ++ .ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT, ++ .quantization = V4L2_QUANTIZATION_DEFAULT, ++ .xfer_func = V4L2_XFER_FUNC_DEFAULT, ++}; ++ + /* read a register */ + static int ov6650_reg_read(struct i2c_client *client, u8 reg, u8 *val) + { +@@ -514,12 +524,20 @@ static int ov6650_get_fmt(struct v4l2_subdev *sd, + if (format->pad) + return -EINVAL; + +- mf->width = priv->rect.width >> priv->half_scale; +- mf->height = priv->rect.height >> priv->half_scale; +- mf->code = priv->code; +- mf->colorspace = priv->colorspace; +- mf->field = V4L2_FIELD_NONE; ++ /* initialize response with default media bus frame format */ ++ *mf = ov6650_def_fmt; ++ ++ /* update media bus format code and frame size */ ++ if (format->which == V4L2_SUBDEV_FORMAT_TRY) { ++ mf->width = cfg->try_fmt.width; ++ mf->height = cfg->try_fmt.height; ++ mf->code = cfg->try_fmt.code; + ++ } else { ++ mf->width = priv->rect.width >> priv->half_scale; ++ mf->height = priv->rect.height >> priv->half_scale; ++ mf->code = priv->code; ++ } + return 0; + } + +@@ -624,11 +642,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) + priv->pclk_max = 8000000; + } + +- if (code == MEDIA_BUS_FMT_SBGGR8_1X8) +- priv->colorspace = V4L2_COLORSPACE_SRGB; +- else if (code != 0) +- priv->colorspace = V4L2_COLORSPACE_JPEG; +- + if (half_scale) { + dev_dbg(&client->dev, "max resolution: QCIF\n"); + coma_set |= COMA_QCIF; +@@ -662,11 +675,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) + if (!ret) + priv->code = code; + +- if (!ret) { +- mf->colorspace = priv->colorspace; +- mf->width = priv->rect.width >> half_scale; +- mf->height = priv->rect.height >> half_scale; +- } + return ret; + } + +@@ -685,8 +693,6 @@ static int ov6650_set_fmt(struct v4l2_subdev *sd, + v4l_bound_align_image(&mf->width, 2, W_CIF, 1, + &mf->height, 2, H_CIF, 1, 0); + +- mf->field = V4L2_FIELD_NONE; +- + switch (mf->code) { + case MEDIA_BUS_FMT_Y10_1X10: + mf->code = MEDIA_BUS_FMT_Y8_1X8; +@@ -696,20 +702,39 @@ static int ov6650_set_fmt(struct v4l2_subdev *sd, + case MEDIA_BUS_FMT_YUYV8_2X8: + case MEDIA_BUS_FMT_VYUY8_2X8: + case MEDIA_BUS_FMT_UYVY8_2X8: +- mf->colorspace = V4L2_COLORSPACE_JPEG; + break; + default: + mf->code = MEDIA_BUS_FMT_SBGGR8_1X8; + /* fall through */ + case MEDIA_BUS_FMT_SBGGR8_1X8: +- mf->colorspace = V4L2_COLORSPACE_SRGB; + break; + } + +- if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) +- return ov6650_s_fmt(sd, mf); +- cfg->try_fmt = *mf; ++ if (format->which == V4L2_SUBDEV_FORMAT_TRY) { ++ /* store media bus format code and frame size in pad config */ ++ cfg->try_fmt.width = mf->width; ++ cfg->try_fmt.height = mf->height; ++ cfg->try_fmt.code = mf->code; + ++ /* return default mbus frame format updated with pad config */ ++ *mf = ov6650_def_fmt; ++ mf->width = cfg->try_fmt.width; ++ mf->height = cfg->try_fmt.height; ++ mf->code = cfg->try_fmt.code; ++ ++ } else { ++ /* apply new media bus format code and frame size */ ++ int ret = ov6650_s_fmt(sd, mf); ++ ++ if (ret) ++ return ret; ++ ++ /* return default format updated with active size and code */ ++ *mf = ov6650_def_fmt; ++ mf->width = priv->rect.width >> priv->half_scale; ++ mf->height = priv->rect.height >> priv->half_scale; ++ mf->code = priv->code; ++ } + return 0; + } + +@@ -852,6 +877,11 @@ static int ov6650_video_probe(struct v4l2_subdev *sd) + ret = ov6650_reset(client); + if (!ret) + ret = ov6650_prog_dflt(client); ++ if (!ret) { ++ struct v4l2_mbus_framefmt mf = ov6650_def_fmt; ++ ++ ret = ov6650_s_fmt(sd, &mf); ++ } + if (!ret) + ret = v4l2_ctrl_handler_setup(&priv->hdl); + +@@ -1006,9 +1036,6 @@ static int ov6650_probe(struct i2c_client *client, + priv->rect.top = DEF_VSTRT << 1; + priv->rect.width = W_CIF; + priv->rect.height = H_CIF; +- priv->half_scale = false; +- priv->code = MEDIA_BUS_FMT_YUYV8_2X8; +- priv->colorspace = V4L2_COLORSPACE_JPEG; + + /* Hardware default frame interval */ + priv->tpf.numerator = GET_CLKRC_DIV(DEF_CLKRC); +diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c +index 096a7c9a8963..4eaaf39b9223 100644 +--- a/drivers/media/platform/aspeed-video.c ++++ b/drivers/media/platform/aspeed-video.c +@@ -1658,7 +1658,8 @@ static int aspeed_video_probe(struct platform_device *pdev) + { + int rc; + struct resource *res; +- struct aspeed_video *video = kzalloc(sizeof(*video), GFP_KERNEL); ++ struct aspeed_video *video = ++ devm_kzalloc(&pdev->dev, sizeof(*video), GFP_KERNEL); + + if (!video) + return -ENOMEM; +diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c +index 31ace114eda1..be9ec59774d6 100644 +--- a/drivers/media/platform/cadence/cdns-csi2rx.c ++++ b/drivers/media/platform/cadence/cdns-csi2rx.c +@@ -129,7 +129,7 @@ static int csi2rx_start(struct csi2rx_priv *csi2rx) + */ + for (i = csi2rx->num_lanes; i < csi2rx->max_lanes; i++) { + unsigned int idx = find_first_zero_bit(&lanes_used, +- sizeof(lanes_used)); ++ csi2rx->max_lanes); + set_bit(idx, &lanes_used); + reg |= CSI2RX_STATIC_CFG_DLANE_MAP(i, i + 1); + } +diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c +index 73222c0615c0..834f11fe9dc2 100644 +--- a/drivers/media/platform/coda/coda-common.c ++++ b/drivers/media/platform/coda/coda-common.c +@@ -1084,16 +1084,16 @@ static int coda_decoder_cmd(struct file *file, void *fh, + + switch (dc->cmd) { + case V4L2_DEC_CMD_START: +- mutex_lock(&ctx->bitstream_mutex); + mutex_lock(&dev->coda_mutex); ++ mutex_lock(&ctx->bitstream_mutex); + coda_bitstream_flush(ctx); +- mutex_unlock(&dev->coda_mutex); + dst_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, + V4L2_BUF_TYPE_VIDEO_CAPTURE); + vb2_clear_last_buffer_dequeued(dst_vq); + ctx->bit_stream_param &= ~CODA_BIT_STREAM_END_FLAG; + coda_fill_bitstream(ctx, NULL); + mutex_unlock(&ctx->bitstream_mutex); ++ mutex_unlock(&dev->coda_mutex); + break; + case V4L2_DEC_CMD_STOP: + stream_end = false; +diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c +index 378cc302e1f8..d2cbcdca0463 100644 +--- a/drivers/media/platform/exynos4-is/fimc-isp-video.c ++++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c +@@ -313,7 +313,7 @@ static int isp_video_release(struct file *file) + ivc->streaming = 0; + } + +- vb2_fop_release(file); ++ _vb2_fop_release(file, NULL); + + if (v4l2_fh_is_singular_file(file)) { + fimc_pipeline_call(&ivc->ve, close); +diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c +index cbc1c07f0a96..ec2796413e26 100644 +--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c ++++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c +@@ -208,6 +208,7 @@ static int rvin_try_format(struct rvin_dev *vin, u32 which, + ret = v4l2_subdev_call(sd, pad, set_fmt, pad_cfg, &format); + if (ret < 0 && ret != -ENOIOCTLCMD) + goto done; ++ ret = 0; + + v4l2_fill_pix_format(pix, &format.format); + +@@ -242,7 +243,7 @@ static int rvin_try_format(struct rvin_dev *vin, u32 which, + done: + v4l2_subdev_free_pad_config(pad_cfg); + +- return 0; ++ return ret; + } + + static int rvin_querycap(struct file *file, void *priv, +diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c +index 439d7d886873..a113e811faab 100644 +--- a/drivers/memory/mtk-smi.c ++++ b/drivers/memory/mtk-smi.c +@@ -366,6 +366,8 @@ static int __maybe_unused mtk_smi_larb_suspend(struct device *dev) + + static const struct dev_pm_ops smi_larb_pm_ops = { + SET_RUNTIME_PM_OPS(mtk_smi_larb_suspend, mtk_smi_larb_resume, NULL) ++ SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, ++ pm_runtime_force_resume) + }; + + static struct platform_driver mtk_smi_larb_driver = { +@@ -507,6 +509,8 @@ static int __maybe_unused mtk_smi_common_suspend(struct device *dev) + + static const struct dev_pm_ops smi_common_pm_ops = { + SET_RUNTIME_PM_OPS(mtk_smi_common_suspend, mtk_smi_common_resume, NULL) ++ SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, ++ pm_runtime_force_resume) + }; + + static struct platform_driver mtk_smi_common_driver = { +diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c +index 6d27ccfe0680..3c2d405bc79b 100644 +--- a/drivers/misc/enclosure.c ++++ b/drivers/misc/enclosure.c +@@ -406,10 +406,9 @@ int enclosure_remove_device(struct enclosure_device *edev, struct device *dev) + cdev = &edev->component[i]; + if (cdev->dev == dev) { + enclosure_remove_links(cdev); +- device_del(&cdev->cdev); + put_device(dev); + cdev->dev = NULL; +- return device_add(&cdev->cdev); ++ return 0; + } + } + return -ENODEV; +diff --git a/drivers/mtd/nand/onenand/omap2.c b/drivers/mtd/nand/onenand/omap2.c +index edf94ee54ec7..71a632b815aa 100644 +--- a/drivers/mtd/nand/onenand/omap2.c ++++ b/drivers/mtd/nand/onenand/omap2.c +@@ -328,7 +328,8 @@ static inline int omap2_onenand_dma_transfer(struct omap2_onenand *c, + struct dma_async_tx_descriptor *tx; + dma_cookie_t cookie; + +- tx = dmaengine_prep_dma_memcpy(c->dma_chan, dst, src, count, 0); ++ tx = dmaengine_prep_dma_memcpy(c->dma_chan, dst, src, count, ++ DMA_CTRL_ACK | DMA_PREP_INTERRUPT); + if (!tx) { + dev_err(&c->pdev->dev, "Failed to prepare DMA memcpy\n"); + return -EIO; +diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c +index 8cc852dc7d54..5c06e0b4d4ef 100644 +--- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c ++++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c +@@ -37,6 +37,7 @@ + /* Max ECC buffer length */ + #define FMC2_MAX_ECC_BUF_LEN (FMC2_BCHDSRS_LEN * FMC2_MAX_SG) + ++#define FMC2_TIMEOUT_US 1000 + #define FMC2_TIMEOUT_MS 1000 + + /* Timings */ +@@ -53,6 +54,8 @@ + #define FMC2_PMEM 0x88 + #define FMC2_PATT 0x8c + #define FMC2_HECCR 0x94 ++#define FMC2_ISR 0x184 ++#define FMC2_ICR 0x188 + #define FMC2_CSQCR 0x200 + #define FMC2_CSQCFGR1 0x204 + #define FMC2_CSQCFGR2 0x208 +@@ -118,6 +121,12 @@ + #define FMC2_PATT_ATTHIZ(x) (((x) & 0xff) << 24) + #define FMC2_PATT_DEFAULT 0x0a0a0a0a + ++/* Register: FMC2_ISR */ ++#define FMC2_ISR_IHLF BIT(1) ++ ++/* Register: FMC2_ICR */ ++#define FMC2_ICR_CIHLF BIT(1) ++ + /* Register: FMC2_CSQCR */ + #define FMC2_CSQCR_CSQSTART BIT(0) + +@@ -1322,6 +1331,31 @@ static void stm32_fmc2_write_data(struct nand_chip *chip, const void *buf, + stm32_fmc2_set_buswidth_16(fmc2, true); + } + ++static int stm32_fmc2_waitrdy(struct nand_chip *chip, unsigned long timeout_ms) ++{ ++ struct stm32_fmc2_nfc *fmc2 = to_stm32_nfc(chip->controller); ++ const struct nand_sdr_timings *timings; ++ u32 isr, sr; ++ ++ /* Check if there is no pending requests to the NAND flash */ ++ if (readl_relaxed_poll_timeout_atomic(fmc2->io_base + FMC2_SR, sr, ++ sr & FMC2_SR_NWRF, 1, ++ FMC2_TIMEOUT_US)) ++ dev_warn(fmc2->dev, "Waitrdy timeout\n"); ++ ++ /* Wait tWB before R/B# signal is low */ ++ timings = nand_get_sdr_timings(&chip->data_interface); ++ ndelay(PSEC_TO_NSEC(timings->tWB_max)); ++ ++ /* R/B# signal is low, clear high level flag */ ++ writel_relaxed(FMC2_ICR_CIHLF, fmc2->io_base + FMC2_ICR); ++ ++ /* Wait R/B# signal is high */ ++ return readl_relaxed_poll_timeout_atomic(fmc2->io_base + FMC2_ISR, ++ isr, isr & FMC2_ISR_IHLF, ++ 5, 1000 * timeout_ms); ++} ++ + static int stm32_fmc2_exec_op(struct nand_chip *chip, + const struct nand_operation *op, + bool check_only) +@@ -1366,8 +1400,8 @@ static int stm32_fmc2_exec_op(struct nand_chip *chip, + break; + + case NAND_OP_WAITRDY_INSTR: +- ret = nand_soft_waitrdy(chip, +- instr->ctx.waitrdy.timeout_ms); ++ ret = stm32_fmc2_waitrdy(chip, ++ instr->ctx.waitrdy.timeout_ms); + break; + } + } +diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c +index 7acf4a93b592..1548e0f7f5f4 100644 +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -2544,7 +2544,7 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len, + size_t *retlen, u_char *buf) + { + struct spi_nor *nor = mtd_to_spi_nor(mtd); +- int ret; ++ ssize_t ret; + + dev_dbg(nor->dev, "from 0x%08x, len %zd\n", (u32)from, len); + +@@ -2865,7 +2865,7 @@ static int spi_nor_hwcaps_pp2cmd(u32 hwcaps) + */ + static int spi_nor_read_raw(struct spi_nor *nor, u32 addr, size_t len, u8 *buf) + { +- int ret; ++ ssize_t ret; + + while (len) { + ret = spi_nor_read_data(nor, addr, len, buf); +diff --git a/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c b/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c +index 159490f5a111..60731e07f681 100644 +--- a/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c ++++ b/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c +@@ -84,7 +84,7 @@ static int ath9k_pci_fixup(struct pci_dev *pdev, const u16 *cal_data, + val = swahb32(val); + } + +- __raw_writel(val, mem + reg); ++ iowrite32(val, mem + reg); + usleep_range(100, 120); + } + +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +index d9eb2b286438..c59cbb8cbdd7 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +@@ -514,6 +514,18 @@ static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm) + struct iwl_phy_cfg_cmd phy_cfg_cmd; + enum iwl_ucode_type ucode_type = mvm->fwrt.cur_fw_img; + ++ if (iwl_mvm_has_unified_ucode(mvm) && ++ !mvm->trans->cfg->tx_with_siso_diversity) { ++ return 0; ++ } else if (mvm->trans->cfg->tx_with_siso_diversity) { ++ /* ++ * TODO: currently we don't set the antenna but letting the NIC ++ * to decide which antenna to use. This should come from BIOS. ++ */ ++ phy_cfg_cmd.phy_cfg = ++ cpu_to_le32(FW_PHY_CFG_CHAIN_SAD_ENABLED); ++ } ++ + /* Set parameters */ + phy_cfg_cmd.phy_cfg = cpu_to_le32(iwl_mvm_get_phy_config(mvm)); + +@@ -1344,12 +1356,12 @@ int iwl_mvm_up(struct iwl_mvm *mvm) + ret = iwl_send_phy_db_data(mvm->phy_db); + if (ret) + goto error; +- +- ret = iwl_send_phy_cfg_cmd(mvm); +- if (ret) +- goto error; + } + ++ ret = iwl_send_phy_cfg_cmd(mvm); ++ if (ret) ++ goto error; ++ + ret = iwl_mvm_send_bt_init_conf(mvm); + if (ret) + goto error; +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c +index 8f50e2b121bd..098d48153a38 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c +@@ -350,7 +350,13 @@ void iwl_mvm_tlc_update_notif(struct iwl_mvm *mvm, + u16 size = le32_to_cpu(notif->amsdu_size); + int i; + +- if (WARN_ON(sta->max_amsdu_len < size)) ++ /* ++ * In debug sta->max_amsdu_len < size ++ * so also check with orig_amsdu_len which holds the original ++ * data before debugfs changed the value ++ */ ++ if (WARN_ON(sta->max_amsdu_len < size && ++ mvmsta->orig_amsdu_len < size)) + goto out; + + mvmsta->amsdu_enabled = le32_to_cpu(notif->amsdu_enabled); +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +index 8a059da7a1fa..e3b2a2bf3863 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +@@ -935,7 +935,12 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb, + !(mvmsta->amsdu_enabled & BIT(tid))) + return iwl_mvm_tx_tso_segment(skb, 1, netdev_flags, mpdus_skb); + +- max_amsdu_len = iwl_mvm_max_amsdu_size(mvm, sta, tid); ++ /* ++ * Take the min of ieee80211 station and mvm station ++ */ ++ max_amsdu_len = ++ min_t(unsigned int, sta->max_amsdu_len, ++ iwl_mvm_max_amsdu_size(mvm, sta, tid)); + + /* + * Limit A-MSDU in A-MPDU to 4095 bytes when VHT is not +diff --git a/drivers/net/wireless/realtek/rtlwifi/regd.c b/drivers/net/wireless/realtek/rtlwifi/regd.c +index c10432cd703e..8be31e0ad878 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/regd.c ++++ b/drivers/net/wireless/realtek/rtlwifi/regd.c +@@ -386,7 +386,7 @@ int rtl_regd_init(struct ieee80211_hw *hw, + struct wiphy *wiphy = hw->wiphy; + struct country_code_to_enum_rd *country = NULL; + +- if (wiphy == NULL || &rtlpriv->regd == NULL) ++ if (!wiphy) + return -EINVAL; + + /* init country_code from efuse channel plan */ +diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c +index 760eaffeebd6..23a1d00b5f38 100644 +--- a/drivers/net/wireless/rsi/rsi_91x_usb.c ++++ b/drivers/net/wireless/rsi/rsi_91x_usb.c +@@ -793,7 +793,7 @@ static int rsi_probe(struct usb_interface *pfunction, + adapter->device_model = RSI_DEV_9116; + } else { + rsi_dbg(ERR_ZONE, "%s: Unsupported RSI device id 0x%x\n", +- __func__, id->idProduct); ++ __func__, id ? id->idProduct : 0x0); + goto err1; + } + +diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c +index e35e9eaa50ee..b927a92e3463 100644 +--- a/drivers/pci/controller/dwc/pci-meson.c ++++ b/drivers/pci/controller/dwc/pci-meson.c +@@ -250,15 +250,15 @@ static int meson_pcie_probe_clocks(struct meson_pcie *mp) + if (IS_ERR(res->port_clk)) + return PTR_ERR(res->port_clk); + +- res->mipi_gate = meson_pcie_probe_clock(dev, "pcie_mipi_en", 0); ++ res->mipi_gate = meson_pcie_probe_clock(dev, "mipi", 0); + if (IS_ERR(res->mipi_gate)) + return PTR_ERR(res->mipi_gate); + +- res->general_clk = meson_pcie_probe_clock(dev, "pcie_general", 0); ++ res->general_clk = meson_pcie_probe_clock(dev, "general", 0); + if (IS_ERR(res->general_clk)) + return PTR_ERR(res->general_clk); + +- res->clk = meson_pcie_probe_clock(dev, "pcie", 0); ++ res->clk = meson_pcie_probe_clock(dev, "pclk", 0); + if (IS_ERR(res->clk)) + return PTR_ERR(res->clk); + +diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c +index 0f36a926059a..8615f1548882 100644 +--- a/drivers/pci/controller/dwc/pcie-designware-host.c ++++ b/drivers/pci/controller/dwc/pcie-designware-host.c +@@ -78,7 +78,8 @@ static struct msi_domain_info dw_pcie_msi_domain_info = { + irqreturn_t dw_handle_msi_irq(struct pcie_port *pp) + { + int i, pos, irq; +- u32 val, num_ctrls; ++ unsigned long val; ++ u32 status, num_ctrls; + irqreturn_t ret = IRQ_NONE; + + num_ctrls = pp->num_vectors / MAX_MSI_IRQS_PER_CTRL; +@@ -86,14 +87,14 @@ irqreturn_t dw_handle_msi_irq(struct pcie_port *pp) + for (i = 0; i < num_ctrls; i++) { + dw_pcie_rd_own_conf(pp, PCIE_MSI_INTR0_STATUS + + (i * MSI_REG_CTRL_BLOCK_SIZE), +- 4, &val); +- if (!val) ++ 4, &status); ++ if (!status) + continue; + + ret = IRQ_HANDLED; ++ val = status; + pos = 0; +- while ((pos = find_next_bit((unsigned long *) &val, +- MAX_MSI_IRQS_PER_CTRL, ++ while ((pos = find_next_bit(&val, MAX_MSI_IRQS_PER_CTRL, + pos)) != MAX_MSI_IRQS_PER_CTRL) { + irq = irq_find_mapping(pp->irq_domain, + (i * MAX_MSI_IRQS_PER_CTRL) + +diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c +index fc0fe4d4de49..97245e076548 100644 +--- a/drivers/pci/controller/pci-aardvark.c ++++ b/drivers/pci/controller/pci-aardvark.c +@@ -180,6 +180,8 @@ + #define LINK_WAIT_MAX_RETRIES 10 + #define LINK_WAIT_USLEEP_MIN 90000 + #define LINK_WAIT_USLEEP_MAX 100000 ++#define RETRAIN_WAIT_MAX_RETRIES 10 ++#define RETRAIN_WAIT_USLEEP_US 2000 + + #define MSI_IRQ_NUM 32 + +@@ -239,6 +241,17 @@ static int advk_pcie_wait_for_link(struct advk_pcie *pcie) + return -ETIMEDOUT; + } + ++static void advk_pcie_wait_for_retrain(struct advk_pcie *pcie) ++{ ++ size_t retries; ++ ++ for (retries = 0; retries < RETRAIN_WAIT_MAX_RETRIES; ++retries) { ++ if (!advk_pcie_link_up(pcie)) ++ break; ++ udelay(RETRAIN_WAIT_USLEEP_US); ++ } ++} ++ + static void advk_pcie_setup_hw(struct advk_pcie *pcie) + { + u32 reg; +@@ -415,7 +428,7 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge, + + case PCI_EXP_RTCTL: { + u32 val = advk_readl(pcie, PCIE_ISR0_MASK_REG); +- *value = (val & PCIE_MSG_PM_PME_MASK) ? PCI_EXP_RTCTL_PMEIE : 0; ++ *value = (val & PCIE_MSG_PM_PME_MASK) ? 0 : PCI_EXP_RTCTL_PMEIE; + return PCI_BRIDGE_EMUL_HANDLED; + } + +@@ -426,11 +439,20 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge, + return PCI_BRIDGE_EMUL_HANDLED; + } + ++ case PCI_EXP_LNKCTL: { ++ /* u32 contains both PCI_EXP_LNKCTL and PCI_EXP_LNKSTA */ ++ u32 val = advk_readl(pcie, PCIE_CORE_PCIEXP_CAP + reg) & ++ ~(PCI_EXP_LNKSTA_LT << 16); ++ if (!advk_pcie_link_up(pcie)) ++ val |= (PCI_EXP_LNKSTA_LT << 16); ++ *value = val; ++ return PCI_BRIDGE_EMUL_HANDLED; ++ } ++ + case PCI_CAP_LIST_ID: + case PCI_EXP_DEVCAP: + case PCI_EXP_DEVCTL: + case PCI_EXP_LNKCAP: +- case PCI_EXP_LNKCTL: + *value = advk_readl(pcie, PCIE_CORE_PCIEXP_CAP + reg); + return PCI_BRIDGE_EMUL_HANDLED; + default: +@@ -447,14 +469,24 @@ advk_pci_bridge_emul_pcie_conf_write(struct pci_bridge_emul *bridge, + + switch (reg) { + case PCI_EXP_DEVCTL: ++ advk_writel(pcie, new, PCIE_CORE_PCIEXP_CAP + reg); ++ break; ++ + case PCI_EXP_LNKCTL: + advk_writel(pcie, new, PCIE_CORE_PCIEXP_CAP + reg); ++ if (new & PCI_EXP_LNKCTL_RL) ++ advk_pcie_wait_for_retrain(pcie); + break; + +- case PCI_EXP_RTCTL: +- new = (new & PCI_EXP_RTCTL_PMEIE) << 3; +- advk_writel(pcie, new, PCIE_ISR0_MASK_REG); ++ case PCI_EXP_RTCTL: { ++ /* Only mask/unmask PME interrupt */ ++ u32 val = advk_readl(pcie, PCIE_ISR0_MASK_REG) & ++ ~PCIE_MSG_PM_PME_MASK; ++ if ((new & PCI_EXP_RTCTL_PMEIE) == 0) ++ val |= PCIE_MSG_PM_PME_MASK; ++ advk_writel(pcie, val, PCIE_ISR0_MASK_REG); + break; ++ } + + case PCI_EXP_RTSTA: + new = (new & PCI_EXP_RTSTA_PME) >> 9; +diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c +index b3122c151b80..56daad828c9e 100644 +--- a/drivers/pci/hotplug/pciehp_core.c ++++ b/drivers/pci/hotplug/pciehp_core.c +@@ -253,7 +253,7 @@ static bool pme_is_native(struct pcie_device *dev) + return pcie_ports_native || host->native_pme; + } + +-static int pciehp_suspend(struct pcie_device *dev) ++static void pciehp_disable_interrupt(struct pcie_device *dev) + { + /* + * Disable hotplug interrupt so that it does not trigger +@@ -261,7 +261,19 @@ static int pciehp_suspend(struct pcie_device *dev) + */ + if (pme_is_native(dev)) + pcie_disable_interrupt(get_service_data(dev)); ++} + ++#ifdef CONFIG_PM_SLEEP ++static int pciehp_suspend(struct pcie_device *dev) ++{ ++ /* ++ * If the port is already runtime suspended we can keep it that ++ * way. ++ */ ++ if (dev_pm_smart_suspend_and_suspended(&dev->port->dev)) ++ return 0; ++ ++ pciehp_disable_interrupt(dev); + return 0; + } + +@@ -279,6 +291,7 @@ static int pciehp_resume_noirq(struct pcie_device *dev) + + return 0; + } ++#endif + + static int pciehp_resume(struct pcie_device *dev) + { +@@ -292,6 +305,12 @@ static int pciehp_resume(struct pcie_device *dev) + return 0; + } + ++static int pciehp_runtime_suspend(struct pcie_device *dev) ++{ ++ pciehp_disable_interrupt(dev); ++ return 0; ++} ++ + static int pciehp_runtime_resume(struct pcie_device *dev) + { + struct controller *ctrl = get_service_data(dev); +@@ -318,10 +337,12 @@ static struct pcie_port_service_driver hpdriver_portdrv = { + .remove = pciehp_remove, + + #ifdef CONFIG_PM ++#ifdef CONFIG_PM_SLEEP + .suspend = pciehp_suspend, + .resume_noirq = pciehp_resume_noirq, + .resume = pciehp_resume, +- .runtime_suspend = pciehp_suspend, ++#endif ++ .runtime_suspend = pciehp_runtime_suspend, + .runtime_resume = pciehp_runtime_resume, + #endif /* PM */ + }; +diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c +index d4ac8ce8c1f9..0c3086793e4e 100644 +--- a/drivers/pci/pci-driver.c ++++ b/drivers/pci/pci-driver.c +@@ -941,12 +941,11 @@ static int pci_pm_resume_noirq(struct device *dev) + pci_pm_default_resume_early(pci_dev); + + pci_fixup_device(pci_fixup_resume_early, pci_dev); ++ pcie_pme_root_status_cleanup(pci_dev); + + if (pci_has_legacy_pm_support(pci_dev)) + return pci_legacy_resume_early(dev); + +- pcie_pme_root_status_cleanup(pci_dev); +- + if (drv && drv->pm && drv->pm->resume_noirq) + error = drv->pm->resume_noirq(dev); + +diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c +index 98cfa30f3fae..9361f3aa26ab 100644 +--- a/drivers/pci/pcie/ptm.c ++++ b/drivers/pci/pcie/ptm.c +@@ -21,7 +21,7 @@ static void pci_ptm_info(struct pci_dev *dev) + snprintf(clock_desc, sizeof(clock_desc), ">254ns"); + break; + default: +- snprintf(clock_desc, sizeof(clock_desc), "%udns", ++ snprintf(clock_desc, sizeof(clock_desc), "%uns", + dev->ptm_granularity); + break; + } +diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c +index 64ebe3e5e611..d3033873395d 100644 +--- a/drivers/pci/probe.c ++++ b/drivers/pci/probe.c +@@ -572,6 +572,7 @@ static void devm_pci_release_host_bridge_dev(struct device *dev) + bridge->release_fn(bridge); + + pci_free_resource_list(&bridge->windows); ++ pci_free_resource_list(&bridge->dma_ranges); + } + + static void pci_release_host_bridge_dev(struct device *dev) +diff --git a/drivers/phy/motorola/phy-mapphone-mdm6600.c b/drivers/phy/motorola/phy-mapphone-mdm6600.c +index ee184d5607bd..f20524f0c21d 100644 +--- a/drivers/phy/motorola/phy-mapphone-mdm6600.c ++++ b/drivers/phy/motorola/phy-mapphone-mdm6600.c +@@ -200,7 +200,7 @@ static void phy_mdm6600_status(struct work_struct *work) + struct phy_mdm6600 *ddata; + struct device *dev; + DECLARE_BITMAP(values, PHY_MDM6600_NR_STATUS_LINES); +- int error, i, val = 0; ++ int error; + + ddata = container_of(work, struct phy_mdm6600, status_work.work); + dev = ddata->dev; +@@ -212,16 +212,11 @@ static void phy_mdm6600_status(struct work_struct *work) + if (error) + return; + +- for (i = 0; i < PHY_MDM6600_NR_STATUS_LINES; i++) { +- val |= test_bit(i, values) << i; +- dev_dbg(ddata->dev, "XXX %s: i: %i values[i]: %i val: %i\n", +- __func__, i, test_bit(i, values), val); +- } +- ddata->status = values[0]; ++ ddata->status = values[0] & ((1 << PHY_MDM6600_NR_STATUS_LINES) - 1); + + dev_info(dev, "modem status: %i %s\n", + ddata->status, +- phy_mdm6600_status_name[ddata->status & 7]); ++ phy_mdm6600_status_name[ddata->status]); + complete(&ddata->ack); + } + +diff --git a/drivers/pinctrl/cirrus/Kconfig b/drivers/pinctrl/cirrus/Kconfig +index f1806fd781a0..530426a74f75 100644 +--- a/drivers/pinctrl/cirrus/Kconfig ++++ b/drivers/pinctrl/cirrus/Kconfig +@@ -2,6 +2,7 @@ + config PINCTRL_LOCHNAGAR + tristate "Cirrus Logic Lochnagar pinctrl driver" + depends on MFD_LOCHNAGAR ++ select GPIOLIB + select PINMUX + select PINCONF + select GENERIC_PINCONF +diff --git a/drivers/pinctrl/intel/pinctrl-lewisburg.c b/drivers/pinctrl/intel/pinctrl-lewisburg.c +index 2e06fb1464ab..7fdf4257df1e 100644 +--- a/drivers/pinctrl/intel/pinctrl-lewisburg.c ++++ b/drivers/pinctrl/intel/pinctrl-lewisburg.c +@@ -33,6 +33,7 @@ + .npins = ((e) - (s) + 1), \ + } + ++/* Lewisburg */ + static const struct pinctrl_pin_desc lbg_pins[] = { + /* GPP_A */ + PINCTRL_PIN(0, "RCINB"), +@@ -72,7 +73,7 @@ static const struct pinctrl_pin_desc lbg_pins[] = { + PINCTRL_PIN(33, "SRCCLKREQB_4"), + PINCTRL_PIN(34, "SRCCLKREQB_5"), + PINCTRL_PIN(35, "GPP_B_11"), +- PINCTRL_PIN(36, "GLB_RST_WARN_N"), ++ PINCTRL_PIN(36, "SLP_S0B"), + PINCTRL_PIN(37, "PLTRSTB"), + PINCTRL_PIN(38, "SPKR"), + PINCTRL_PIN(39, "GPP_B_15"), +@@ -185,96 +186,96 @@ static const struct pinctrl_pin_desc lbg_pins[] = { + PINCTRL_PIN(141, "GBE_PCI_DIS"), + PINCTRL_PIN(142, "GBE_LAN_DIS"), + PINCTRL_PIN(143, "GPP_I_10"), +- PINCTRL_PIN(144, "GPIO_RCOMP_3P3"), + /* GPP_J */ +- PINCTRL_PIN(145, "GBE_LED_0_0"), +- PINCTRL_PIN(146, "GBE_LED_0_1"), +- PINCTRL_PIN(147, "GBE_LED_1_0"), +- PINCTRL_PIN(148, "GBE_LED_1_1"), +- PINCTRL_PIN(149, "GBE_LED_2_0"), +- PINCTRL_PIN(150, "GBE_LED_2_1"), +- PINCTRL_PIN(151, "GBE_LED_3_0"), +- PINCTRL_PIN(152, "GBE_LED_3_1"), +- PINCTRL_PIN(153, "GBE_SCL_0"), +- PINCTRL_PIN(154, "GBE_SDA_0"), +- PINCTRL_PIN(155, "GBE_SCL_1"), +- PINCTRL_PIN(156, "GBE_SDA_1"), +- PINCTRL_PIN(157, "GBE_SCL_2"), +- PINCTRL_PIN(158, "GBE_SDA_2"), +- PINCTRL_PIN(159, "GBE_SCL_3"), +- PINCTRL_PIN(160, "GBE_SDA_3"), +- PINCTRL_PIN(161, "GBE_SDP_0_0"), +- PINCTRL_PIN(162, "GBE_SDP_0_1"), +- PINCTRL_PIN(163, "GBE_SDP_1_0"), +- PINCTRL_PIN(164, "GBE_SDP_1_1"), +- PINCTRL_PIN(165, "GBE_SDP_2_0"), +- PINCTRL_PIN(166, "GBE_SDP_2_1"), +- PINCTRL_PIN(167, "GBE_SDP_3_0"), +- PINCTRL_PIN(168, "GBE_SDP_3_1"), ++ PINCTRL_PIN(144, "GBE_LED_0_0"), ++ PINCTRL_PIN(145, "GBE_LED_0_1"), ++ PINCTRL_PIN(146, "GBE_LED_1_0"), ++ PINCTRL_PIN(147, "GBE_LED_1_1"), ++ PINCTRL_PIN(148, "GBE_LED_2_0"), ++ PINCTRL_PIN(149, "GBE_LED_2_1"), ++ PINCTRL_PIN(150, "GBE_LED_3_0"), ++ PINCTRL_PIN(151, "GBE_LED_3_1"), ++ PINCTRL_PIN(152, "GBE_SCL_0"), ++ PINCTRL_PIN(153, "GBE_SDA_0"), ++ PINCTRL_PIN(154, "GBE_SCL_1"), ++ PINCTRL_PIN(155, "GBE_SDA_1"), ++ PINCTRL_PIN(156, "GBE_SCL_2"), ++ PINCTRL_PIN(157, "GBE_SDA_2"), ++ PINCTRL_PIN(158, "GBE_SCL_3"), ++ PINCTRL_PIN(159, "GBE_SDA_3"), ++ PINCTRL_PIN(160, "GBE_SDP_0_0"), ++ PINCTRL_PIN(161, "GBE_SDP_0_1"), ++ PINCTRL_PIN(162, "GBE_SDP_1_0"), ++ PINCTRL_PIN(163, "GBE_SDP_1_1"), ++ PINCTRL_PIN(164, "GBE_SDP_2_0"), ++ PINCTRL_PIN(165, "GBE_SDP_2_1"), ++ PINCTRL_PIN(166, "GBE_SDP_3_0"), ++ PINCTRL_PIN(167, "GBE_SDP_3_1"), + /* GPP_K */ +- PINCTRL_PIN(169, "GBE_RMIICLK"), +- PINCTRL_PIN(170, "GBE_RMII_TXD_0"), +- PINCTRL_PIN(171, "GBE_RMII_TXD_1"), ++ PINCTRL_PIN(168, "GBE_RMIICLK"), ++ PINCTRL_PIN(169, "GBE_RMII_RXD_0"), ++ PINCTRL_PIN(170, "GBE_RMII_RXD_1"), ++ PINCTRL_PIN(171, "GBE_RMII_CRS_DV"), + PINCTRL_PIN(172, "GBE_RMII_TX_EN"), +- PINCTRL_PIN(173, "GBE_RMII_CRS_DV"), +- PINCTRL_PIN(174, "GBE_RMII_RXD_0"), +- PINCTRL_PIN(175, "GBE_RMII_RXD_1"), +- PINCTRL_PIN(176, "GBE_RMII_RX_ER"), +- PINCTRL_PIN(177, "GBE_RMII_ARBIN"), +- PINCTRL_PIN(178, "GBE_RMII_ARB_OUT"), +- PINCTRL_PIN(179, "PE_RST_N"), +- PINCTRL_PIN(180, "GPIO_RCOMP_1P8_3P3"), ++ PINCTRL_PIN(173, "GBE_RMII_TXD_0"), ++ PINCTRL_PIN(174, "GBE_RMII_TXD_1"), ++ PINCTRL_PIN(175, "GBE_RMII_RX_ER"), ++ PINCTRL_PIN(176, "GBE_RMII_ARBIN"), ++ PINCTRL_PIN(177, "GBE_RMII_ARB_OUT"), ++ PINCTRL_PIN(178, "PE_RST_N"), + /* GPP_G */ +- PINCTRL_PIN(181, "FAN_TACH_0"), +- PINCTRL_PIN(182, "FAN_TACH_1"), +- PINCTRL_PIN(183, "FAN_TACH_2"), +- PINCTRL_PIN(184, "FAN_TACH_3"), +- PINCTRL_PIN(185, "FAN_TACH_4"), +- PINCTRL_PIN(186, "FAN_TACH_5"), +- PINCTRL_PIN(187, "FAN_TACH_6"), +- PINCTRL_PIN(188, "FAN_TACH_7"), +- PINCTRL_PIN(189, "FAN_PWM_0"), +- PINCTRL_PIN(190, "FAN_PWM_1"), +- PINCTRL_PIN(191, "FAN_PWM_2"), +- PINCTRL_PIN(192, "FAN_PWM_3"), +- PINCTRL_PIN(193, "GSXDOUT"), +- PINCTRL_PIN(194, "GSXSLOAD"), +- PINCTRL_PIN(195, "GSXDIN"), +- PINCTRL_PIN(196, "GSXSRESETB"), +- PINCTRL_PIN(197, "GSXCLK"), +- PINCTRL_PIN(198, "ADR_COMPLETE"), +- PINCTRL_PIN(199, "NMIB"), +- PINCTRL_PIN(200, "SMIB"), +- PINCTRL_PIN(201, "SSATA_DEVSLP_0"), +- PINCTRL_PIN(202, "SSATA_DEVSLP_1"), +- PINCTRL_PIN(203, "SSATA_DEVSLP_2"), +- PINCTRL_PIN(204, "SSATAXPCIE0_SSATAGP0"), ++ PINCTRL_PIN(179, "FAN_TACH_0"), ++ PINCTRL_PIN(180, "FAN_TACH_1"), ++ PINCTRL_PIN(181, "FAN_TACH_2"), ++ PINCTRL_PIN(182, "FAN_TACH_3"), ++ PINCTRL_PIN(183, "FAN_TACH_4"), ++ PINCTRL_PIN(184, "FAN_TACH_5"), ++ PINCTRL_PIN(185, "FAN_TACH_6"), ++ PINCTRL_PIN(186, "FAN_TACH_7"), ++ PINCTRL_PIN(187, "FAN_PWM_0"), ++ PINCTRL_PIN(188, "FAN_PWM_1"), ++ PINCTRL_PIN(189, "FAN_PWM_2"), ++ PINCTRL_PIN(190, "FAN_PWM_3"), ++ PINCTRL_PIN(191, "GSXDOUT"), ++ PINCTRL_PIN(192, "GSXSLOAD"), ++ PINCTRL_PIN(193, "GSXDIN"), ++ PINCTRL_PIN(194, "GSXSRESETB"), ++ PINCTRL_PIN(195, "GSXCLK"), ++ PINCTRL_PIN(196, "ADR_COMPLETE"), ++ PINCTRL_PIN(197, "NMIB"), ++ PINCTRL_PIN(198, "SMIB"), ++ PINCTRL_PIN(199, "SSATA_DEVSLP_0"), ++ PINCTRL_PIN(200, "SSATA_DEVSLP_1"), ++ PINCTRL_PIN(201, "SSATA_DEVSLP_2"), ++ PINCTRL_PIN(202, "SSATAXPCIE0_SSATAGP0"), + /* GPP_H */ +- PINCTRL_PIN(205, "SRCCLKREQB_6"), +- PINCTRL_PIN(206, "SRCCLKREQB_7"), +- PINCTRL_PIN(207, "SRCCLKREQB_8"), +- PINCTRL_PIN(208, "SRCCLKREQB_9"), +- PINCTRL_PIN(209, "SRCCLKREQB_10"), +- PINCTRL_PIN(210, "SRCCLKREQB_11"), +- PINCTRL_PIN(211, "SRCCLKREQB_12"), +- PINCTRL_PIN(212, "SRCCLKREQB_13"), +- PINCTRL_PIN(213, "SRCCLKREQB_14"), +- PINCTRL_PIN(214, "SRCCLKREQB_15"), +- PINCTRL_PIN(215, "SML2CLK"), +- PINCTRL_PIN(216, "SML2DATA"), +- PINCTRL_PIN(217, "SML2ALERTB"), +- PINCTRL_PIN(218, "SML3CLK"), +- PINCTRL_PIN(219, "SML3DATA"), +- PINCTRL_PIN(220, "SML3ALERTB"), +- PINCTRL_PIN(221, "SML4CLK"), +- PINCTRL_PIN(222, "SML4DATA"), +- PINCTRL_PIN(223, "SML4ALERTB"), +- PINCTRL_PIN(224, "SSATAXPCIE1_SSATAGP1"), +- PINCTRL_PIN(225, "SSATAXPCIE2_SSATAGP2"), +- PINCTRL_PIN(226, "SSATAXPCIE3_SSATAGP3"), +- PINCTRL_PIN(227, "SSATAXPCIE4_SSATAGP4"), +- PINCTRL_PIN(228, "SSATAXPCIE5_SSATAGP5"), ++ PINCTRL_PIN(203, "SRCCLKREQB_6"), ++ PINCTRL_PIN(204, "SRCCLKREQB_7"), ++ PINCTRL_PIN(205, "SRCCLKREQB_8"), ++ PINCTRL_PIN(206, "SRCCLKREQB_9"), ++ PINCTRL_PIN(207, "SRCCLKREQB_10"), ++ PINCTRL_PIN(208, "SRCCLKREQB_11"), ++ PINCTRL_PIN(209, "SRCCLKREQB_12"), ++ PINCTRL_PIN(210, "SRCCLKREQB_13"), ++ PINCTRL_PIN(211, "SRCCLKREQB_14"), ++ PINCTRL_PIN(212, "SRCCLKREQB_15"), ++ PINCTRL_PIN(213, "SML2CLK"), ++ PINCTRL_PIN(214, "SML2DATA"), ++ PINCTRL_PIN(215, "SML2ALERTB"), ++ PINCTRL_PIN(216, "SML3CLK"), ++ PINCTRL_PIN(217, "SML3DATA"), ++ PINCTRL_PIN(218, "SML3ALERTB"), ++ PINCTRL_PIN(219, "SML4CLK"), ++ PINCTRL_PIN(220, "SML4DATA"), ++ PINCTRL_PIN(221, "SML4ALERTB"), ++ PINCTRL_PIN(222, "SSATAXPCIE1_SSATAGP1"), ++ PINCTRL_PIN(223, "SSATAXPCIE2_SSATAGP2"), ++ PINCTRL_PIN(224, "SSATAXPCIE3_SSATAGP3"), ++ PINCTRL_PIN(225, "SSATAXPCIE4_SSATAGP4"), ++ PINCTRL_PIN(226, "SSATAXPCIE5_SSATAGP5"), + /* GPP_L */ ++ PINCTRL_PIN(227, "GPP_L_0"), ++ PINCTRL_PIN(228, "EC_CSME_INTR_OUT"), + PINCTRL_PIN(229, "VISA2CH0_D0"), + PINCTRL_PIN(230, "VISA2CH0_D1"), + PINCTRL_PIN(231, "VISA2CH0_D2"), +diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c +index 8bba9d053d9f..aba479a1150c 100644 +--- a/drivers/pinctrl/meson/pinctrl-meson.c ++++ b/drivers/pinctrl/meson/pinctrl-meson.c +@@ -441,6 +441,7 @@ static int meson_pinconf_get_drive_strength(struct meson_pinctrl *pc, + return ret; + + meson_calc_reg_and_bit(bank, pin, REG_DS, ®, &bit); ++ bit = bit << 1; + + ret = regmap_read(pc->reg_ds, reg, &val); + if (ret) +diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c +index b8640ad41bef..ce983247c9e2 100644 +--- a/drivers/pinctrl/sh-pfc/core.c ++++ b/drivers/pinctrl/sh-pfc/core.c +@@ -29,12 +29,12 @@ + static int sh_pfc_map_resources(struct sh_pfc *pfc, + struct platform_device *pdev) + { +- unsigned int num_windows, num_irqs; + struct sh_pfc_window *windows; + unsigned int *irqs = NULL; ++ unsigned int num_windows; + struct resource *res; + unsigned int i; +- int irq; ++ int num_irqs; + + /* Count the MEM and IRQ resources. */ + for (num_windows = 0;; num_windows++) { +@@ -42,17 +42,13 @@ static int sh_pfc_map_resources(struct sh_pfc *pfc, + if (!res) + break; + } +- for (num_irqs = 0;; num_irqs++) { +- irq = platform_get_irq(pdev, num_irqs); +- if (irq == -EPROBE_DEFER) +- return irq; +- if (irq < 0) +- break; +- } +- + if (num_windows == 0) + return -EINVAL; + ++ num_irqs = platform_irq_count(pdev); ++ if (num_irqs < 0) ++ return num_irqs; ++ + /* Allocate memory windows and IRQs arrays. */ + windows = devm_kcalloc(pfc->dev, num_windows, sizeof(*windows), + GFP_KERNEL); +diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h +index 835148fc0f28..cab7da130925 100644 +--- a/drivers/pinctrl/sh-pfc/sh_pfc.h ++++ b/drivers/pinctrl/sh-pfc/sh_pfc.h +@@ -422,12 +422,12 @@ extern const struct sh_pfc_soc_info shx3_pinmux_info; + /* + * Describe a pinmux configuration in which a pin is physically multiplexed + * with other pins. +- * - ipsr: IPSR field (unused, for documentation purposes only) ++ * - ipsr: IPSR field + * - fn: Function name + * - psel: Physical multiplexing selector + */ + #define PINMUX_IPSR_PHYS(ipsr, fn, psel) \ +- PINMUX_DATA(fn##_MARK, FN_##psel) ++ PINMUX_DATA(fn##_MARK, FN_##psel, FN_##ipsr) + + /* + * Describe a pinmux configuration for a single-function pin with GPIO +diff --git a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c +index e5e7f1f22813..b522ca010332 100644 +--- a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c ++++ b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c +@@ -496,7 +496,7 @@ static int ti_iodelay_dt_node_to_map(struct pinctrl_dev *pctldev, + return -EINVAL; + + rows = pinctrl_count_index_with_args(np, name); +- if (rows == -EINVAL) ++ if (rows < 0) + return rows; + + *map = devm_kzalloc(iod->dev, sizeof(**map), GFP_KERNEL); +diff --git a/drivers/platform/mellanox/mlxbf-tmfifo.c b/drivers/platform/mellanox/mlxbf-tmfifo.c +index 9a5c9fd2dbc6..5739a9669b29 100644 +--- a/drivers/platform/mellanox/mlxbf-tmfifo.c ++++ b/drivers/platform/mellanox/mlxbf-tmfifo.c +@@ -149,7 +149,7 @@ struct mlxbf_tmfifo_irq_info { + * @work: work struct for deferred process + * @timer: background timer + * @vring: Tx/Rx ring +- * @spin_lock: spin lock ++ * @spin_lock: Tx/Rx spin lock + * @is_ready: ready flag + */ + struct mlxbf_tmfifo { +@@ -164,7 +164,7 @@ struct mlxbf_tmfifo { + struct work_struct work; + struct timer_list timer; + struct mlxbf_tmfifo_vring *vring[2]; +- spinlock_t spin_lock; /* spin lock */ ++ spinlock_t spin_lock[2]; /* spin lock */ + bool is_ready; + }; + +@@ -525,7 +525,7 @@ static void mlxbf_tmfifo_console_tx(struct mlxbf_tmfifo *fifo, int avail) + writeq(*(u64 *)&hdr, fifo->tx_base + MLXBF_TMFIFO_TX_DATA); + + /* Use spin-lock to protect the 'cons->tx_buf'. */ +- spin_lock_irqsave(&fifo->spin_lock, flags); ++ spin_lock_irqsave(&fifo->spin_lock[0], flags); + + while (size > 0) { + addr = cons->tx_buf.buf + cons->tx_buf.tail; +@@ -552,7 +552,7 @@ static void mlxbf_tmfifo_console_tx(struct mlxbf_tmfifo *fifo, int avail) + } + } + +- spin_unlock_irqrestore(&fifo->spin_lock, flags); ++ spin_unlock_irqrestore(&fifo->spin_lock[0], flags); + } + + /* Rx/Tx one word in the descriptor buffer. */ +@@ -731,9 +731,9 @@ static bool mlxbf_tmfifo_rxtx_one_desc(struct mlxbf_tmfifo_vring *vring, + fifo->vring[is_rx] = NULL; + + /* Notify upper layer that packet is done. */ +- spin_lock_irqsave(&fifo->spin_lock, flags); ++ spin_lock_irqsave(&fifo->spin_lock[is_rx], flags); + vring_interrupt(0, vring->vq); +- spin_unlock_irqrestore(&fifo->spin_lock, flags); ++ spin_unlock_irqrestore(&fifo->spin_lock[is_rx], flags); + } + + mlxbf_tmfifo_desc_done: +@@ -852,10 +852,10 @@ static bool mlxbf_tmfifo_virtio_notify(struct virtqueue *vq) + * worker handler. + */ + if (vring->vdev_id == VIRTIO_ID_CONSOLE) { +- spin_lock_irqsave(&fifo->spin_lock, flags); ++ spin_lock_irqsave(&fifo->spin_lock[0], flags); + tm_vdev = fifo->vdev[VIRTIO_ID_CONSOLE]; + mlxbf_tmfifo_console_output(tm_vdev, vring); +- spin_unlock_irqrestore(&fifo->spin_lock, flags); ++ spin_unlock_irqrestore(&fifo->spin_lock[0], flags); + } else if (test_and_set_bit(MLXBF_TM_TX_LWM_IRQ, + &fifo->pend_events)) { + return true; +@@ -1189,7 +1189,8 @@ static int mlxbf_tmfifo_probe(struct platform_device *pdev) + if (!fifo) + return -ENOMEM; + +- spin_lock_init(&fifo->spin_lock); ++ spin_lock_init(&fifo->spin_lock[0]); ++ spin_lock_init(&fifo->spin_lock[1]); + INIT_WORK(&fifo->work, mlxbf_tmfifo_work_handler); + mutex_init(&fifo->lock); + +diff --git a/drivers/platform/mips/cpu_hwmon.c b/drivers/platform/mips/cpu_hwmon.c +index a7f184bb47e0..3d29a11c1d6b 100644 +--- a/drivers/platform/mips/cpu_hwmon.c ++++ b/drivers/platform/mips/cpu_hwmon.c +@@ -161,7 +161,7 @@ static int __init loongson_hwmon_init(void) + + cpu_hwmon_dev = hwmon_device_register(NULL); + if (IS_ERR(cpu_hwmon_dev)) { +- ret = -ENOMEM; ++ ret = PTR_ERR(cpu_hwmon_dev); + pr_err("hwmon_device_register fail!\n"); + goto fail_hwmon_device_register; + } +diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c +index 821b08e01635..982f0cc8270c 100644 +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -512,13 +512,7 @@ static void kbd_led_update(struct asus_wmi *asus) + { + int ctrl_param = 0; + +- /* +- * bits 0-2: level +- * bit 7: light on/off +- */ +- if (asus->kbd_led_wk > 0) +- ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F); +- ++ ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F); + asus_wmi_set_devstate(ASUS_WMI_DEVID_KBD_BACKLIGHT, ctrl_param, NULL); + } + +diff --git a/drivers/platform/x86/gpd-pocket-fan.c b/drivers/platform/x86/gpd-pocket-fan.c +index be85ed966bf3..73eb1572b966 100644 +--- a/drivers/platform/x86/gpd-pocket-fan.c ++++ b/drivers/platform/x86/gpd-pocket-fan.c +@@ -16,17 +16,27 @@ + + #define MAX_SPEED 3 + +-static int temp_limits[3] = { 55000, 60000, 65000 }; ++#define TEMP_LIMIT0_DEFAULT 55000 ++#define TEMP_LIMIT1_DEFAULT 60000 ++#define TEMP_LIMIT2_DEFAULT 65000 ++ ++#define HYSTERESIS_DEFAULT 3000 ++ ++#define SPEED_ON_AC_DEFAULT 2 ++ ++static int temp_limits[3] = { ++ TEMP_LIMIT0_DEFAULT, TEMP_LIMIT1_DEFAULT, TEMP_LIMIT2_DEFAULT, ++}; + module_param_array(temp_limits, int, NULL, 0444); + MODULE_PARM_DESC(temp_limits, + "Millicelsius values above which the fan speed increases"); + +-static int hysteresis = 3000; ++static int hysteresis = HYSTERESIS_DEFAULT; + module_param(hysteresis, int, 0444); + MODULE_PARM_DESC(hysteresis, + "Hysteresis in millicelsius before lowering the fan speed"); + +-static int speed_on_ac = 2; ++static int speed_on_ac = SPEED_ON_AC_DEFAULT; + module_param(speed_on_ac, int, 0444); + MODULE_PARM_DESC(speed_on_ac, + "minimum fan speed to allow when system is powered by AC"); +@@ -120,18 +130,21 @@ static int gpd_pocket_fan_probe(struct platform_device *pdev) + if (temp_limits[i] < 40000 || temp_limits[i] > 70000) { + dev_err(&pdev->dev, "Invalid temp-limit %d (must be between 40000 and 70000)\n", + temp_limits[i]); +- return -EINVAL; ++ temp_limits[0] = TEMP_LIMIT0_DEFAULT; ++ temp_limits[1] = TEMP_LIMIT1_DEFAULT; ++ temp_limits[2] = TEMP_LIMIT2_DEFAULT; ++ break; + } + } + if (hysteresis < 1000 || hysteresis > 10000) { + dev_err(&pdev->dev, "Invalid hysteresis %d (must be between 1000 and 10000)\n", + hysteresis); +- return -EINVAL; ++ hysteresis = HYSTERESIS_DEFAULT; + } + if (speed_on_ac < 0 || speed_on_ac > MAX_SPEED) { + dev_err(&pdev->dev, "Invalid speed_on_ac %d (must be between 0 and 3)\n", + speed_on_ac); +- return -EINVAL; ++ speed_on_ac = SPEED_ON_AC_DEFAULT; + } + + fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL); +diff --git a/drivers/reset/reset-brcmstb.c b/drivers/reset/reset-brcmstb.c +index a608f445dad6..f213264c8567 100644 +--- a/drivers/reset/reset-brcmstb.c ++++ b/drivers/reset/reset-brcmstb.c +@@ -91,12 +91,6 @@ static int brcmstb_reset_probe(struct platform_device *pdev) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- if (!IS_ALIGNED(res->start, SW_INIT_BANK_SIZE) || +- !IS_ALIGNED(resource_size(res), SW_INIT_BANK_SIZE)) { +- dev_err(kdev, "incorrect register range\n"); +- return -EINVAL; +- } +- + priv->base = devm_ioremap_resource(kdev, res); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); +diff --git a/drivers/rtc/rtc-bd70528.c b/drivers/rtc/rtc-bd70528.c +index 7744333b0f40..ddfef4d43bab 100644 +--- a/drivers/rtc/rtc-bd70528.c ++++ b/drivers/rtc/rtc-bd70528.c +@@ -491,3 +491,4 @@ module_platform_driver(bd70528_rtc); + MODULE_AUTHOR("Matti Vaittinen "); + MODULE_DESCRIPTION("BD70528 RTC driver"); + MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platofrm:bd70528-rtc"); +diff --git a/drivers/rtc/rtc-brcmstb-waketimer.c b/drivers/rtc/rtc-brcmstb-waketimer.c +index 3e9800f9878a..82d2ab0b3e9c 100644 +--- a/drivers/rtc/rtc-brcmstb-waketimer.c ++++ b/drivers/rtc/rtc-brcmstb-waketimer.c +@@ -277,6 +277,7 @@ static int brcmstb_waketmr_remove(struct platform_device *pdev) + struct brcmstb_waketmr *timer = dev_get_drvdata(&pdev->dev); + + unregister_reboot_notifier(&timer->reboot_notifier); ++ clk_disable_unprepare(timer->clk); + + return 0; + } +diff --git a/drivers/rtc/rtc-msm6242.c b/drivers/rtc/rtc-msm6242.c +index 1c2d3c4a4963..b1f2bedee77e 100644 +--- a/drivers/rtc/rtc-msm6242.c ++++ b/drivers/rtc/rtc-msm6242.c +@@ -133,7 +133,8 @@ static int msm6242_read_time(struct device *dev, struct rtc_time *tm) + msm6242_read(priv, MSM6242_SECOND1); + tm->tm_min = msm6242_read(priv, MSM6242_MINUTE10) * 10 + + msm6242_read(priv, MSM6242_MINUTE1); +- tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10 & 3)) * 10 + ++ tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10) & ++ MSM6242_HOUR10_HR_MASK) * 10 + + msm6242_read(priv, MSM6242_HOUR1); + tm->tm_mday = msm6242_read(priv, MSM6242_DAY10) * 10 + + msm6242_read(priv, MSM6242_DAY1); +diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c +index 704229eb0cac..b216bdcba0da 100644 +--- a/drivers/rtc/rtc-mt6397.c ++++ b/drivers/rtc/rtc-mt6397.c +@@ -47,6 +47,14 @@ + + #define RTC_AL_SEC 0x0018 + ++#define RTC_AL_SEC_MASK 0x003f ++#define RTC_AL_MIN_MASK 0x003f ++#define RTC_AL_HOU_MASK 0x001f ++#define RTC_AL_DOM_MASK 0x001f ++#define RTC_AL_DOW_MASK 0x0007 ++#define RTC_AL_MTH_MASK 0x000f ++#define RTC_AL_YEA_MASK 0x007f ++ + #define RTC_PDN2 0x002e + #define RTC_PDN2_PWRON_ALARM BIT(4) + +@@ -103,7 +111,7 @@ static irqreturn_t mtk_rtc_irq_handler_thread(int irq, void *data) + irqen = irqsta & ~RTC_IRQ_EN_AL; + mutex_lock(&rtc->lock); + if (regmap_write(rtc->regmap, rtc->addr_base + RTC_IRQ_EN, +- irqen) < 0) ++ irqen) == 0) + mtk_rtc_write_trigger(rtc); + mutex_unlock(&rtc->lock); + +@@ -225,12 +233,12 @@ static int mtk_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) + alm->pending = !!(pdn2 & RTC_PDN2_PWRON_ALARM); + mutex_unlock(&rtc->lock); + +- tm->tm_sec = data[RTC_OFFSET_SEC]; +- tm->tm_min = data[RTC_OFFSET_MIN]; +- tm->tm_hour = data[RTC_OFFSET_HOUR]; +- tm->tm_mday = data[RTC_OFFSET_DOM]; +- tm->tm_mon = data[RTC_OFFSET_MTH]; +- tm->tm_year = data[RTC_OFFSET_YEAR]; ++ tm->tm_sec = data[RTC_OFFSET_SEC] & RTC_AL_SEC_MASK; ++ tm->tm_min = data[RTC_OFFSET_MIN] & RTC_AL_MIN_MASK; ++ tm->tm_hour = data[RTC_OFFSET_HOUR] & RTC_AL_HOU_MASK; ++ tm->tm_mday = data[RTC_OFFSET_DOM] & RTC_AL_DOM_MASK; ++ tm->tm_mon = data[RTC_OFFSET_MTH] & RTC_AL_MTH_MASK; ++ tm->tm_year = data[RTC_OFFSET_YEAR] & RTC_AL_YEA_MASK; + + tm->tm_year += RTC_MIN_YEAR_OFFSET; + tm->tm_mon--; +@@ -251,14 +259,25 @@ static int mtk_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) + tm->tm_year -= RTC_MIN_YEAR_OFFSET; + tm->tm_mon++; + +- data[RTC_OFFSET_SEC] = tm->tm_sec; +- data[RTC_OFFSET_MIN] = tm->tm_min; +- data[RTC_OFFSET_HOUR] = tm->tm_hour; +- data[RTC_OFFSET_DOM] = tm->tm_mday; +- data[RTC_OFFSET_MTH] = tm->tm_mon; +- data[RTC_OFFSET_YEAR] = tm->tm_year; +- + mutex_lock(&rtc->lock); ++ ret = regmap_bulk_read(rtc->regmap, rtc->addr_base + RTC_AL_SEC, ++ data, RTC_OFFSET_COUNT); ++ if (ret < 0) ++ goto exit; ++ ++ data[RTC_OFFSET_SEC] = ((data[RTC_OFFSET_SEC] & ~(RTC_AL_SEC_MASK)) | ++ (tm->tm_sec & RTC_AL_SEC_MASK)); ++ data[RTC_OFFSET_MIN] = ((data[RTC_OFFSET_MIN] & ~(RTC_AL_MIN_MASK)) | ++ (tm->tm_min & RTC_AL_MIN_MASK)); ++ data[RTC_OFFSET_HOUR] = ((data[RTC_OFFSET_HOUR] & ~(RTC_AL_HOU_MASK)) | ++ (tm->tm_hour & RTC_AL_HOU_MASK)); ++ data[RTC_OFFSET_DOM] = ((data[RTC_OFFSET_DOM] & ~(RTC_AL_DOM_MASK)) | ++ (tm->tm_mday & RTC_AL_DOM_MASK)); ++ data[RTC_OFFSET_MTH] = ((data[RTC_OFFSET_MTH] & ~(RTC_AL_MTH_MASK)) | ++ (tm->tm_mon & RTC_AL_MTH_MASK)); ++ data[RTC_OFFSET_YEAR] = ((data[RTC_OFFSET_YEAR] & ~(RTC_AL_YEA_MASK)) | ++ (tm->tm_year & RTC_AL_YEA_MASK)); ++ + if (alm->enabled) { + ret = regmap_bulk_write(rtc->regmap, + rtc->addr_base + RTC_AL_SEC, +diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c +index 9df47421d69c..5be4d800e4ba 100644 +--- a/drivers/s390/net/qeth_core_main.c ++++ b/drivers/s390/net/qeth_core_main.c +@@ -2451,50 +2451,46 @@ static int qeth_mpc_initialize(struct qeth_card *card) + rc = qeth_cm_enable(card); + if (rc) { + QETH_CARD_TEXT_(card, 2, "2err%d", rc); +- goto out_qdio; ++ return rc; + } + rc = qeth_cm_setup(card); + if (rc) { + QETH_CARD_TEXT_(card, 2, "3err%d", rc); +- goto out_qdio; ++ return rc; + } + rc = qeth_ulp_enable(card); + if (rc) { + QETH_CARD_TEXT_(card, 2, "4err%d", rc); +- goto out_qdio; ++ return rc; + } + rc = qeth_ulp_setup(card); + if (rc) { + QETH_CARD_TEXT_(card, 2, "5err%d", rc); +- goto out_qdio; ++ return rc; + } + rc = qeth_alloc_qdio_queues(card); + if (rc) { + QETH_CARD_TEXT_(card, 2, "5err%d", rc); +- goto out_qdio; ++ return rc; + } + rc = qeth_qdio_establish(card); + if (rc) { + QETH_CARD_TEXT_(card, 2, "6err%d", rc); + qeth_free_qdio_queues(card); +- goto out_qdio; ++ return rc; + } + rc = qeth_qdio_activate(card); + if (rc) { + QETH_CARD_TEXT_(card, 2, "7err%d", rc); +- goto out_qdio; ++ return rc; + } + rc = qeth_dm_act(card); + if (rc) { + QETH_CARD_TEXT_(card, 2, "8err%d", rc); +- goto out_qdio; ++ return rc; + } + + return 0; +-out_qdio: +- qeth_qdio_clear_card(card, !IS_IQD(card)); +- qdio_free(CARD_DDEV(card)); +- return rc; + } + + void qeth_print_status_message(struct qeth_card *card) +@@ -3382,11 +3378,6 @@ int qeth_configure_cq(struct qeth_card *card, enum qeth_cq cq) + goto out; + } + +- if (card->state != CARD_STATE_DOWN) { +- rc = -1; +- goto out; +- } +- + qeth_free_qdio_queues(card); + card->options.cq = cq; + rc = 0; +@@ -4972,10 +4963,8 @@ retriable: + } + if (qeth_adp_supported(card, IPA_SETADP_SET_DIAG_ASSIST)) { + rc = qeth_query_setdiagass(card); +- if (rc < 0) { ++ if (rc) + QETH_CARD_TEXT_(card, 2, "8err%d", rc); +- goto out; +- } + } + return 0; + out: +diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c +index 8b7d911dccd8..11e3292c0adf 100644 +--- a/drivers/s390/net/qeth_l2_main.c ++++ b/drivers/s390/net/qeth_l2_main.c +@@ -287,12 +287,12 @@ static void qeth_l2_stop_card(struct qeth_card *card) + card->state = CARD_STATE_HARDSETUP; + } + if (card->state == CARD_STATE_HARDSETUP) { +- qeth_qdio_clear_card(card, 0); + qeth_drain_output_queues(card); + qeth_clear_working_pool_list(card); + card->state = CARD_STATE_DOWN; + } + ++ qeth_qdio_clear_card(card, 0); + flush_workqueue(card->event_wq); + card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; + card->info.promisc_mode = 0; +@@ -1983,8 +1983,7 @@ int qeth_l2_vnicc_get_timeout(struct qeth_card *card, u32 *timeout) + /* check if VNICC is currently enabled */ + bool qeth_l2_vnicc_is_in_use(struct qeth_card *card) + { +- /* if everything is turned off, VNICC is not active */ +- if (!card->options.vnicc.cur_chars) ++ if (!card->options.vnicc.sup_chars) + return false; + /* default values are only OK if rx_bcast was not enabled by user + * or the card is offline. +@@ -2071,8 +2070,9 @@ static void qeth_l2_vnicc_init(struct qeth_card *card) + /* enforce assumed default values and recover settings, if changed */ + error |= qeth_l2_vnicc_recover_timeout(card, QETH_VNICC_LEARNING, + timeout); +- chars_tmp = card->options.vnicc.wanted_chars ^ QETH_VNICC_DEFAULT; +- chars_tmp |= QETH_VNICC_BRIDGE_INVISIBLE; ++ /* Change chars, if necessary */ ++ chars_tmp = card->options.vnicc.wanted_chars ^ ++ card->options.vnicc.cur_chars; + chars_len = sizeof(card->options.vnicc.wanted_chars) * BITS_PER_BYTE; + for_each_set_bit(i, &chars_tmp, chars_len) { + vnicc = BIT(i); +diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c +index 32385327539b..5152970a9aa4 100644 +--- a/drivers/s390/net/qeth_l3_main.c ++++ b/drivers/s390/net/qeth_l3_main.c +@@ -1426,12 +1426,12 @@ static void qeth_l3_stop_card(struct qeth_card *card) + card->state = CARD_STATE_HARDSETUP; + } + if (card->state == CARD_STATE_HARDSETUP) { +- qeth_qdio_clear_card(card, 0); + qeth_drain_output_queues(card); + qeth_clear_working_pool_list(card); + card->state = CARD_STATE_DOWN; + } + ++ qeth_qdio_clear_card(card, 0); + flush_workqueue(card->event_wq); + card->info.promisc_mode = 0; + } +diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c +index 2f73b33c9347..333fd4619dc6 100644 +--- a/drivers/s390/net/qeth_l3_sys.c ++++ b/drivers/s390/net/qeth_l3_sys.c +@@ -270,24 +270,36 @@ static ssize_t qeth_l3_dev_hsuid_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) + { + struct qeth_card *card = dev_get_drvdata(dev); ++ int rc = 0; + char *tmp; +- int rc; + + if (!card) + return -EINVAL; + + if (!IS_IQD(card)) + return -EPERM; +- if (card->state != CARD_STATE_DOWN) +- return -EPERM; +- if (card->options.sniffer) +- return -EPERM; +- if (card->options.cq == QETH_CQ_NOTAVAILABLE) +- return -EPERM; ++ ++ mutex_lock(&card->conf_mutex); ++ if (card->state != CARD_STATE_DOWN) { ++ rc = -EPERM; ++ goto out; ++ } ++ ++ if (card->options.sniffer) { ++ rc = -EPERM; ++ goto out; ++ } ++ ++ if (card->options.cq == QETH_CQ_NOTAVAILABLE) { ++ rc = -EPERM; ++ goto out; ++ } + + tmp = strsep((char **)&buf, "\n"); +- if (strlen(tmp) > 8) +- return -EINVAL; ++ if (strlen(tmp) > 8) { ++ rc = -EINVAL; ++ goto out; ++ } + + if (card->options.hsuid[0]) + /* delete old ip address */ +@@ -298,11 +310,13 @@ static ssize_t qeth_l3_dev_hsuid_store(struct device *dev, + card->options.hsuid[0] = '\0'; + memcpy(card->dev->perm_addr, card->options.hsuid, 9); + qeth_configure_cq(card, QETH_CQ_DISABLED); +- return count; ++ goto out; + } + +- if (qeth_configure_cq(card, QETH_CQ_ENABLED)) +- return -EPERM; ++ if (qeth_configure_cq(card, QETH_CQ_ENABLED)) { ++ rc = -EPERM; ++ goto out; ++ } + + snprintf(card->options.hsuid, sizeof(card->options.hsuid), + "%-8s", tmp); +@@ -311,6 +325,8 @@ static ssize_t qeth_l3_dev_hsuid_store(struct device *dev, + + rc = qeth_l3_modify_hsuid(card, true); + ++out: ++ mutex_unlock(&card->conf_mutex); + return rc ? rc : count; + } + +diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c +index 3e17af8aedeb..2cd2761bd249 100644 +--- a/drivers/scsi/cxgbi/libcxgbi.c ++++ b/drivers/scsi/cxgbi/libcxgbi.c +@@ -121,7 +121,8 @@ static inline void cxgbi_device_destroy(struct cxgbi_device *cdev) + "cdev 0x%p, p# %u.\n", cdev, cdev->nports); + cxgbi_hbas_remove(cdev); + cxgbi_device_portmap_cleanup(cdev); +- cxgbi_ppm_release(cdev->cdev2ppm(cdev)); ++ if (cdev->cdev2ppm) ++ cxgbi_ppm_release(cdev->cdev2ppm(cdev)); + if (cdev->pmap.max_connect) + cxgbi_free_big_mem(cdev->pmap.port_csk); + kfree(cdev); +diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c +index fea3cb6a090b..752b71cfbe12 100644 +--- a/drivers/scsi/mpt3sas/mpt3sas_base.c ++++ b/drivers/scsi/mpt3sas/mpt3sas_base.c +@@ -5234,7 +5234,6 @@ _base_allocate_memory_pools(struct MPT3SAS_ADAPTER *ioc) + &ct->chain_buffer_dma); + if (!ct->chain_buffer) { + ioc_err(ioc, "chain_lookup: pci_pool_alloc failed\n"); +- _base_release_memory_pools(ioc); + goto out; + } + } +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c +index ebb40160539f..ac2e88ec1190 100644 +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -1694,20 +1694,30 @@ static void sd_rescan(struct device *dev) + static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode, + unsigned int cmd, unsigned long arg) + { +- struct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device; ++ struct gendisk *disk = bdev->bd_disk; ++ struct scsi_disk *sdkp = scsi_disk(disk); ++ struct scsi_device *sdev = sdkp->device; ++ void __user *p = compat_ptr(arg); + int error; + ++ error = scsi_verify_blk_ioctl(bdev, cmd); ++ if (error < 0) ++ return error; ++ + error = scsi_ioctl_block_when_processing_errors(sdev, cmd, + (mode & FMODE_NDELAY) != 0); + if (error) + return error; ++ ++ if (is_sed_ioctl(cmd)) ++ return sed_ioctl(sdkp->opal_dev, cmd, p); + + /* + * Let the static ioctl translation table take care of it. + */ + if (!sdev->host->hostt->compat_ioctl) + return -ENOIOCTLCMD; +- return sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg); ++ return sdev->host->hostt->compat_ioctl(sdev, cmd, p); + } + #endif + +@@ -2192,8 +2202,10 @@ static int sd_read_protection_type(struct scsi_disk *sdkp, unsigned char *buffer + u8 type; + int ret = 0; + +- if (scsi_device_protection(sdp) == 0 || (buffer[12] & 1) == 0) ++ if (scsi_device_protection(sdp) == 0 || (buffer[12] & 1) == 0) { ++ sdkp->protection_type = 0; + return ret; ++ } + + type = ((buffer[12] >> 1) & 7) + 1; /* P_TYPE 0 = Type 1 */ + +diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/scsi/ufs/ufs_bsg.c +index dc2f6d2b46ed..d2197a31abe5 100644 +--- a/drivers/scsi/ufs/ufs_bsg.c ++++ b/drivers/scsi/ufs/ufs_bsg.c +@@ -202,7 +202,7 @@ int ufs_bsg_probe(struct ufs_hba *hba) + bsg_dev->parent = get_device(parent); + bsg_dev->release = ufs_bsg_node_release; + +- dev_set_name(bsg_dev, "ufs-bsg"); ++ dev_set_name(bsg_dev, "ufs-bsg%u", shost->host_no); + + ret = device_add(bsg_dev); + if (ret) +diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c +index ba8eff41b746..abbc1582f457 100644 +--- a/drivers/spi/spi-atmel.c ++++ b/drivers/spi/spi-atmel.c +@@ -302,7 +302,6 @@ struct atmel_spi { + bool use_cs_gpios; + + bool keep_cs; +- bool cs_active; + + u32 fifo_size; + }; +@@ -1374,11 +1373,9 @@ static int atmel_spi_one_transfer(struct spi_master *master, + &msg->transfers)) { + as->keep_cs = true; + } else { +- as->cs_active = !as->cs_active; +- if (as->cs_active) +- cs_activate(as, msg->spi); +- else +- cs_deactivate(as, msg->spi); ++ cs_deactivate(as, msg->spi); ++ udelay(10); ++ cs_activate(as, msg->spi); + } + } + +@@ -1401,7 +1398,6 @@ static int atmel_spi_transfer_one_message(struct spi_master *master, + atmel_spi_lock(as); + cs_activate(as, spi); + +- as->cs_active = true; + as->keep_cs = false; + + msg->status = 0; +diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c +index d08e9324140e..3528ed5eea9b 100644 +--- a/drivers/spi/spi-fsl-lpspi.c ++++ b/drivers/spi/spi-fsl-lpspi.c +@@ -938,7 +938,7 @@ static int fsl_lpspi_probe(struct platform_device *pdev) + ret = pm_runtime_get_sync(fsl_lpspi->dev); + if (ret < 0) { + dev_err(fsl_lpspi->dev, "failed to enable clock\n"); +- return ret; ++ goto out_controller_put; + } + + temp = readl(fsl_lpspi->base + IMX7ULP_PARAM); +diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c +index ae95ec0bc964..9f92165fe09f 100644 +--- a/drivers/spi/spi-pxa2xx.c ++++ b/drivers/spi/spi-pxa2xx.c +@@ -1612,6 +1612,11 @@ static int pxa2xx_spi_fw_translate_cs(struct spi_controller *controller, + return cs; + } + ++static size_t pxa2xx_spi_max_dma_transfer_size(struct spi_device *spi) ++{ ++ return MAX_DMA_LEN; ++} ++ + static int pxa2xx_spi_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; +@@ -1717,6 +1722,8 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) + } else { + controller->can_dma = pxa2xx_spi_can_dma; + controller->max_dma_len = MAX_DMA_LEN; ++ controller->max_transfer_size = ++ pxa2xx_spi_max_dma_transfer_size; + } + } + +diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c +index 15f5723d9f95..7222c7689c3c 100644 +--- a/drivers/spi/spi-rspi.c ++++ b/drivers/spi/spi-rspi.c +@@ -1257,9 +1257,9 @@ static int rspi_probe(struct platform_device *pdev) + ctlr->flags = ops->flags; + ctlr->dev.of_node = pdev->dev.of_node; + +- ret = platform_get_irq_byname(pdev, "rx"); ++ ret = platform_get_irq_byname_optional(pdev, "rx"); + if (ret < 0) { +- ret = platform_get_irq_byname(pdev, "mux"); ++ ret = platform_get_irq_byname_optional(pdev, "mux"); + if (ret < 0) + ret = platform_get_irq(pdev, 0); + if (ret >= 0) +@@ -1270,10 +1270,6 @@ static int rspi_probe(struct platform_device *pdev) + if (ret >= 0) + rspi->tx_irq = ret; + } +- if (ret < 0) { +- dev_err(&pdev->dev, "platform_get_irq error\n"); +- goto error2; +- } + + if (rspi->rx_irq == rspi->tx_irq) { + /* Single multiplexed interrupt */ +diff --git a/drivers/spi/spi-sprd.c b/drivers/spi/spi-sprd.c +index 8c9021b7f7a9..fa597e27be17 100644 +--- a/drivers/spi/spi-sprd.c ++++ b/drivers/spi/spi-sprd.c +@@ -674,7 +674,7 @@ static void sprd_spi_init_hw(struct sprd_spi *ss, struct spi_transfer *t) + u16 word_delay, interval; + u32 val; + +- val = readl_relaxed(ss->base + SPRD_SPI_CTL7); ++ val = readl_relaxed(ss->base + SPRD_SPI_CTL0); + val &= ~(SPRD_SPI_SCK_REV | SPRD_SPI_NG_TX | SPRD_SPI_NG_RX); + /* Set default chip selection, clock phase and clock polarity */ + val |= ss->hw_mode & SPI_CPHA ? SPRD_SPI_NG_RX : SPRD_SPI_NG_TX; +diff --git a/drivers/staging/media/hantro/hantro_g1_h264_dec.c b/drivers/staging/media/hantro/hantro_g1_h264_dec.c +index 636bf972adcf..5f29b7a836db 100644 +--- a/drivers/staging/media/hantro/hantro_g1_h264_dec.c ++++ b/drivers/staging/media/hantro/hantro_g1_h264_dec.c +@@ -63,7 +63,7 @@ static void set_params(struct hantro_ctx *ctx) + /* always use the matrix sent from userspace */ + reg |= G1_REG_DEC_CTRL2_TYPE1_QUANT_E; + +- if (slices[0].flags & V4L2_H264_SLICE_FLAG_FIELD_PIC) ++ if (!(sps->flags & V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY)) + reg |= G1_REG_DEC_CTRL2_FIELDPIC_FLAG_E; + vdpu_write_relaxed(vpu, reg, G1_REG_DEC_CTRL2); + +diff --git a/drivers/staging/media/hantro/hantro_h264.c b/drivers/staging/media/hantro/hantro_h264.c +index 0d758e0c0f99..a9c134204351 100644 +--- a/drivers/staging/media/hantro/hantro_h264.c ++++ b/drivers/staging/media/hantro/hantro_h264.c +@@ -20,7 +20,7 @@ + /* Size with u32 units. */ + #define CABAC_INIT_BUFFER_SIZE (460 * 2) + #define POC_BUFFER_SIZE 34 +-#define SCALING_LIST_SIZE (6 * 16 + 6 * 64) ++#define SCALING_LIST_SIZE (6 * 16 + 2 * 64) + + #define POC_CMP(p0, p1) ((p0) < (p1) ? -1 : 1) + +@@ -194,23 +194,6 @@ static const u32 h264_cabac_table[] = { + 0x1f0c2517, 0x1f261440 + }; + +-/* +- * NOTE: The scaling lists are in zig-zag order, apply inverse scanning process +- * to get the values in matrix order. In addition, the hardware requires bytes +- * swapped within each subsequent 4 bytes. Both arrays below include both +- * transformations. +- */ +-static const u32 zig_zag_4x4[] = { +- 3, 2, 7, 11, 6, 1, 0, 5, 10, 15, 14, 9, 4, 8, 13, 12 +-}; +- +-static const u32 zig_zag_8x8[] = { +- 3, 2, 11, 19, 10, 1, 0, 9, 18, 27, 35, 26, 17, 8, 7, 6, +- 15, 16, 25, 34, 43, 51, 42, 33, 24, 23, 14, 5, 4, 13, 22, 31, +- 32, 41, 50, 59, 58, 49, 40, 39, 30, 21, 12, 20, 29, 38, 47, 48, +- 57, 56, 55, 46, 37, 28, 36, 45, 54, 63, 62, 53, 44, 52, 61, 60 +-}; +- + static void + reorder_scaling_list(struct hantro_ctx *ctx) + { +@@ -218,33 +201,23 @@ reorder_scaling_list(struct hantro_ctx *ctx) + const struct v4l2_ctrl_h264_scaling_matrix *scaling = ctrls->scaling; + const size_t num_list_4x4 = ARRAY_SIZE(scaling->scaling_list_4x4); + const size_t list_len_4x4 = ARRAY_SIZE(scaling->scaling_list_4x4[0]); +- const size_t num_list_8x8 = ARRAY_SIZE(scaling->scaling_list_8x8); + const size_t list_len_8x8 = ARRAY_SIZE(scaling->scaling_list_8x8[0]); + struct hantro_h264_dec_priv_tbl *tbl = ctx->h264_dec.priv.cpu; +- u8 *dst = tbl->scaling_list; +- const u8 *src; ++ u32 *dst = (u32 *)tbl->scaling_list; ++ const u32 *src; + int i, j; + +- BUILD_BUG_ON(ARRAY_SIZE(zig_zag_4x4) != list_len_4x4); +- BUILD_BUG_ON(ARRAY_SIZE(zig_zag_8x8) != list_len_8x8); +- BUILD_BUG_ON(ARRAY_SIZE(tbl->scaling_list) != +- num_list_4x4 * list_len_4x4 + +- num_list_8x8 * list_len_8x8); +- +- src = &scaling->scaling_list_4x4[0][0]; +- for (i = 0; i < num_list_4x4; ++i) { +- for (j = 0; j < list_len_4x4; ++j) +- dst[zig_zag_4x4[j]] = src[j]; +- src += list_len_4x4; +- dst += list_len_4x4; ++ for (i = 0; i < num_list_4x4; i++) { ++ src = (u32 *)&scaling->scaling_list_4x4[i]; ++ for (j = 0; j < list_len_4x4 / 4; j++) ++ *dst++ = swab32(src[j]); + } + +- src = &scaling->scaling_list_8x8[0][0]; +- for (i = 0; i < num_list_8x8; ++i) { +- for (j = 0; j < list_len_8x8; ++j) +- dst[zig_zag_8x8[j]] = src[j]; +- src += list_len_8x8; +- dst += list_len_8x8; ++ /* Only Intra/Inter Y lists */ ++ for (i = 0; i < 2; i++) { ++ src = (u32 *)&scaling->scaling_list_8x8[i]; ++ for (j = 0; j < list_len_8x8 / 4; j++) ++ *dst++ = swab32(src[j]); + } + } + +@@ -271,6 +244,7 @@ struct hantro_h264_reflist_builder { + const struct v4l2_h264_dpb_entry *dpb; + s32 pocs[HANTRO_H264_DPB_SIZE]; + u8 unordered_reflist[HANTRO_H264_DPB_SIZE]; ++ int frame_nums[HANTRO_H264_DPB_SIZE]; + s32 curpoc; + u8 num_valid; + }; +@@ -294,13 +268,20 @@ static void + init_reflist_builder(struct hantro_ctx *ctx, + struct hantro_h264_reflist_builder *b) + { ++ const struct v4l2_ctrl_h264_slice_params *slice_params; + const struct v4l2_ctrl_h264_decode_params *dec_param; ++ const struct v4l2_ctrl_h264_sps *sps; + struct vb2_v4l2_buffer *buf = hantro_get_dst_buf(ctx); + const struct v4l2_h264_dpb_entry *dpb = ctx->h264_dec.dpb; + struct vb2_queue *cap_q = &ctx->fh.m2m_ctx->cap_q_ctx.q; ++ int cur_frame_num, max_frame_num; + unsigned int i; + + dec_param = ctx->h264_dec.ctrls.decode; ++ slice_params = &ctx->h264_dec.ctrls.slices[0]; ++ sps = ctx->h264_dec.ctrls.sps; ++ max_frame_num = 1 << (sps->log2_max_frame_num_minus4 + 4); ++ cur_frame_num = slice_params->frame_num; + + memset(b, 0, sizeof(*b)); + b->dpb = dpb; +@@ -318,6 +299,18 @@ init_reflist_builder(struct hantro_ctx *ctx, + continue; + + buf = to_vb2_v4l2_buffer(vb2_get_buffer(cap_q, buf_idx)); ++ ++ /* ++ * Handle frame_num wraparound as described in section ++ * '8.2.4.1 Decoding process for picture numbers' of the spec. ++ * TODO: This logic will have to be adjusted when we start ++ * supporting interlaced content. ++ */ ++ if (dpb[i].frame_num > cur_frame_num) ++ b->frame_nums[i] = (int)dpb[i].frame_num - max_frame_num; ++ else ++ b->frame_nums[i] = dpb[i].frame_num; ++ + b->pocs[i] = get_poc(buf->field, dpb[i].top_field_order_cnt, + dpb[i].bottom_field_order_cnt); + b->unordered_reflist[b->num_valid] = i; +@@ -353,7 +346,7 @@ static int p_ref_list_cmp(const void *ptra, const void *ptrb, const void *data) + * ascending order. + */ + if (!(a->flags & V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM)) +- return b->frame_num - a->frame_num; ++ return builder->frame_nums[idxb] - builder->frame_nums[idxa]; + + return a->pic_num - b->pic_num; + } +diff --git a/drivers/staging/media/ipu3/include/intel-ipu3.h b/drivers/staging/media/ipu3/include/intel-ipu3.h +index c7cd27efac8a..0b1cb9f9cbd1 100644 +--- a/drivers/staging/media/ipu3/include/intel-ipu3.h ++++ b/drivers/staging/media/ipu3/include/intel-ipu3.h +@@ -449,7 +449,7 @@ struct ipu3_uapi_awb_fr_config_s { + __u16 reserved1; + __u32 bayer_sign; + __u8 bayer_nf; +- __u8 reserved2[3]; ++ __u8 reserved2[7]; + } __attribute__((aligned(32))) __packed; + + /** +diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +index 08c6c9c410cc..c07526c12629 100644 +--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c ++++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +@@ -244,8 +244,8 @@ static void cedrus_write_scaling_lists(struct cedrus_ctx *ctx, + sizeof(scaling->scaling_list_8x8[0])); + + cedrus_h264_write_sram(dev, CEDRUS_SRAM_H264_SCALING_LIST_8x8_1, +- scaling->scaling_list_8x8[3], +- sizeof(scaling->scaling_list_8x8[3])); ++ scaling->scaling_list_8x8[1], ++ sizeof(scaling->scaling_list_8x8[1])); + + cedrus_h264_write_sram(dev, CEDRUS_SRAM_H264_SCALING_LIST_4x4, + scaling->scaling_list_4x4, +diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c +index 6949ea8bc387..51ffd5c002de 100644 +--- a/drivers/target/target_core_iblock.c ++++ b/drivers/target/target_core_iblock.c +@@ -646,7 +646,9 @@ iblock_alloc_bip(struct se_cmd *cmd, struct bio *bio, + } + + bip->bip_iter.bi_size = bio_integrity_bytes(bi, bio_sectors(bio)); +- bip_set_seed(bip, bio->bi_iter.bi_sector); ++ /* virtual start sector must be in integrity interval units */ ++ bip_set_seed(bip, bio->bi_iter.bi_sector >> ++ (bi->interval_exp - SECTOR_SHIFT)); + + pr_debug("IBLOCK BIP Size: %u Sector: %llu\n", bip->bip_iter.bi_size, + (unsigned long long)bip->bip_iter.bi_sector); +diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c +index 5e08f2657b90..34f602c3a882 100644 +--- a/drivers/tty/serial/imx.c ++++ b/drivers/tty/serial/imx.c +@@ -619,7 +619,7 @@ static void imx_uart_dma_tx(struct imx_port *sport) + dev_err(dev, "DMA mapping error for TX.\n"); + return; + } +- desc = dmaengine_prep_slave_sg(chan, sgl, sport->dma_tx_nents, ++ desc = dmaengine_prep_slave_sg(chan, sgl, ret, + DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT); + if (!desc) { + dma_unmap_sg(dev, sgl, sport->dma_tx_nents, +diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c +index 6157213a8359..c16234bca78f 100644 +--- a/drivers/tty/serial/pch_uart.c ++++ b/drivers/tty/serial/pch_uart.c +@@ -233,6 +233,7 @@ struct eg20t_port { + struct dma_chan *chan_rx; + struct scatterlist *sg_tx_p; + int nent; ++ int orig_nent; + struct scatterlist sg_rx; + int tx_dma_use; + void *rx_buf_virt; +@@ -787,9 +788,10 @@ static void pch_dma_tx_complete(void *arg) + } + xmit->tail &= UART_XMIT_SIZE - 1; + async_tx_ack(priv->desc_tx); +- dma_unmap_sg(port->dev, sg, priv->nent, DMA_TO_DEVICE); ++ dma_unmap_sg(port->dev, sg, priv->orig_nent, DMA_TO_DEVICE); + priv->tx_dma_use = 0; + priv->nent = 0; ++ priv->orig_nent = 0; + kfree(priv->sg_tx_p); + pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); + } +@@ -1010,6 +1012,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) + dev_err(priv->port.dev, "%s:dma_map_sg Failed\n", __func__); + return 0; + } ++ priv->orig_nent = num; + priv->nent = nent; + + for (i = 0; i < nent; i++, sg++) { +diff --git a/fs/affs/super.c b/fs/affs/super.c +index cc463ae47c12..3812f7bc3a7f 100644 +--- a/fs/affs/super.c ++++ b/fs/affs/super.c +@@ -561,14 +561,9 @@ affs_remount(struct super_block *sb, int *flags, char *data) + int root_block; + unsigned long mount_flags; + int res = 0; +- char *new_opts; + char volume[32]; + char *prefix = NULL; + +- new_opts = kstrdup(data, GFP_KERNEL); +- if (data && !new_opts) +- return -ENOMEM; +- + pr_debug("%s(flags=0x%x,opts=\"%s\")\n", __func__, *flags, data); + + sync_filesystem(sb); +@@ -579,7 +574,6 @@ affs_remount(struct super_block *sb, int *flags, char *data) + &blocksize, &prefix, volume, + &mount_flags)) { + kfree(prefix); +- kfree(new_opts); + return -EINVAL; + } + +diff --git a/fs/afs/dir.c b/fs/afs/dir.c +index 497f979018c2..5c794f4b051a 100644 +--- a/fs/afs/dir.c ++++ b/fs/afs/dir.c +@@ -908,6 +908,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry, + unsigned int flags) + { + struct afs_vnode *dvnode = AFS_FS_I(dir); ++ struct afs_fid fid = {}; + struct inode *inode; + struct dentry *d; + struct key *key; +@@ -951,21 +952,18 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry, + afs_stat_v(dvnode, n_lookup); + inode = afs_do_lookup(dir, dentry, key); + key_put(key); +- if (inode == ERR_PTR(-ENOENT)) { ++ if (inode == ERR_PTR(-ENOENT)) + inode = afs_try_auto_mntpt(dentry, dir); +- } else { +- dentry->d_fsdata = +- (void *)(unsigned long)dvnode->status.data_version; +- } ++ ++ if (!IS_ERR_OR_NULL(inode)) ++ fid = AFS_FS_I(inode)->fid; ++ + d = d_splice_alias(inode, dentry); + if (!IS_ERR_OR_NULL(d)) { + d->d_fsdata = dentry->d_fsdata; +- trace_afs_lookup(dvnode, &d->d_name, +- inode ? AFS_FS_I(inode) : NULL); ++ trace_afs_lookup(dvnode, &d->d_name, &fid); + } else { +- trace_afs_lookup(dvnode, &dentry->d_name, +- IS_ERR_OR_NULL(inode) ? NULL +- : AFS_FS_I(inode)); ++ trace_afs_lookup(dvnode, &dentry->d_name, &fid); + } + return d; + } +diff --git a/fs/afs/super.c b/fs/afs/super.c +index d9a6036b70b9..7f8a9b3137bf 100644 +--- a/fs/afs/super.c ++++ b/fs/afs/super.c +@@ -404,6 +404,7 @@ static int afs_test_super(struct super_block *sb, struct fs_context *fc) + return (as->net_ns == fc->net_ns && + as->volume && + as->volume->vid == ctx->volume->vid && ++ as->cell == ctx->cell && + !as->dyn_root); + } + +diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c +index eaafd00f93d4..5739b8fc7fff 100644 +--- a/fs/btrfs/file.c ++++ b/fs/btrfs/file.c +@@ -1903,9 +1903,10 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb, + (iocb->ki_flags & IOCB_NOWAIT)) + return -EOPNOTSUPP; + +- if (!inode_trylock(inode)) { +- if (iocb->ki_flags & IOCB_NOWAIT) ++ if (iocb->ki_flags & IOCB_NOWAIT) { ++ if (!inode_trylock(inode)) + return -EAGAIN; ++ } else { + inode_lock(inode); + } + +diff --git a/fs/buffer.c b/fs/buffer.c +index 7744488f7bde..91ceca52d14f 100644 +--- a/fs/buffer.c ++++ b/fs/buffer.c +@@ -2991,7 +2991,7 @@ static void end_bio_bh_io_sync(struct bio *bio) + * errors, this only handles the "we need to be able to + * do IO at the final sector" case. + */ +-void guard_bio_eod(int op, struct bio *bio) ++void guard_bio_eod(struct bio *bio) + { + sector_t maxsector; + struct hd_struct *part; +@@ -3055,15 +3055,15 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh, + bio->bi_end_io = end_bio_bh_io_sync; + bio->bi_private = bh; + +- /* Take care of bh's that straddle the end of the device */ +- guard_bio_eod(op, bio); +- + if (buffer_meta(bh)) + op_flags |= REQ_META; + if (buffer_prio(bh)) + op_flags |= REQ_PRIO; + bio_set_op_attrs(bio, op, op_flags); + ++ /* Take care of bh's that straddle the end of the device */ ++ guard_bio_eod(bio); ++ + if (wbc) { + wbc_init_bio(wbc, bio); + wbc_account_cgroup_owner(wbc, bh->b_page, bh->b_size); +diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c +index 8b0b512c5792..afe1f03aabe3 100644 +--- a/fs/cifs/smb2file.c ++++ b/fs/cifs/smb2file.c +@@ -67,7 +67,7 @@ smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, + goto out; + + +- if (oparms->tcon->use_resilient) { ++ if (oparms->tcon->use_resilient) { + /* default timeout is 0, servers pick default (120 seconds) */ + nr_ioctl_req.Timeout = + cpu_to_le32(oparms->tcon->handle_timeout); +diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c +index 5755e897a5f0..2e9c73165800 100644 +--- a/fs/f2fs/data.c ++++ b/fs/f2fs/data.c +@@ -2098,7 +2098,7 @@ static int __write_data_page(struct page *page, bool *submitted, + loff_t i_size = i_size_read(inode); + const pgoff_t end_index = ((unsigned long long) i_size) + >> PAGE_SHIFT; +- loff_t psize = (page->index + 1) << PAGE_SHIFT; ++ loff_t psize = (loff_t)(page->index + 1) << PAGE_SHIFT; + unsigned offset = 0; + bool need_balance_fs = false; + int err = 0; +diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c +index 8ed8e4328bd1..fae665691481 100644 +--- a/fs/f2fs/file.c ++++ b/fs/f2fs/file.c +@@ -1139,7 +1139,7 @@ static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode, + } + dn.ofs_in_node++; + i++; +- new_size = (dst + i) << PAGE_SHIFT; ++ new_size = (loff_t)(dst + i) << PAGE_SHIFT; + if (dst_inode->i_size < new_size) + f2fs_i_size_write(dst_inode, new_size); + } while (--ilen && (do_replace[i] || blkaddr[i] == NULL_ADDR)); +diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c +index c53e3b892210..01ff37b76652 100644 +--- a/fs/gfs2/file.c ++++ b/fs/gfs2/file.c +@@ -6,6 +6,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -354,6 +355,31 @@ static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) + return -ENOTTY; + } + ++#ifdef CONFIG_COMPAT ++static long gfs2_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ++{ ++ switch(cmd) { ++ /* These are just misnamed, they actually get/put from/to user an int */ ++ case FS_IOC32_GETFLAGS: ++ cmd = FS_IOC_GETFLAGS; ++ break; ++ case FS_IOC32_SETFLAGS: ++ cmd = FS_IOC_SETFLAGS; ++ break; ++ /* Keep this list in sync with gfs2_ioctl */ ++ case FITRIM: ++ case FS_IOC_GETFSLABEL: ++ break; ++ default: ++ return -ENOIOCTLCMD; ++ } ++ ++ return gfs2_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); ++} ++#else ++#define gfs2_compat_ioctl NULL ++#endif ++ + /** + * gfs2_size_hint - Give a hint to the size of a write request + * @filep: The struct file +@@ -1294,6 +1320,7 @@ const struct file_operations gfs2_file_fops = { + .write_iter = gfs2_file_write_iter, + .iopoll = iomap_dio_iopoll, + .unlocked_ioctl = gfs2_ioctl, ++ .compat_ioctl = gfs2_compat_ioctl, + .mmap = gfs2_mmap, + .open = gfs2_open, + .release = gfs2_release, +@@ -1309,6 +1336,7 @@ const struct file_operations gfs2_file_fops = { + const struct file_operations gfs2_dir_fops = { + .iterate_shared = gfs2_readdir, + .unlocked_ioctl = gfs2_ioctl, ++ .compat_ioctl = gfs2_compat_ioctl, + .open = gfs2_open, + .release = gfs2_release, + .fsync = gfs2_fsync, +@@ -1325,6 +1353,7 @@ const struct file_operations gfs2_file_fops_nolock = { + .write_iter = gfs2_file_write_iter, + .iopoll = iomap_dio_iopoll, + .unlocked_ioctl = gfs2_ioctl, ++ .compat_ioctl = gfs2_compat_ioctl, + .mmap = gfs2_mmap, + .open = gfs2_open, + .release = gfs2_release, +@@ -1338,6 +1367,7 @@ const struct file_operations gfs2_file_fops_nolock = { + const struct file_operations gfs2_dir_fops_nolock = { + .iterate_shared = gfs2_readdir, + .unlocked_ioctl = gfs2_ioctl, ++ .compat_ioctl = gfs2_compat_ioctl, + .open = gfs2_open, + .release = gfs2_release, + .fsync = gfs2_fsync, +diff --git a/fs/internal.h b/fs/internal.h +index 315fcd8d237c..7651e8b8ef13 100644 +--- a/fs/internal.h ++++ b/fs/internal.h +@@ -38,7 +38,7 @@ static inline int __sync_blockdev(struct block_device *bdev, int wait) + /* + * buffer.c + */ +-extern void guard_bio_eod(int rw, struct bio *bio); ++extern void guard_bio_eod(struct bio *bio); + extern int __block_write_begin_int(struct page *page, loff_t pos, unsigned len, + get_block_t *get_block, struct iomap *iomap); + +diff --git a/fs/mpage.c b/fs/mpage.c +index a63620cdb73a..ccba3c4c4479 100644 +--- a/fs/mpage.c ++++ b/fs/mpage.c +@@ -62,7 +62,7 @@ static struct bio *mpage_bio_submit(int op, int op_flags, struct bio *bio) + { + bio->bi_end_io = mpage_end_io; + bio_set_op_attrs(bio, op, op_flags); +- guard_bio_eod(op, bio); ++ guard_bio_eod(bio); + submit_bio(bio); + return NULL; + } +diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c +index cbc17a203248..887f9136a9db 100644 +--- a/fs/nfs/nfs2xdr.c ++++ b/fs/nfs/nfs2xdr.c +@@ -370,7 +370,7 @@ static void encode_sattr(struct xdr_stream *xdr, const struct iattr *attr, + } else + p = xdr_time_not_set(p); + if (attr->ia_valid & ATTR_MTIME_SET) { +- ts = timespec64_to_timespec(attr->ia_atime); ++ ts = timespec64_to_timespec(attr->ia_mtime); + xdr_encode_time(p, &ts); + } else if (attr->ia_valid & ATTR_MTIME) { + ts = timespec64_to_timespec(attr->ia_mtime); +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c +index caacf5e7f5e1..f26d714f9f28 100644 +--- a/fs/nfs/nfs4proc.c ++++ b/fs/nfs/nfs4proc.c +@@ -521,9 +521,7 @@ static int nfs4_do_handle_exception(struct nfs_server *server, + case -NFS4ERR_DEADSESSION: + case -NFS4ERR_SEQ_FALSE_RETRY: + case -NFS4ERR_SEQ_MISORDERED: +- dprintk("%s ERROR: %d Reset session\n", __func__, +- errorcode); +- nfs4_schedule_session_recovery(clp->cl_session, errorcode); ++ /* Handled in nfs41_sequence_process() */ + goto wait_on_recovery; + #endif /* defined(CONFIG_NFS_V4_1) */ + case -NFS4ERR_FILE_OPEN: +@@ -782,6 +780,7 @@ static int nfs41_sequence_process(struct rpc_task *task, + struct nfs4_session *session; + struct nfs4_slot *slot = res->sr_slot; + struct nfs_client *clp; ++ int status; + int ret = 1; + + if (slot == NULL) +@@ -793,8 +792,13 @@ static int nfs41_sequence_process(struct rpc_task *task, + session = slot->table->session; + + trace_nfs4_sequence_done(session, res); ++ ++ status = res->sr_status; ++ if (task->tk_status == -NFS4ERR_DEADSESSION) ++ status = -NFS4ERR_DEADSESSION; ++ + /* Check the SEQUENCE operation status */ +- switch (res->sr_status) { ++ switch (status) { + case 0: + /* Mark this sequence number as having been acked */ + nfs4_slot_sequence_acked(slot, slot->seq_nr); +@@ -866,6 +870,10 @@ static int nfs41_sequence_process(struct rpc_task *task, + */ + slot->seq_nr = slot->seq_nr_highest_sent; + goto out_retry; ++ case -NFS4ERR_BADSESSION: ++ case -NFS4ERR_DEADSESSION: ++ case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: ++ goto session_recover; + default: + /* Just update the slot sequence no. */ + slot->seq_done = 1; +@@ -876,8 +884,10 @@ out: + out_noaction: + return ret; + session_recover: +- nfs4_schedule_session_recovery(session, res->sr_status); +- goto retry_nowait; ++ nfs4_schedule_session_recovery(session, status); ++ dprintk("%s ERROR: %d Reset session\n", __func__, status); ++ nfs41_sequence_free_slot(res); ++ goto out; + retry_new_seq: + ++slot->seq_nr; + retry_nowait: +@@ -2188,7 +2198,6 @@ static int nfs4_handle_delegation_recall_error(struct nfs_server *server, struct + case -NFS4ERR_BAD_HIGH_SLOT: + case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: + case -NFS4ERR_DEADSESSION: +- nfs4_schedule_session_recovery(server->nfs_client->cl_session, err); + return -EAGAIN; + case -NFS4ERR_STALE_CLIENTID: + case -NFS4ERR_STALE_STATEID: +@@ -6243,8 +6252,10 @@ static void nfs4_delegreturn_prepare(struct rpc_task *task, void *data) + + d_data = (struct nfs4_delegreturndata *)data; + +- if (!d_data->lr.roc && nfs4_wait_on_layoutreturn(d_data->inode, task)) ++ if (!d_data->lr.roc && nfs4_wait_on_layoutreturn(d_data->inode, task)) { ++ nfs4_sequence_done(task, &d_data->res.seq_res); + return; ++ } + + lo = d_data->args.lr_args ? d_data->args.lr_args->layout : NULL; + if (lo && !pnfs_layout_is_valid(lo)) { +@@ -7820,6 +7831,15 @@ nfs41_same_server_scope(struct nfs41_server_scope *a, + static void + nfs4_bind_one_conn_to_session_done(struct rpc_task *task, void *calldata) + { ++ struct nfs41_bind_conn_to_session_args *args = task->tk_msg.rpc_argp; ++ struct nfs_client *clp = args->client; ++ ++ switch (task->tk_status) { ++ case -NFS4ERR_BADSESSION: ++ case -NFS4ERR_DEADSESSION: ++ nfs4_schedule_session_recovery(clp->cl_session, ++ task->tk_status); ++ } + } + + static const struct rpc_call_ops nfs4_bind_one_conn_to_session_ops = { +@@ -8867,8 +8887,6 @@ static int nfs41_reclaim_complete_handle_errors(struct rpc_task *task, struct nf + case -NFS4ERR_BADSESSION: + case -NFS4ERR_DEADSESSION: + case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: +- nfs4_schedule_session_recovery(clp->cl_session, +- task->tk_status); + break; + default: + nfs4_schedule_lease_recovery(clp); +diff --git a/fs/nfsd/Kconfig b/fs/nfsd/Kconfig +index 10cefb0c07c7..c4b1a89b8845 100644 +--- a/fs/nfsd/Kconfig ++++ b/fs/nfsd/Kconfig +@@ -73,7 +73,7 @@ config NFSD_V4 + select NFSD_V3 + select FS_POSIX_ACL + select SUNRPC_GSS +- select CRYPTO ++ select CRYPTO_SHA256 + select GRACE_PERIOD + help + This option enables support in your system's NFS server for +diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c +index 38c0aeda500e..4798667af647 100644 +--- a/fs/nfsd/nfs4proc.c ++++ b/fs/nfsd/nfs4proc.c +@@ -1298,7 +1298,8 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, + out: + return status; + out_err: +- cleanup_async_copy(async_copy); ++ if (async_copy) ++ cleanup_async_copy(async_copy); + goto out; + } + +diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c +index cdc75ad4438b..c35c0ebaf722 100644 +--- a/fs/nfsd/nfs4recover.c ++++ b/fs/nfsd/nfs4recover.c +@@ -1578,6 +1578,7 @@ nfsd4_cld_tracking_init(struct net *net) + struct nfsd_net *nn = net_generic(net, nfsd_net_id); + bool running; + int retries = 10; ++ struct crypto_shash *tfm; + + status = nfs4_cld_state_init(net); + if (status) +@@ -1586,11 +1587,6 @@ nfsd4_cld_tracking_init(struct net *net) + status = __nfsd4_init_cld_pipe(net); + if (status) + goto err_shutdown; +- nn->cld_net->cn_tfm = crypto_alloc_shash("sha256", 0, 0); +- if (IS_ERR(nn->cld_net->cn_tfm)) { +- status = PTR_ERR(nn->cld_net->cn_tfm); +- goto err_remove; +- } + + /* + * rpc pipe upcalls take 30 seconds to time out, so we don't want to +@@ -1607,6 +1603,12 @@ nfsd4_cld_tracking_init(struct net *net) + status = -ETIMEDOUT; + goto err_remove; + } ++ tfm = crypto_alloc_shash("sha256", 0, 0); ++ if (IS_ERR(tfm)) { ++ status = PTR_ERR(tfm); ++ goto err_remove; ++ } ++ nn->cld_net->cn_tfm = tfm; + + status = nfsd4_cld_get_version(nn); + if (status == -EOPNOTSUPP) +diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c +index 699a560efbb0..900e4ef686bf 100644 +--- a/fs/ocfs2/journal.c ++++ b/fs/ocfs2/journal.c +@@ -1066,6 +1066,14 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local, int replayed) + + ocfs2_clear_journal_error(osb->sb, journal->j_journal, osb->slot_num); + ++ if (replayed) { ++ jbd2_journal_lock_updates(journal->j_journal); ++ status = jbd2_journal_flush(journal->j_journal); ++ jbd2_journal_unlock_updates(journal->j_journal); ++ if (status < 0) ++ mlog_errno(status); ++ } ++ + status = ocfs2_journal_toggle_dirty(osb, 1, replayed); + if (status < 0) { + mlog_errno(status); +diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c +index 4fd9683b8245..826dad0243dc 100644 +--- a/fs/ubifs/journal.c ++++ b/fs/ubifs/journal.c +@@ -899,7 +899,7 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode) + fname_name(&nm) = xent->name; + fname_len(&nm) = le16_to_cpu(xent->nlen); + +- xino = ubifs_iget(c->vfs_sb, xent->inum); ++ xino = ubifs_iget(c->vfs_sb, le64_to_cpu(xent->inum)); + if (IS_ERR(xino)) { + err = PTR_ERR(xino); + ubifs_err(c, "dead directory entry '%s', error %d", +diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c +index 3b4b4114f208..54d6db61106f 100644 +--- a/fs/ubifs/orphan.c ++++ b/fs/ubifs/orphan.c +@@ -631,12 +631,17 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb, + ino_t inum; + int i, n, err, first = 1; + ++ ino = kmalloc(UBIFS_MAX_INO_NODE_SZ, GFP_NOFS); ++ if (!ino) ++ return -ENOMEM; ++ + list_for_each_entry(snod, &sleb->nodes, list) { + if (snod->type != UBIFS_ORPH_NODE) { + ubifs_err(c, "invalid node type %d in orphan area at %d:%d", + snod->type, sleb->lnum, snod->offs); + ubifs_dump_node(c, snod->node); +- return -EINVAL; ++ err = -EINVAL; ++ goto out_free; + } + + orph = snod->node; +@@ -663,20 +668,18 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb, + ubifs_err(c, "out of order commit number %llu in orphan node at %d:%d", + cmt_no, sleb->lnum, snod->offs); + ubifs_dump_node(c, snod->node); +- return -EINVAL; ++ err = -EINVAL; ++ goto out_free; + } + dbg_rcvry("out of date LEB %d", sleb->lnum); + *outofdate = 1; +- return 0; ++ err = 0; ++ goto out_free; + } + + if (first) + first = 0; + +- ino = kmalloc(UBIFS_MAX_INO_NODE_SZ, GFP_NOFS); +- if (!ino) +- return -ENOMEM; +- + n = (le32_to_cpu(orph->ch.len) - UBIFS_ORPH_NODE_SZ) >> 3; + for (i = 0; i < n; i++) { + union ubifs_key key1, key2; +diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c +index 7d4547e5202d..5e1e8ec0589e 100644 +--- a/fs/ubifs/super.c ++++ b/fs/ubifs/super.c +@@ -2267,10 +2267,8 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags, + } + } else { + err = ubifs_fill_super(sb, data, flags & SB_SILENT ? 1 : 0); +- if (err) { +- kfree(c); ++ if (err) + goto out_deact; +- } + /* We do not support atime */ + sb->s_flags |= SB_ACTIVE; + if (IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT)) +diff --git a/include/asm-generic/cacheflush.h b/include/asm-generic/cacheflush.h +index a950a22c4890..cac7404b2bdd 100644 +--- a/include/asm-generic/cacheflush.h ++++ b/include/asm-generic/cacheflush.h +@@ -11,71 +11,102 @@ + * The cache doesn't need to be flushed when TLB entries change when + * the cache is mapped to physical memory, not virtual memory + */ ++#ifndef flush_cache_all + static inline void flush_cache_all(void) + { + } ++#endif + ++#ifndef flush_cache_mm + static inline void flush_cache_mm(struct mm_struct *mm) + { + } ++#endif + ++#ifndef flush_cache_dup_mm + static inline void flush_cache_dup_mm(struct mm_struct *mm) + { + } ++#endif + ++#ifndef flush_cache_range + static inline void flush_cache_range(struct vm_area_struct *vma, + unsigned long start, + unsigned long end) + { + } ++#endif + ++#ifndef flush_cache_page + static inline void flush_cache_page(struct vm_area_struct *vma, + unsigned long vmaddr, + unsigned long pfn) + { + } ++#endif + ++#ifndef flush_dcache_page + static inline void flush_dcache_page(struct page *page) + { + } ++#endif + ++#ifndef flush_dcache_mmap_lock + static inline void flush_dcache_mmap_lock(struct address_space *mapping) + { + } ++#endif + ++#ifndef flush_dcache_mmap_unlock + static inline void flush_dcache_mmap_unlock(struct address_space *mapping) + { + } ++#endif + ++#ifndef flush_icache_range + static inline void flush_icache_range(unsigned long start, unsigned long end) + { + } ++#endif + ++#ifndef flush_icache_page + static inline void flush_icache_page(struct vm_area_struct *vma, + struct page *page) + { + } ++#endif + ++#ifndef flush_icache_user_range + static inline void flush_icache_user_range(struct vm_area_struct *vma, + struct page *page, + unsigned long addr, int len) + { + } ++#endif + ++#ifndef flush_cache_vmap + static inline void flush_cache_vmap(unsigned long start, unsigned long end) + { + } ++#endif + ++#ifndef flush_cache_vunmap + static inline void flush_cache_vunmap(unsigned long start, unsigned long end) + { + } ++#endif + +-#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ ++#ifndef copy_to_user_page ++#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ + do { \ + memcpy(dst, src, len); \ + flush_icache_user_range(vma, page, vaddr, len); \ + } while (0) ++#endif ++ ++#ifndef copy_from_user_page + #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ + memcpy(dst, src, len) ++#endif + + #endif /* __ASM_CACHEFLUSH_H */ +diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h +index 734b6f7081b8..3175dfeaed2c 100644 +--- a/include/crypto/internal/skcipher.h ++++ b/include/crypto/internal/skcipher.h +@@ -205,19 +205,6 @@ static inline unsigned int crypto_skcipher_alg_max_keysize( + return alg->max_keysize; + } + +-static inline unsigned int crypto_skcipher_alg_chunksize( +- struct skcipher_alg *alg) +-{ +- if ((alg->base.cra_flags & CRYPTO_ALG_TYPE_MASK) == +- CRYPTO_ALG_TYPE_BLKCIPHER) +- return alg->base.cra_blocksize; +- +- if (alg->base.cra_ablkcipher.encrypt) +- return alg->base.cra_blocksize; +- +- return alg->chunksize; +-} +- + static inline unsigned int crypto_skcipher_alg_walksize( + struct skcipher_alg *alg) + { +@@ -231,23 +218,6 @@ static inline unsigned int crypto_skcipher_alg_walksize( + return alg->walksize; + } + +-/** +- * crypto_skcipher_chunksize() - obtain chunk size +- * @tfm: cipher handle +- * +- * The block size is set to one for ciphers such as CTR. However, +- * you still need to provide incremental updates in multiples of +- * the underlying block size as the IV does not have sub-block +- * granularity. This is known in this API as the chunk size. +- * +- * Return: chunk size in bytes +- */ +-static inline unsigned int crypto_skcipher_chunksize( +- struct crypto_skcipher *tfm) +-{ +- return crypto_skcipher_alg_chunksize(crypto_skcipher_alg(tfm)); +-} +- + /** + * crypto_skcipher_walksize() - obtain walk size + * @tfm: cipher handle +diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h +index 37c164234d97..aada87916918 100644 +--- a/include/crypto/skcipher.h ++++ b/include/crypto/skcipher.h +@@ -304,6 +304,36 @@ static inline unsigned int crypto_skcipher_blocksize( + return crypto_tfm_alg_blocksize(crypto_skcipher_tfm(tfm)); + } + ++static inline unsigned int crypto_skcipher_alg_chunksize( ++ struct skcipher_alg *alg) ++{ ++ if ((alg->base.cra_flags & CRYPTO_ALG_TYPE_MASK) == ++ CRYPTO_ALG_TYPE_BLKCIPHER) ++ return alg->base.cra_blocksize; ++ ++ if (alg->base.cra_ablkcipher.encrypt) ++ return alg->base.cra_blocksize; ++ ++ return alg->chunksize; ++} ++ ++/** ++ * crypto_skcipher_chunksize() - obtain chunk size ++ * @tfm: cipher handle ++ * ++ * The block size is set to one for ciphers such as CTR. However, ++ * you still need to provide incremental updates in multiples of ++ * the underlying block size as the IV does not have sub-block ++ * granularity. This is known in this API as the chunk size. ++ * ++ * Return: chunk size in bytes ++ */ ++static inline unsigned int crypto_skcipher_chunksize( ++ struct crypto_skcipher *tfm) ++{ ++ return crypto_skcipher_alg_chunksize(crypto_skcipher_alg(tfm)); ++} ++ + static inline unsigned int crypto_sync_skcipher_blocksize( + struct crypto_sync_skcipher *tfm) + { +diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h +index d4ee6e942562..38555435a64a 100644 +--- a/include/linux/uaccess.h ++++ b/include/linux/uaccess.h +@@ -337,6 +337,18 @@ extern long __probe_user_read(void *dst, const void __user *src, size_t size); + extern long notrace probe_kernel_write(void *dst, const void *src, size_t size); + extern long notrace __probe_kernel_write(void *dst, const void *src, size_t size); + ++/* ++ * probe_user_write(): safely attempt to write to a location in user space ++ * @dst: address to write to ++ * @src: pointer to the data that shall be written ++ * @size: size of the data chunk ++ * ++ * Safely write to address @dst from the buffer at @src. If a kernel fault ++ * happens, handle that and return -EFAULT. ++ */ ++extern long notrace probe_user_write(void __user *dst, const void *src, size_t size); ++extern long notrace __probe_user_write(void __user *dst, const void *src, size_t size); ++ + extern long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count); + extern long strncpy_from_unsafe_user(char *dst, const void __user *unsafe_addr, + long count); +diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h +index 31f76b6abf71..bbdd1542d6f1 100644 +--- a/include/sound/simple_card_utils.h ++++ b/include/sound/simple_card_utils.h +@@ -8,6 +8,7 @@ + #ifndef __SIMPLE_CARD_UTILS_H + #define __SIMPLE_CARD_UTILS_H + ++#include + #include + + #define asoc_simple_init_hp(card, sjack, prefix) \ +diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h +index d5ec4fac82ae..564ba1b5cf57 100644 +--- a/include/trace/events/afs.h ++++ b/include/trace/events/afs.h +@@ -915,9 +915,9 @@ TRACE_EVENT(afs_call_state, + + TRACE_EVENT(afs_lookup, + TP_PROTO(struct afs_vnode *dvnode, const struct qstr *name, +- struct afs_vnode *vnode), ++ struct afs_fid *fid), + +- TP_ARGS(dvnode, name, vnode), ++ TP_ARGS(dvnode, name, fid), + + TP_STRUCT__entry( + __field_struct(struct afs_fid, dfid ) +@@ -928,13 +928,7 @@ TRACE_EVENT(afs_lookup, + TP_fast_assign( + int __len = min_t(int, name->len, 23); + __entry->dfid = dvnode->fid; +- if (vnode) { +- __entry->fid = vnode->fid; +- } else { +- __entry->fid.vid = 0; +- __entry->fid.vnode = 0; +- __entry->fid.unique = 0; +- } ++ __entry->fid = *fid; + memcpy(__entry->name, name->name, __len); + __entry->name[__len] = 0; + ), +diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h +index a13830616107..7fd11ec1c9a4 100644 +--- a/include/trace/events/rpcrdma.h ++++ b/include/trace/events/rpcrdma.h +@@ -735,6 +735,31 @@ TRACE_EVENT(xprtrdma_post_recvs, + ) + ); + ++TRACE_EVENT(xprtrdma_post_linv, ++ TP_PROTO( ++ const struct rpcrdma_req *req, ++ int status ++ ), ++ ++ TP_ARGS(req, status), ++ ++ TP_STRUCT__entry( ++ __field(const void *, req) ++ __field(int, status) ++ __field(u32, xid) ++ ), ++ ++ TP_fast_assign( ++ __entry->req = req; ++ __entry->status = status; ++ __entry->xid = be32_to_cpu(req->rl_slot.rq_xid); ++ ), ++ ++ TP_printk("req=%p xid=0x%08x status=%d", ++ __entry->req, __entry->xid, __entry->status ++ ) ++); ++ + /** + ** Completion events + **/ +diff --git a/include/uapi/rdma/nes-abi.h b/include/uapi/rdma/nes-abi.h +deleted file mode 100644 +index f80495baa969..000000000000 +--- a/include/uapi/rdma/nes-abi.h ++++ /dev/null +@@ -1,115 +0,0 @@ +-/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ +-/* +- * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. +- * Copyright (c) 2005 Topspin Communications. All rights reserved. +- * Copyright (c) 2005 Cisco Systems. All rights reserved. +- * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. +- * +- * This software is available to you under a choice of one of two +- * licenses. You may choose to be licensed under the terms of the GNU +- * General Public License (GPL) Version 2, available from the file +- * COPYING in the main directory of this source tree, or the +- * OpenIB.org BSD license below: +- * +- * Redistribution and use in source and binary forms, with or +- * without modification, are permitted provided that the following +- * conditions are met: +- * +- * - Redistributions of source code must retain the above +- * copyright notice, this list of conditions and the following +- * disclaimer. +- * +- * - Redistributions in binary form must reproduce the above +- * copyright notice, this list of conditions and the following +- * disclaimer in the documentation and/or other materials +- * provided with the distribution. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +- * SOFTWARE. +- * +- */ +- +-#ifndef NES_ABI_USER_H +-#define NES_ABI_USER_H +- +-#include +- +-#define NES_ABI_USERSPACE_VER 2 +-#define NES_ABI_KERNEL_VER 2 +- +-/* +- * Make sure that all structs defined in this file remain laid out so +- * that they pack the same way on 32-bit and 64-bit architectures (to +- * avoid incompatibility between 32-bit userspace and 64-bit kernels). +- * In particular do not use pointer types -- pass pointers in __u64 +- * instead. +- */ +- +-struct nes_alloc_ucontext_req { +- __u32 reserved32; +- __u8 userspace_ver; +- __u8 reserved8[3]; +-}; +- +-struct nes_alloc_ucontext_resp { +- __u32 max_pds; /* maximum pds allowed for this user process */ +- __u32 max_qps; /* maximum qps allowed for this user process */ +- __u32 wq_size; /* size of the WQs (sq+rq) allocated to the mmaped area */ +- __u8 virtwq; /* flag to indicate if virtual WQ are to be used or not */ +- __u8 kernel_ver; +- __u8 reserved[2]; +-}; +- +-struct nes_alloc_pd_resp { +- __u32 pd_id; +- __u32 mmap_db_index; +-}; +- +-struct nes_create_cq_req { +- __aligned_u64 user_cq_buffer; +- __u32 mcrqf; +- __u8 reserved[4]; +-}; +- +-struct nes_create_qp_req { +- __aligned_u64 user_wqe_buffers; +- __aligned_u64 user_qp_buffer; +-}; +- +-enum iwnes_memreg_type { +- IWNES_MEMREG_TYPE_MEM = 0x0000, +- IWNES_MEMREG_TYPE_QP = 0x0001, +- IWNES_MEMREG_TYPE_CQ = 0x0002, +- IWNES_MEMREG_TYPE_MW = 0x0003, +- IWNES_MEMREG_TYPE_FMR = 0x0004, +- IWNES_MEMREG_TYPE_FMEM = 0x0005, +-}; +- +-struct nes_mem_reg_req { +- __u32 reg_type; /* indicates if id is memory, QP or CQ */ +- __u32 reserved; +-}; +- +-struct nes_create_cq_resp { +- __u32 cq_id; +- __u32 cq_size; +- __u32 mmap_db_index; +- __u32 reserved; +-}; +- +-struct nes_create_qp_resp { +- __u32 qp_id; +- __u32 actual_sq_size; +- __u32 actual_rq_size; +- __u32 mmap_sq_db_index; +- __u32 mmap_rq_db_index; +- __u32 nes_drv_opt; +-}; +- +-#endif /* NES_ABI_USER_H */ +diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c +index a3eaf08e7dd3..8bd69062fbe5 100644 +--- a/kernel/bpf/cgroup.c ++++ b/kernel/bpf/cgroup.c +@@ -35,8 +35,8 @@ void cgroup_bpf_offline(struct cgroup *cgrp) + */ + static void cgroup_bpf_release(struct work_struct *work) + { +- struct cgroup *cgrp = container_of(work, struct cgroup, +- bpf.release_work); ++ struct cgroup *p, *cgrp = container_of(work, struct cgroup, ++ bpf.release_work); + enum bpf_cgroup_storage_type stype; + struct bpf_prog_array *old_array; + unsigned int type; +@@ -65,6 +65,9 @@ static void cgroup_bpf_release(struct work_struct *work) + + mutex_unlock(&cgroup_mutex); + ++ for (p = cgroup_parent(cgrp); p; p = cgroup_parent(p)) ++ cgroup_bpf_put(p); ++ + percpu_ref_exit(&cgrp->bpf.refcnt); + cgroup_put(cgrp); + } +@@ -199,6 +202,7 @@ int cgroup_bpf_inherit(struct cgroup *cgrp) + */ + #define NR ARRAY_SIZE(cgrp->bpf.effective) + struct bpf_prog_array *arrays[NR] = {}; ++ struct cgroup *p; + int ret, i; + + ret = percpu_ref_init(&cgrp->bpf.refcnt, cgroup_bpf_release_fn, 0, +@@ -206,6 +210,9 @@ int cgroup_bpf_inherit(struct cgroup *cgrp) + if (ret) + return ret; + ++ for (p = cgroup_parent(cgrp); p; p = cgroup_parent(p)) ++ cgroup_bpf_get(p); ++ + for (i = 0; i < NR; i++) + INIT_LIST_HEAD(&cgrp->bpf.progs[i]); + +diff --git a/kernel/cred.c b/kernel/cred.c +index 9ed51b70ed80..809a985b1793 100644 +--- a/kernel/cred.c ++++ b/kernel/cred.c +@@ -175,8 +175,8 @@ void exit_creds(struct task_struct *tsk) + put_cred(cred); + + #ifdef CONFIG_KEYS_REQUEST_CACHE +- key_put(current->cached_requested_key); +- current->cached_requested_key = NULL; ++ key_put(tsk->cached_requested_key); ++ tsk->cached_requested_key = NULL; + #endif + } + +diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c +index 44bd08f2443b..89bdac61233d 100644 +--- a/kernel/trace/bpf_trace.c ++++ b/kernel/trace/bpf_trace.c +@@ -163,7 +163,7 @@ static const struct bpf_func_proto bpf_probe_read_proto = { + .arg3_type = ARG_ANYTHING, + }; + +-BPF_CALL_3(bpf_probe_write_user, void *, unsafe_ptr, const void *, src, ++BPF_CALL_3(bpf_probe_write_user, void __user *, unsafe_ptr, const void *, src, + u32, size) + { + /* +@@ -186,10 +186,8 @@ BPF_CALL_3(bpf_probe_write_user, void *, unsafe_ptr, const void *, src, + return -EPERM; + if (unlikely(!nmi_uaccess_okay())) + return -EPERM; +- if (!access_ok(unsafe_ptr, size)) +- return -EPERM; + +- return probe_kernel_write(unsafe_ptr, src, size); ++ return probe_user_write(unsafe_ptr, src, size); + } + + static const struct bpf_func_proto bpf_probe_write_user_proto = { +diff --git a/mm/maccess.c b/mm/maccess.c +index d065736f6b87..2d3c3d01064c 100644 +--- a/mm/maccess.c ++++ b/mm/maccess.c +@@ -18,6 +18,18 @@ probe_read_common(void *dst, const void __user *src, size_t size) + return ret ? -EFAULT : 0; + } + ++static __always_inline long ++probe_write_common(void __user *dst, const void *src, size_t size) ++{ ++ long ret; ++ ++ pagefault_disable(); ++ ret = __copy_to_user_inatomic(dst, src, size); ++ pagefault_enable(); ++ ++ return ret ? -EFAULT : 0; ++} ++ + /** + * probe_kernel_read(): safely attempt to read from a kernel-space location + * @dst: pointer to the buffer that shall take the data +@@ -85,6 +97,7 @@ EXPORT_SYMBOL_GPL(probe_user_read); + * Safely write to address @dst from the buffer at @src. If a kernel fault + * happens, handle that and return -EFAULT. + */ ++ + long __weak probe_kernel_write(void *dst, const void *src, size_t size) + __attribute__((alias("__probe_kernel_write"))); + +@@ -94,15 +107,39 @@ long __probe_kernel_write(void *dst, const void *src, size_t size) + mm_segment_t old_fs = get_fs(); + + set_fs(KERNEL_DS); +- pagefault_disable(); +- ret = __copy_to_user_inatomic((__force void __user *)dst, src, size); +- pagefault_enable(); ++ ret = probe_write_common((__force void __user *)dst, src, size); + set_fs(old_fs); + +- return ret ? -EFAULT : 0; ++ return ret; + } + EXPORT_SYMBOL_GPL(probe_kernel_write); + ++/** ++ * probe_user_write(): safely attempt to write to a user-space location ++ * @dst: address to write to ++ * @src: pointer to the data that shall be written ++ * @size: size of the data chunk ++ * ++ * Safely write to address @dst from the buffer at @src. If a kernel fault ++ * happens, handle that and return -EFAULT. ++ */ ++ ++long __weak probe_user_write(void __user *dst, const void *src, size_t size) ++ __attribute__((alias("__probe_user_write"))); ++ ++long __probe_user_write(void __user *dst, const void *src, size_t size) ++{ ++ long ret = -EFAULT; ++ mm_segment_t old_fs = get_fs(); ++ ++ set_fs(USER_DS); ++ if (access_ok(dst, size)) ++ ret = probe_write_common(dst, src, size); ++ set_fs(old_fs); ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(probe_user_write); + + /** + * strncpy_from_unsafe: - Copy a NUL terminated string from unsafe address. +diff --git a/net/core/skmsg.c b/net/core/skmsg.c +index 0675d022584e..ded2d5227678 100644 +--- a/net/core/skmsg.c ++++ b/net/core/skmsg.c +@@ -793,15 +793,18 @@ static void sk_psock_strp_data_ready(struct sock *sk) + static void sk_psock_write_space(struct sock *sk) + { + struct sk_psock *psock; +- void (*write_space)(struct sock *sk); ++ void (*write_space)(struct sock *sk) = NULL; + + rcu_read_lock(); + psock = sk_psock(sk); +- if (likely(psock && sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED))) +- schedule_work(&psock->work); +- write_space = psock->saved_write_space; ++ if (likely(psock)) { ++ if (sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED)) ++ schedule_work(&psock->work); ++ write_space = psock->saved_write_space; ++ } + rcu_read_unlock(); +- write_space(sk); ++ if (write_space) ++ write_space(sk); + } + + int sk_psock_init_strp(struct sock *sk, struct sk_psock *psock) +diff --git a/net/hsr/hsr_debugfs.c b/net/hsr/hsr_debugfs.c +index 6618a9d8e58e..d5f709b940ff 100644 +--- a/net/hsr/hsr_debugfs.c ++++ b/net/hsr/hsr_debugfs.c +@@ -20,6 +20,8 @@ + #include "hsr_main.h" + #include "hsr_framereg.h" + ++static struct dentry *hsr_debugfs_root_dir; ++ + static void print_mac_address(struct seq_file *sfp, unsigned char *mac) + { + seq_printf(sfp, "%02x:%02x:%02x:%02x:%02x:%02x:", +@@ -63,6 +65,19 @@ hsr_node_table_open(struct inode *inode, struct file *filp) + return single_open(filp, hsr_node_table_show, inode->i_private); + } + ++void hsr_debugfs_rename(struct net_device *dev) ++{ ++ struct hsr_priv *priv = netdev_priv(dev); ++ struct dentry *d; ++ ++ d = debugfs_rename(hsr_debugfs_root_dir, priv->node_tbl_root, ++ hsr_debugfs_root_dir, dev->name); ++ if (IS_ERR(d)) ++ netdev_warn(dev, "failed to rename\n"); ++ else ++ priv->node_tbl_root = d; ++} ++ + static const struct file_operations hsr_fops = { + .open = hsr_node_table_open, + .read = seq_read, +@@ -81,9 +96,9 @@ void hsr_debugfs_init(struct hsr_priv *priv, struct net_device *hsr_dev) + { + struct dentry *de = NULL; + +- de = debugfs_create_dir(hsr_dev->name, NULL); ++ de = debugfs_create_dir(hsr_dev->name, hsr_debugfs_root_dir); + if (IS_ERR(de)) { +- pr_err("Cannot create hsr debugfs root\n"); ++ pr_err("Cannot create hsr debugfs directory\n"); + return; + } + +@@ -93,7 +108,7 @@ void hsr_debugfs_init(struct hsr_priv *priv, struct net_device *hsr_dev) + priv->node_tbl_root, priv, + &hsr_fops); + if (IS_ERR(de)) { +- pr_err("Cannot create hsr node_table directory\n"); ++ pr_err("Cannot create hsr node_table file\n"); + debugfs_remove(priv->node_tbl_root); + priv->node_tbl_root = NULL; + return; +@@ -115,3 +130,18 @@ hsr_debugfs_term(struct hsr_priv *priv) + debugfs_remove(priv->node_tbl_root); + priv->node_tbl_root = NULL; + } ++ ++void hsr_debugfs_create_root(void) ++{ ++ hsr_debugfs_root_dir = debugfs_create_dir("hsr", NULL); ++ if (IS_ERR(hsr_debugfs_root_dir)) { ++ pr_err("Cannot create hsr debugfs root directory\n"); ++ hsr_debugfs_root_dir = NULL; ++ } ++} ++ ++void hsr_debugfs_remove_root(void) ++{ ++ /* debugfs_remove() internally checks NULL and ERROR */ ++ debugfs_remove(hsr_debugfs_root_dir); ++} +diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c +index 62c03f0d0079..c7bd6c49fadf 100644 +--- a/net/hsr/hsr_device.c ++++ b/net/hsr/hsr_device.c +@@ -272,6 +272,8 @@ static void send_hsr_supervision_frame(struct hsr_port *master, + skb->dev->dev_addr, skb->len) <= 0) + goto out; + skb_reset_mac_header(skb); ++ skb_reset_network_header(skb); ++ skb_reset_transport_header(skb); + + if (hsr_ver > 0) { + hsr_tag = skb_put(skb, sizeof(struct hsr_tag)); +diff --git a/net/hsr/hsr_main.c b/net/hsr/hsr_main.c +index 6deb8fa8d5c8..9e389accbfc7 100644 +--- a/net/hsr/hsr_main.c ++++ b/net/hsr/hsr_main.c +@@ -45,6 +45,10 @@ static int hsr_netdev_notify(struct notifier_block *nb, unsigned long event, + case NETDEV_CHANGE: /* Link (carrier) state changes */ + hsr_check_carrier_and_operstate(hsr); + break; ++ case NETDEV_CHANGENAME: ++ if (is_hsr_master(dev)) ++ hsr_debugfs_rename(dev); ++ break; + case NETDEV_CHANGEADDR: + if (port->type == HSR_PT_MASTER) { + /* This should not happen since there's no +@@ -123,6 +127,7 @@ static void __exit hsr_exit(void) + { + unregister_netdevice_notifier(&hsr_nb); + hsr_netlink_exit(); ++ hsr_debugfs_remove_root(); + } + + module_init(hsr_init); +diff --git a/net/hsr/hsr_main.h b/net/hsr/hsr_main.h +index 9ec38e33b8b1..d40de84a637f 100644 +--- a/net/hsr/hsr_main.h ++++ b/net/hsr/hsr_main.h +@@ -185,14 +185,24 @@ static inline u16 hsr_get_skb_sequence_nr(struct sk_buff *skb) + } + + #if IS_ENABLED(CONFIG_DEBUG_FS) ++void hsr_debugfs_rename(struct net_device *dev); + void hsr_debugfs_init(struct hsr_priv *priv, struct net_device *hsr_dev); + void hsr_debugfs_term(struct hsr_priv *priv); ++void hsr_debugfs_create_root(void); ++void hsr_debugfs_remove_root(void); + #else ++static inline void void hsr_debugfs_rename(struct net_device *dev) ++{ ++} + static inline void hsr_debugfs_init(struct hsr_priv *priv, + struct net_device *hsr_dev) + {} + static inline void hsr_debugfs_term(struct hsr_priv *priv) + {} ++static inline void hsr_debugfs_create_root(void) ++{} ++static inline void hsr_debugfs_remove_root(void) ++{} + #endif + + #endif /* __HSR_PRIVATE_H */ +diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c +index 8f8337f893ba..8dc0547f01d0 100644 +--- a/net/hsr/hsr_netlink.c ++++ b/net/hsr/hsr_netlink.c +@@ -476,6 +476,7 @@ int __init hsr_netlink_init(void) + if (rc) + goto fail_genl_register_family; + ++ hsr_debugfs_create_root(); + return 0; + + fail_genl_register_family: +diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c +index e743f811245f..96a64e7594a5 100644 +--- a/net/netfilter/nf_tables_offload.c ++++ b/net/netfilter/nf_tables_offload.c +@@ -358,14 +358,14 @@ int nft_flow_rule_offload_commit(struct net *net) + continue; + + if (trans->ctx.flags & NLM_F_REPLACE || +- !(trans->ctx.flags & NLM_F_APPEND)) +- return -EOPNOTSUPP; +- ++ !(trans->ctx.flags & NLM_F_APPEND)) { ++ err = -EOPNOTSUPP; ++ break; ++ } + err = nft_flow_offload_rule(trans->ctx.chain, + nft_trans_rule(trans), + nft_trans_flow_rule(trans), + FLOW_CLS_REPLACE); +- nft_flow_rule_destroy(nft_trans_flow_rule(trans)); + break; + case NFT_MSG_DELRULE: + if (!(trans->ctx.chain->flags & NFT_CHAIN_HW_OFFLOAD)) +@@ -379,7 +379,23 @@ int nft_flow_rule_offload_commit(struct net *net) + } + + if (err) +- return err; ++ break; ++ } ++ ++ list_for_each_entry(trans, &net->nft.commit_list, list) { ++ if (trans->ctx.family != NFPROTO_NETDEV) ++ continue; ++ ++ switch (trans->msg_type) { ++ case NFT_MSG_NEWRULE: ++ if (!(trans->ctx.chain->flags & NFT_CHAIN_HW_OFFLOAD)) ++ continue; ++ ++ nft_flow_rule_destroy(nft_trans_flow_rule(trans)); ++ break; ++ default: ++ break; ++ } + } + + return err; +diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c +index f29bbc74c4bf..ff5ac173e897 100644 +--- a/net/netfilter/nft_flow_offload.c ++++ b/net/netfilter/nft_flow_offload.c +@@ -197,9 +197,6 @@ static void nft_flow_offload_activate(const struct nft_ctx *ctx, + static void nft_flow_offload_destroy(const struct nft_ctx *ctx, + const struct nft_expr *expr) + { +- struct nft_flow_offload *priv = nft_expr_priv(expr); +- +- priv->flowtable->use--; + nf_ct_netns_put(ctx->net, ctx->family); + } + +diff --git a/net/netfilter/nft_meta.c b/net/netfilter/nft_meta.c +index 317e3a9e8c5b..dda1e55d5801 100644 +--- a/net/netfilter/nft_meta.c ++++ b/net/netfilter/nft_meta.c +@@ -33,19 +33,19 @@ + + static DEFINE_PER_CPU(struct rnd_state, nft_prandom_state); + +-static u8 nft_meta_weekday(unsigned long secs) ++static u8 nft_meta_weekday(time64_t secs) + { + unsigned int dse; + u8 wday; + + secs -= NFT_META_SECS_PER_MINUTE * sys_tz.tz_minuteswest; +- dse = secs / NFT_META_SECS_PER_DAY; ++ dse = div_u64(secs, NFT_META_SECS_PER_DAY); + wday = (4 + dse) % NFT_META_DAYS_PER_WEEK; + + return wday; + } + +-static u32 nft_meta_hour(unsigned long secs) ++static u32 nft_meta_hour(time64_t secs) + { + struct tm tm; + +@@ -250,10 +250,10 @@ void nft_meta_get_eval(const struct nft_expr *expr, + nft_reg_store64(dest, ktime_get_real_ns()); + break; + case NFT_META_TIME_DAY: +- nft_reg_store8(dest, nft_meta_weekday(get_seconds())); ++ nft_reg_store8(dest, nft_meta_weekday(ktime_get_real_seconds())); + break; + case NFT_META_TIME_HOUR: +- *dest = nft_meta_hour(get_seconds()); ++ *dest = nft_meta_hour(ktime_get_real_seconds()); + break; + default: + WARN_ON(1); +diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h +index 7c7d10f2e0c1..5e99df80e80a 100644 +--- a/net/rxrpc/ar-internal.h ++++ b/net/rxrpc/ar-internal.h +@@ -209,6 +209,7 @@ struct rxrpc_skb_priv { + struct rxrpc_security { + const char *name; /* name of this service */ + u8 security_index; /* security type provided */ ++ u32 no_key_abort; /* Abort code indicating no key */ + + /* Initialise a security service */ + int (*init)(void); +@@ -977,8 +978,9 @@ static inline void rxrpc_reduce_conn_timer(struct rxrpc_connection *conn, + struct rxrpc_connection *rxrpc_find_service_conn_rcu(struct rxrpc_peer *, + struct sk_buff *); + struct rxrpc_connection *rxrpc_prealloc_service_connection(struct rxrpc_net *, gfp_t); +-void rxrpc_new_incoming_connection(struct rxrpc_sock *, +- struct rxrpc_connection *, struct sk_buff *); ++void rxrpc_new_incoming_connection(struct rxrpc_sock *, struct rxrpc_connection *, ++ const struct rxrpc_security *, struct key *, ++ struct sk_buff *); + void rxrpc_unpublish_service_conn(struct rxrpc_connection *); + + /* +@@ -1103,7 +1105,9 @@ extern const struct rxrpc_security rxkad; + int __init rxrpc_init_security(void); + void rxrpc_exit_security(void); + int rxrpc_init_client_conn_security(struct rxrpc_connection *); +-int rxrpc_init_server_conn_security(struct rxrpc_connection *); ++bool rxrpc_look_up_server_security(struct rxrpc_local *, struct rxrpc_sock *, ++ const struct rxrpc_security **, struct key **, ++ struct sk_buff *); + + /* + * sendmsg.c +diff --git a/net/rxrpc/call_accept.c b/net/rxrpc/call_accept.c +index 135bf5cd8dd5..70e44abf106c 100644 +--- a/net/rxrpc/call_accept.c ++++ b/net/rxrpc/call_accept.c +@@ -239,6 +239,22 @@ void rxrpc_discard_prealloc(struct rxrpc_sock *rx) + kfree(b); + } + ++/* ++ * Ping the other end to fill our RTT cache and to retrieve the rwind ++ * and MTU parameters. ++ */ ++static void rxrpc_send_ping(struct rxrpc_call *call, struct sk_buff *skb) ++{ ++ struct rxrpc_skb_priv *sp = rxrpc_skb(skb); ++ ktime_t now = skb->tstamp; ++ ++ if (call->peer->rtt_usage < 3 || ++ ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000), now)) ++ rxrpc_propose_ACK(call, RXRPC_ACK_PING, sp->hdr.serial, ++ true, true, ++ rxrpc_propose_ack_ping_for_params); ++} ++ + /* + * Allocate a new incoming call from the prealloc pool, along with a connection + * and a peer as necessary. +@@ -247,6 +263,8 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx, + struct rxrpc_local *local, + struct rxrpc_peer *peer, + struct rxrpc_connection *conn, ++ const struct rxrpc_security *sec, ++ struct key *key, + struct sk_buff *skb) + { + struct rxrpc_backlog *b = rx->backlog; +@@ -294,7 +312,7 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx, + conn->params.local = rxrpc_get_local(local); + conn->params.peer = peer; + rxrpc_see_connection(conn); +- rxrpc_new_incoming_connection(rx, conn, skb); ++ rxrpc_new_incoming_connection(rx, conn, sec, key, skb); + } else { + rxrpc_get_connection(conn); + } +@@ -333,9 +351,11 @@ struct rxrpc_call *rxrpc_new_incoming_call(struct rxrpc_local *local, + struct sk_buff *skb) + { + struct rxrpc_skb_priv *sp = rxrpc_skb(skb); ++ const struct rxrpc_security *sec = NULL; + struct rxrpc_connection *conn; + struct rxrpc_peer *peer = NULL; +- struct rxrpc_call *call; ++ struct rxrpc_call *call = NULL; ++ struct key *key = NULL; + + _enter(""); + +@@ -346,9 +366,7 @@ struct rxrpc_call *rxrpc_new_incoming_call(struct rxrpc_local *local, + sp->hdr.seq, RX_INVALID_OPERATION, ESHUTDOWN); + skb->mark = RXRPC_SKB_MARK_REJECT_ABORT; + skb->priority = RX_INVALID_OPERATION; +- _leave(" = NULL [close]"); +- call = NULL; +- goto out; ++ goto no_call; + } + + /* The peer, connection and call may all have sprung into existence due +@@ -358,29 +376,19 @@ struct rxrpc_call *rxrpc_new_incoming_call(struct rxrpc_local *local, + */ + conn = rxrpc_find_connection_rcu(local, skb, &peer); + +- call = rxrpc_alloc_incoming_call(rx, local, peer, conn, skb); ++ if (!conn && !rxrpc_look_up_server_security(local, rx, &sec, &key, skb)) ++ goto no_call; ++ ++ call = rxrpc_alloc_incoming_call(rx, local, peer, conn, sec, key, skb); ++ key_put(key); + if (!call) { + skb->mark = RXRPC_SKB_MARK_REJECT_BUSY; +- _leave(" = NULL [busy]"); +- call = NULL; +- goto out; ++ goto no_call; + } + + trace_rxrpc_receive(call, rxrpc_receive_incoming, + sp->hdr.serial, sp->hdr.seq); + +- /* Lock the call to prevent rxrpc_kernel_send/recv_data() and +- * sendmsg()/recvmsg() inconveniently stealing the mutex once the +- * notification is generated. +- * +- * The BUG should never happen because the kernel should be well +- * behaved enough not to access the call before the first notification +- * event and userspace is prevented from doing so until the state is +- * appropriate. +- */ +- if (!mutex_trylock(&call->user_mutex)) +- BUG(); +- + /* Make the call live. */ + rxrpc_incoming_call(rx, call, skb); + conn = call->conn; +@@ -421,6 +429,9 @@ struct rxrpc_call *rxrpc_new_incoming_call(struct rxrpc_local *local, + BUG(); + } + spin_unlock(&conn->state_lock); ++ spin_unlock(&rx->incoming_lock); ++ ++ rxrpc_send_ping(call, skb); + + if (call->state == RXRPC_CALL_SERVER_ACCEPTING) + rxrpc_notify_socket(call); +@@ -433,9 +444,12 @@ struct rxrpc_call *rxrpc_new_incoming_call(struct rxrpc_local *local, + rxrpc_put_call(call, rxrpc_call_put); + + _leave(" = %p{%d}", call, call->debug_id); +-out: +- spin_unlock(&rx->incoming_lock); + return call; ++ ++no_call: ++ spin_unlock(&rx->incoming_lock); ++ _leave(" = NULL [%u]", skb->mark); ++ return NULL; + } + + /* +diff --git a/net/rxrpc/conn_event.c b/net/rxrpc/conn_event.c +index a1ceef4f5cd0..808a4723f868 100644 +--- a/net/rxrpc/conn_event.c ++++ b/net/rxrpc/conn_event.c +@@ -376,21 +376,7 @@ static void rxrpc_secure_connection(struct rxrpc_connection *conn) + _enter("{%d}", conn->debug_id); + + ASSERT(conn->security_ix != 0); +- +- if (!conn->params.key) { +- _debug("set up security"); +- ret = rxrpc_init_server_conn_security(conn); +- switch (ret) { +- case 0: +- break; +- case -ENOENT: +- abort_code = RX_CALL_DEAD; +- goto abort; +- default: +- abort_code = RXKADNOAUTH; +- goto abort; +- } +- } ++ ASSERT(conn->server_key); + + if (conn->security->issue_challenge(conn) < 0) { + abort_code = RX_CALL_DEAD; +diff --git a/net/rxrpc/conn_service.c b/net/rxrpc/conn_service.c +index 123d6ceab15c..21da48e3d2e5 100644 +--- a/net/rxrpc/conn_service.c ++++ b/net/rxrpc/conn_service.c +@@ -148,6 +148,8 @@ struct rxrpc_connection *rxrpc_prealloc_service_connection(struct rxrpc_net *rxn + */ + void rxrpc_new_incoming_connection(struct rxrpc_sock *rx, + struct rxrpc_connection *conn, ++ const struct rxrpc_security *sec, ++ struct key *key, + struct sk_buff *skb) + { + struct rxrpc_skb_priv *sp = rxrpc_skb(skb); +@@ -160,6 +162,8 @@ void rxrpc_new_incoming_connection(struct rxrpc_sock *rx, + conn->service_id = sp->hdr.serviceId; + conn->security_ix = sp->hdr.securityIndex; + conn->out_clientflag = 0; ++ conn->security = sec; ++ conn->server_key = key_get(key); + if (conn->security_ix) + conn->state = RXRPC_CONN_SERVICE_UNSECURED; + else +diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c +index 157be1ff8697..86bd133b4fa0 100644 +--- a/net/rxrpc/input.c ++++ b/net/rxrpc/input.c +@@ -192,22 +192,6 @@ send_extra_data: + goto out_no_clear_ca; + } + +-/* +- * Ping the other end to fill our RTT cache and to retrieve the rwind +- * and MTU parameters. +- */ +-static void rxrpc_send_ping(struct rxrpc_call *call, struct sk_buff *skb) +-{ +- struct rxrpc_skb_priv *sp = rxrpc_skb(skb); +- ktime_t now = skb->tstamp; +- +- if (call->peer->rtt_usage < 3 || +- ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000), now)) +- rxrpc_propose_ACK(call, RXRPC_ACK_PING, sp->hdr.serial, +- true, true, +- rxrpc_propose_ack_ping_for_params); +-} +- + /* + * Apply a hard ACK by advancing the Tx window. + */ +@@ -1396,8 +1380,6 @@ int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb) + call = rxrpc_new_incoming_call(local, rx, skb); + if (!call) + goto reject_packet; +- rxrpc_send_ping(call, skb); +- mutex_unlock(&call->user_mutex); + } + + /* Process a call packet; this either discards or passes on the ref +diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c +index 8d8aa3c230b5..098f1f9ec53b 100644 +--- a/net/rxrpc/rxkad.c ++++ b/net/rxrpc/rxkad.c +@@ -648,9 +648,9 @@ static int rxkad_issue_challenge(struct rxrpc_connection *conn) + u32 serial; + int ret; + +- _enter("{%d,%x}", conn->debug_id, key_serial(conn->params.key)); ++ _enter("{%d,%x}", conn->debug_id, key_serial(conn->server_key)); + +- ret = key_validate(conn->params.key); ++ ret = key_validate(conn->server_key); + if (ret < 0) + return ret; + +@@ -1293,6 +1293,7 @@ static void rxkad_exit(void) + const struct rxrpc_security rxkad = { + .name = "rxkad", + .security_index = RXRPC_SECURITY_RXKAD, ++ .no_key_abort = RXKADUNKNOWNKEY, + .init = rxkad_init, + .exit = rxkad_exit, + .init_connection_security = rxkad_init_connection_security, +diff --git a/net/rxrpc/security.c b/net/rxrpc/security.c +index a4c47d2b7054..9b1fb9ed0717 100644 +--- a/net/rxrpc/security.c ++++ b/net/rxrpc/security.c +@@ -101,62 +101,58 @@ int rxrpc_init_client_conn_security(struct rxrpc_connection *conn) + } + + /* +- * initialise the security on a server connection ++ * Find the security key for a server connection. + */ +-int rxrpc_init_server_conn_security(struct rxrpc_connection *conn) ++bool rxrpc_look_up_server_security(struct rxrpc_local *local, struct rxrpc_sock *rx, ++ const struct rxrpc_security **_sec, ++ struct key **_key, ++ struct sk_buff *skb) + { + const struct rxrpc_security *sec; +- struct rxrpc_local *local = conn->params.local; +- struct rxrpc_sock *rx; +- struct key *key; +- key_ref_t kref; ++ struct rxrpc_skb_priv *sp = rxrpc_skb(skb); ++ key_ref_t kref = NULL; + char kdesc[5 + 1 + 3 + 1]; + + _enter(""); + +- sprintf(kdesc, "%u:%u", conn->service_id, conn->security_ix); ++ sprintf(kdesc, "%u:%u", sp->hdr.serviceId, sp->hdr.securityIndex); + +- sec = rxrpc_security_lookup(conn->security_ix); ++ sec = rxrpc_security_lookup(sp->hdr.securityIndex); + if (!sec) { +- _leave(" = -ENOKEY [lookup]"); +- return -ENOKEY; ++ trace_rxrpc_abort(0, "SVS", ++ sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq, ++ RX_INVALID_OPERATION, EKEYREJECTED); ++ skb->mark = RXRPC_SKB_MARK_REJECT_ABORT; ++ skb->priority = RX_INVALID_OPERATION; ++ return false; + } + +- /* find the service */ +- read_lock(&local->services_lock); +- rx = rcu_dereference_protected(local->service, +- lockdep_is_held(&local->services_lock)); +- if (rx && (rx->srx.srx_service == conn->service_id || +- rx->second_service == conn->service_id)) +- goto found_service; ++ if (sp->hdr.securityIndex == RXRPC_SECURITY_NONE) ++ goto out; + +- /* the service appears to have died */ +- read_unlock(&local->services_lock); +- _leave(" = -ENOENT"); +- return -ENOENT; +- +-found_service: + if (!rx->securities) { +- read_unlock(&local->services_lock); +- _leave(" = -ENOKEY"); +- return -ENOKEY; ++ trace_rxrpc_abort(0, "SVR", ++ sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq, ++ RX_INVALID_OPERATION, EKEYREJECTED); ++ skb->mark = RXRPC_SKB_MARK_REJECT_ABORT; ++ skb->priority = RX_INVALID_OPERATION; ++ return false; + } + + /* look through the service's keyring */ + kref = keyring_search(make_key_ref(rx->securities, 1UL), + &key_type_rxrpc_s, kdesc, true); + if (IS_ERR(kref)) { +- read_unlock(&local->services_lock); +- _leave(" = %ld [search]", PTR_ERR(kref)); +- return PTR_ERR(kref); ++ trace_rxrpc_abort(0, "SVK", ++ sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq, ++ sec->no_key_abort, EKEYREJECTED); ++ skb->mark = RXRPC_SKB_MARK_REJECT_ABORT; ++ skb->priority = sec->no_key_abort; ++ return false; + } + +- key = key_ref_to_ptr(kref); +- read_unlock(&local->services_lock); +- +- conn->server_key = key; +- conn->security = sec; +- +- _leave(" = 0"); +- return 0; ++out: ++ *_sec = sec; ++ *_key = key_ref_to_ptr(kref); ++ return true; + } +diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c +index dd0e8680b030..2277369feae5 100644 +--- a/net/sched/sch_cake.c ++++ b/net/sched/sch_cake.c +@@ -2184,6 +2184,7 @@ static const struct nla_policy cake_policy[TCA_CAKE_MAX + 1] = { + [TCA_CAKE_MPU] = { .type = NLA_U32 }, + [TCA_CAKE_INGRESS] = { .type = NLA_U32 }, + [TCA_CAKE_ACK_FILTER] = { .type = NLA_U32 }, ++ [TCA_CAKE_SPLIT_GSO] = { .type = NLA_U32 }, + [TCA_CAKE_FWMARK] = { .type = NLA_U32 }, + }; + +diff --git a/net/socket.c b/net/socket.c +index ca8de9e1582d..432800b39ddb 100644 +--- a/net/socket.c ++++ b/net/socket.c +@@ -3532,6 +3532,7 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, + case SIOCSARP: + case SIOCGARP: + case SIOCDARP: ++ case SIOCOUTQNSD: + case SIOCATMARK: + return sock_do_ioctl(net, sock, cmd, arg); + } +diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c +index 30065a28628c..9901a811f598 100644 +--- a/net/sunrpc/xprtrdma/frwr_ops.c ++++ b/net/sunrpc/xprtrdma/frwr_ops.c +@@ -570,7 +570,6 @@ void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) + */ + bad_wr = NULL; + rc = ib_post_send(r_xprt->rx_ia.ri_id->qp, first, &bad_wr); +- trace_xprtrdma_post_send(req, rc); + + /* The final LOCAL_INV WR in the chain is supposed to + * do the wake. If it was never posted, the wake will +@@ -583,6 +582,7 @@ void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) + + /* Recycle MRs in the LOCAL_INV chain that did not get posted. + */ ++ trace_xprtrdma_post_linv(req, rc); + while (bad_wr) { + frwr = container_of(bad_wr, struct rpcrdma_frwr, + fr_invwr); +@@ -673,12 +673,12 @@ void frwr_unmap_async(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req) + */ + bad_wr = NULL; + rc = ib_post_send(r_xprt->rx_ia.ri_id->qp, first, &bad_wr); +- trace_xprtrdma_post_send(req, rc); + if (!rc) + return; + + /* Recycle MRs in the LOCAL_INV chain that did not get posted. + */ ++ trace_xprtrdma_post_linv(req, rc); + while (bad_wr) { + frwr = container_of(bad_wr, struct rpcrdma_frwr, fr_invwr); + mr = container_of(frwr, struct rpcrdma_mr, frwr); +diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c +index b86b5fd62d9f..ef5102b60589 100644 +--- a/net/sunrpc/xprtrdma/rpc_rdma.c ++++ b/net/sunrpc/xprtrdma/rpc_rdma.c +@@ -1362,6 +1362,7 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *rep) + xprt->cwnd = credits << RPC_CWNDSHIFT; + spin_unlock(&xprt->transport_lock); + } ++ rpcrdma_post_recvs(r_xprt, false); + + req = rpcr_to_rdmar(rqst); + if (req->rl_reply) { +diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c +index 160558b4135e..c67d465dc062 100644 +--- a/net/sunrpc/xprtrdma/transport.c ++++ b/net/sunrpc/xprtrdma/transport.c +@@ -428,8 +428,11 @@ void xprt_rdma_close(struct rpc_xprt *xprt) + /* Prepare @xprt for the next connection by reinitializing + * its credit grant to one (see RFC 8166, Section 3.3.3). + */ ++ spin_lock(&xprt->transport_lock); + r_xprt->rx_buf.rb_credits = 1; ++ xprt->cong = 0; + xprt->cwnd = RPC_CWNDSHIFT; ++ spin_unlock(&xprt->transport_lock); + + out: + xprt->reestablish_timeout = 0; +diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c +index 3a907537e2cf..0f4d39fdb48f 100644 +--- a/net/sunrpc/xprtrdma/verbs.c ++++ b/net/sunrpc/xprtrdma/verbs.c +@@ -75,16 +75,15 @@ + * internal functions + */ + static void rpcrdma_sendctx_put_locked(struct rpcrdma_sendctx *sc); +-static void rpcrdma_reps_destroy(struct rpcrdma_buffer *buf); ++static void rpcrdma_reqs_reset(struct rpcrdma_xprt *r_xprt); ++static void rpcrdma_reps_unmap(struct rpcrdma_xprt *r_xprt); + static void rpcrdma_mrs_create(struct rpcrdma_xprt *r_xprt); + static void rpcrdma_mrs_destroy(struct rpcrdma_buffer *buf); +-static void rpcrdma_mr_free(struct rpcrdma_mr *mr); + static struct rpcrdma_regbuf * + rpcrdma_regbuf_alloc(size_t size, enum dma_data_direction direction, + gfp_t flags); + static void rpcrdma_regbuf_dma_unmap(struct rpcrdma_regbuf *rb); + static void rpcrdma_regbuf_free(struct rpcrdma_regbuf *rb); +-static void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp); + + /* Wait for outstanding transport work to finish. ib_drain_qp + * handles the drains in the wrong order for us, so open code +@@ -170,7 +169,6 @@ rpcrdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc) + rdmab_addr(rep->rr_rdmabuf), + wc->byte_len, DMA_FROM_DEVICE); + +- rpcrdma_post_recvs(r_xprt, false); + rpcrdma_reply_handler(rep); + return; + +@@ -247,6 +245,7 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) + ia->ri_id->device->name, + rpcrdma_addrstr(r_xprt), rpcrdma_portstr(r_xprt)); + #endif ++ init_completion(&ia->ri_remove_done); + set_bit(RPCRDMA_IAF_REMOVING, &ia->ri_flags); + ep->rep_connected = -ENODEV; + xprt_force_disconnect(xprt); +@@ -301,7 +300,6 @@ rpcrdma_create_id(struct rpcrdma_xprt *xprt, struct rpcrdma_ia *ia) + trace_xprtrdma_conn_start(xprt); + + init_completion(&ia->ri_done); +- init_completion(&ia->ri_remove_done); + + id = rdma_create_id(xprt->rx_xprt.xprt_net, rpcrdma_cm_event_handler, + xprt, RDMA_PS_TCP, IB_QPT_RC); +@@ -431,7 +429,7 @@ rpcrdma_ia_remove(struct rpcrdma_ia *ia) + /* The ULP is responsible for ensuring all DMA + * mappings and MRs are gone. + */ +- rpcrdma_reps_destroy(buf); ++ rpcrdma_reps_unmap(r_xprt); + list_for_each_entry(req, &buf->rb_allreqs, rl_all) { + rpcrdma_regbuf_dma_unmap(req->rl_rdmabuf); + rpcrdma_regbuf_dma_unmap(req->rl_sendbuf); +@@ -609,6 +607,7 @@ static int rpcrdma_ep_recreate_xprt(struct rpcrdma_xprt *r_xprt, + struct ib_qp_init_attr *qp_init_attr) + { + struct rpcrdma_ia *ia = &r_xprt->rx_ia; ++ struct rpcrdma_ep *ep = &r_xprt->rx_ep; + int rc, err; + + trace_xprtrdma_reinsert(r_xprt); +@@ -623,6 +622,7 @@ static int rpcrdma_ep_recreate_xprt(struct rpcrdma_xprt *r_xprt, + pr_err("rpcrdma: rpcrdma_ep_create returned %d\n", err); + goto out2; + } ++ memcpy(qp_init_attr, &ep->rep_attr, sizeof(*qp_init_attr)); + + rc = -ENETUNREACH; + err = rdma_create_qp(ia->ri_id, ia->ri_pd, qp_init_attr); +@@ -780,6 +780,7 @@ rpcrdma_ep_disconnect(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia) + trace_xprtrdma_disconnect(r_xprt, rc); + + rpcrdma_xprt_drain(r_xprt); ++ rpcrdma_reqs_reset(r_xprt); + } + + /* Fixed-size circular FIFO queue. This implementation is wait-free and +@@ -965,7 +966,7 @@ rpcrdma_mrs_create(struct rpcrdma_xprt *r_xprt) + mr->mr_xprt = r_xprt; + + spin_lock(&buf->rb_lock); +- list_add(&mr->mr_list, &buf->rb_mrs); ++ rpcrdma_mr_push(mr, &buf->rb_mrs); + list_add(&mr->mr_all, &buf->rb_all_mrs); + spin_unlock(&buf->rb_lock); + } +@@ -1042,6 +1043,26 @@ out1: + return NULL; + } + ++/** ++ * rpcrdma_reqs_reset - Reset all reqs owned by a transport ++ * @r_xprt: controlling transport instance ++ * ++ * ASSUMPTION: the rb_allreqs list is stable for the duration, ++ * and thus can be walked without holding rb_lock. Eg. the ++ * caller is holding the transport send lock to exclude ++ * device removal or disconnection. ++ */ ++static void rpcrdma_reqs_reset(struct rpcrdma_xprt *r_xprt) ++{ ++ struct rpcrdma_buffer *buf = &r_xprt->rx_buf; ++ struct rpcrdma_req *req; ++ ++ list_for_each_entry(req, &buf->rb_allreqs, rl_all) { ++ /* Credits are valid only for one connection */ ++ req->rl_slot.rq_cong = 0; ++ } ++} ++ + static struct rpcrdma_rep *rpcrdma_rep_create(struct rpcrdma_xprt *r_xprt, + bool temp) + { +@@ -1065,6 +1086,7 @@ static struct rpcrdma_rep *rpcrdma_rep_create(struct rpcrdma_xprt *r_xprt, + rep->rr_recv_wr.sg_list = &rep->rr_rdmabuf->rg_iov; + rep->rr_recv_wr.num_sge = 1; + rep->rr_temp = temp; ++ list_add(&rep->rr_all, &r_xprt->rx_buf.rb_all_reps); + return rep; + + out_free: +@@ -1075,6 +1097,7 @@ out: + + static void rpcrdma_rep_destroy(struct rpcrdma_rep *rep) + { ++ list_del(&rep->rr_all); + rpcrdma_regbuf_free(rep->rr_rdmabuf); + kfree(rep); + } +@@ -1093,10 +1116,16 @@ static struct rpcrdma_rep *rpcrdma_rep_get_locked(struct rpcrdma_buffer *buf) + static void rpcrdma_rep_put(struct rpcrdma_buffer *buf, + struct rpcrdma_rep *rep) + { +- if (!rep->rr_temp) +- llist_add(&rep->rr_node, &buf->rb_free_reps); +- else +- rpcrdma_rep_destroy(rep); ++ llist_add(&rep->rr_node, &buf->rb_free_reps); ++} ++ ++static void rpcrdma_reps_unmap(struct rpcrdma_xprt *r_xprt) ++{ ++ struct rpcrdma_buffer *buf = &r_xprt->rx_buf; ++ struct rpcrdma_rep *rep; ++ ++ list_for_each_entry(rep, &buf->rb_all_reps, rr_all) ++ rpcrdma_regbuf_dma_unmap(rep->rr_rdmabuf); + } + + static void rpcrdma_reps_destroy(struct rpcrdma_buffer *buf) +@@ -1129,6 +1158,7 @@ int rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt) + + INIT_LIST_HEAD(&buf->rb_send_bufs); + INIT_LIST_HEAD(&buf->rb_allreqs); ++ INIT_LIST_HEAD(&buf->rb_all_reps); + + rc = -ENOMEM; + for (i = 0; i < buf->rb_max_requests; i++) { +@@ -1163,10 +1193,19 @@ out: + */ + void rpcrdma_req_destroy(struct rpcrdma_req *req) + { ++ struct rpcrdma_mr *mr; ++ + list_del(&req->rl_all); + +- while (!list_empty(&req->rl_free_mrs)) +- rpcrdma_mr_free(rpcrdma_mr_pop(&req->rl_free_mrs)); ++ while ((mr = rpcrdma_mr_pop(&req->rl_free_mrs))) { ++ struct rpcrdma_buffer *buf = &mr->mr_xprt->rx_buf; ++ ++ spin_lock(&buf->rb_lock); ++ list_del(&mr->mr_all); ++ spin_unlock(&buf->rb_lock); ++ ++ frwr_release_mr(mr); ++ } + + rpcrdma_regbuf_free(req->rl_recvbuf); + rpcrdma_regbuf_free(req->rl_sendbuf); +@@ -1174,24 +1213,28 @@ void rpcrdma_req_destroy(struct rpcrdma_req *req) + kfree(req); + } + +-static void +-rpcrdma_mrs_destroy(struct rpcrdma_buffer *buf) ++/** ++ * rpcrdma_mrs_destroy - Release all of a transport's MRs ++ * @buf: controlling buffer instance ++ * ++ * Relies on caller holding the transport send lock to protect ++ * removing mr->mr_list from req->rl_free_mrs safely. ++ */ ++static void rpcrdma_mrs_destroy(struct rpcrdma_buffer *buf) + { + struct rpcrdma_xprt *r_xprt = container_of(buf, struct rpcrdma_xprt, + rx_buf); + struct rpcrdma_mr *mr; +- unsigned int count; + +- count = 0; + spin_lock(&buf->rb_lock); + while ((mr = list_first_entry_or_null(&buf->rb_all_mrs, + struct rpcrdma_mr, + mr_all)) != NULL) { ++ list_del(&mr->mr_list); + list_del(&mr->mr_all); + spin_unlock(&buf->rb_lock); + + frwr_release_mr(mr); +- count++; + spin_lock(&buf->rb_lock); + } + spin_unlock(&buf->rb_lock); +@@ -1264,17 +1307,6 @@ void rpcrdma_mr_put(struct rpcrdma_mr *mr) + rpcrdma_mr_push(mr, &mr->mr_req->rl_free_mrs); + } + +-static void rpcrdma_mr_free(struct rpcrdma_mr *mr) +-{ +- struct rpcrdma_xprt *r_xprt = mr->mr_xprt; +- struct rpcrdma_buffer *buf = &r_xprt->rx_buf; +- +- mr->mr_req = NULL; +- spin_lock(&buf->rb_lock); +- rpcrdma_mr_push(mr, &buf->rb_mrs); +- spin_unlock(&buf->rb_lock); +-} +- + /** + * rpcrdma_buffer_get - Get a request buffer + * @buffers: Buffer pool from which to obtain a buffer +@@ -1455,8 +1487,13 @@ rpcrdma_ep_post(struct rpcrdma_ia *ia, + return 0; + } + +-static void +-rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp) ++/** ++ * rpcrdma_post_recvs - Refill the Receive Queue ++ * @r_xprt: controlling transport instance ++ * @temp: mark Receive buffers to be deleted after use ++ * ++ */ ++void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp) + { + struct rpcrdma_buffer *buf = &r_xprt->rx_buf; + struct rpcrdma_ep *ep = &r_xprt->rx_ep; +@@ -1478,6 +1515,10 @@ rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp) + wr = NULL; + while (needed) { + rep = rpcrdma_rep_get_locked(buf); ++ if (rep && rep->rr_temp) { ++ rpcrdma_rep_destroy(rep); ++ continue; ++ } + if (!rep) + rep = rpcrdma_rep_create(r_xprt, temp); + if (!rep) +diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h +index 65e6b0eb862e..fc761679487c 100644 +--- a/net/sunrpc/xprtrdma/xprt_rdma.h ++++ b/net/sunrpc/xprtrdma/xprt_rdma.h +@@ -203,6 +203,7 @@ struct rpcrdma_rep { + struct xdr_stream rr_stream; + struct llist_node rr_node; + struct ib_recv_wr rr_recv_wr; ++ struct list_head rr_all; + }; + + /* To reduce the rate at which a transport invokes ib_post_recv +@@ -372,6 +373,7 @@ struct rpcrdma_buffer { + + struct list_head rb_allreqs; + struct list_head rb_all_mrs; ++ struct list_head rb_all_reps; + + struct llist_head rb_free_reps; + +@@ -474,6 +476,7 @@ void rpcrdma_ep_disconnect(struct rpcrdma_ep *, struct rpcrdma_ia *); + + int rpcrdma_ep_post(struct rpcrdma_ia *, struct rpcrdma_ep *, + struct rpcrdma_req *); ++void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp); + + /* + * Buffer calls - xprtrdma/verbs.c +diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c +index 0d8da809bea2..b3369d678f1a 100644 +--- a/net/unix/af_unix.c ++++ b/net/unix/af_unix.c +@@ -646,6 +646,9 @@ static __poll_t unix_poll(struct file *, struct socket *, poll_table *); + static __poll_t unix_dgram_poll(struct file *, struct socket *, + poll_table *); + static int unix_ioctl(struct socket *, unsigned int, unsigned long); ++#ifdef CONFIG_COMPAT ++static int unix_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); ++#endif + static int unix_shutdown(struct socket *, int); + static int unix_stream_sendmsg(struct socket *, struct msghdr *, size_t); + static int unix_stream_recvmsg(struct socket *, struct msghdr *, size_t, int); +@@ -687,6 +690,9 @@ static const struct proto_ops unix_stream_ops = { + .getname = unix_getname, + .poll = unix_poll, + .ioctl = unix_ioctl, ++#ifdef CONFIG_COMPAT ++ .compat_ioctl = unix_compat_ioctl, ++#endif + .listen = unix_listen, + .shutdown = unix_shutdown, + .setsockopt = sock_no_setsockopt, +@@ -710,6 +716,9 @@ static const struct proto_ops unix_dgram_ops = { + .getname = unix_getname, + .poll = unix_dgram_poll, + .ioctl = unix_ioctl, ++#ifdef CONFIG_COMPAT ++ .compat_ioctl = unix_compat_ioctl, ++#endif + .listen = sock_no_listen, + .shutdown = unix_shutdown, + .setsockopt = sock_no_setsockopt, +@@ -732,6 +741,9 @@ static const struct proto_ops unix_seqpacket_ops = { + .getname = unix_getname, + .poll = unix_dgram_poll, + .ioctl = unix_ioctl, ++#ifdef CONFIG_COMPAT ++ .compat_ioctl = unix_compat_ioctl, ++#endif + .listen = unix_listen, + .shutdown = unix_shutdown, + .setsockopt = sock_no_setsockopt, +@@ -2582,6 +2594,13 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) + return err; + } + ++#ifdef CONFIG_COMPAT ++static int unix_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ++{ ++ return unix_ioctl(sock, cmd, (unsigned long)compat_ptr(arg)); ++} ++#endif ++ + static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wait) + { + struct sock *sk = sock->sk; +diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh +index 06495379fcd8..2998ddb323e3 100755 +--- a/scripts/link-vmlinux.sh ++++ b/scripts/link-vmlinux.sh +@@ -127,7 +127,8 @@ gen_btf() + cut -d, -f1 | cut -d' ' -f2) + bin_format=$(LANG=C ${OBJDUMP} -f ${1} | grep 'file format' | \ + awk '{print $4}') +- ${OBJCOPY} --dump-section .BTF=.btf.vmlinux.bin ${1} 2>/dev/null ++ ${OBJCOPY} --set-section-flags .BTF=alloc -O binary \ ++ --only-section=.BTF ${1} .btf.vmlinux.bin 2>/dev/null + ${OBJCOPY} -I binary -O ${bin_format} -B ${bin_arch} \ + --rename-section .data=.BTF .btf.vmlinux.bin ${2} + } +@@ -253,6 +254,10 @@ btf_vmlinux_bin_o="" + if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then + if gen_btf .tmp_vmlinux.btf .btf.vmlinux.bin.o ; then + btf_vmlinux_bin_o=.btf.vmlinux.bin.o ++ else ++ echo >&2 "Failed to generate BTF for vmlinux" ++ echo >&2 "Try to disable CONFIG_DEBUG_INFO_BTF" ++ exit 1 + fi + fi + +diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian +index 7c230016b08d..357dc56bcf30 100755 +--- a/scripts/package/mkdebian ++++ b/scripts/package/mkdebian +@@ -136,7 +136,7 @@ mkdir -p debian/source/ + echo "1.0" > debian/source/format + + echo $debarch > debian/arch +-extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev)" ++extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev:native)" + extra_build_depends="$extra_build_depends, $(if_enabled_echo CONFIG_SYSTEM_TRUSTED_KEYRING libssl-dev:native)" + + # Generate a simple changelog template +diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c +index dd3d5942e669..c36bafbcd77e 100644 +--- a/security/tomoyo/common.c ++++ b/security/tomoyo/common.c +@@ -951,7 +951,8 @@ static bool tomoyo_manager(void) + exe = tomoyo_get_exe(); + if (!exe) + return false; +- list_for_each_entry_rcu(ptr, &tomoyo_kernel_namespace.policy_list[TOMOYO_ID_MANAGER], head.list) { ++ list_for_each_entry_rcu(ptr, &tomoyo_kernel_namespace.policy_list[TOMOYO_ID_MANAGER], head.list, ++ srcu_read_lock_held(&tomoyo_ss)) { + if (!ptr->head.is_deleted && + (!tomoyo_pathcmp(domainname, ptr->manager) || + !strcmp(exe, ptr->manager->name))) { +@@ -1095,7 +1096,8 @@ static int tomoyo_delete_domain(char *domainname) + if (mutex_lock_interruptible(&tomoyo_policy_lock)) + return -EINTR; + /* Is there an active domain? */ +- list_for_each_entry_rcu(domain, &tomoyo_domain_list, list) { ++ list_for_each_entry_rcu(domain, &tomoyo_domain_list, list, ++ srcu_read_lock_held(&tomoyo_ss)) { + /* Never delete tomoyo_kernel_domain */ + if (domain == &tomoyo_kernel_domain) + continue; +@@ -2778,7 +2780,8 @@ void tomoyo_check_profile(void) + + tomoyo_policy_loaded = true; + pr_info("TOMOYO: 2.6.0\n"); +- list_for_each_entry_rcu(domain, &tomoyo_domain_list, list) { ++ list_for_each_entry_rcu(domain, &tomoyo_domain_list, list, ++ srcu_read_lock_held(&tomoyo_ss)) { + const u8 profile = domain->profile; + struct tomoyo_policy_namespace *ns = domain->ns; + +diff --git a/security/tomoyo/domain.c b/security/tomoyo/domain.c +index 8526a0a74023..7869d6a9980b 100644 +--- a/security/tomoyo/domain.c ++++ b/security/tomoyo/domain.c +@@ -41,7 +41,8 @@ int tomoyo_update_policy(struct tomoyo_acl_head *new_entry, const int size, + + if (mutex_lock_interruptible(&tomoyo_policy_lock)) + return -ENOMEM; +- list_for_each_entry_rcu(entry, list, list) { ++ list_for_each_entry_rcu(entry, list, list, ++ srcu_read_lock_held(&tomoyo_ss)) { + if (entry->is_deleted == TOMOYO_GC_IN_PROGRESS) + continue; + if (!check_duplicate(entry, new_entry)) +@@ -119,7 +120,8 @@ int tomoyo_update_domain(struct tomoyo_acl_info *new_entry, const int size, + } + if (mutex_lock_interruptible(&tomoyo_policy_lock)) + goto out; +- list_for_each_entry_rcu(entry, list, list) { ++ list_for_each_entry_rcu(entry, list, list, ++ srcu_read_lock_held(&tomoyo_ss)) { + if (entry->is_deleted == TOMOYO_GC_IN_PROGRESS) + continue; + if (!tomoyo_same_acl_head(entry, new_entry) || +@@ -166,7 +168,8 @@ void tomoyo_check_acl(struct tomoyo_request_info *r, + u16 i = 0; + + retry: +- list_for_each_entry_rcu(ptr, list, list) { ++ list_for_each_entry_rcu(ptr, list, list, ++ srcu_read_lock_held(&tomoyo_ss)) { + if (ptr->is_deleted || ptr->type != r->param_type) + continue; + if (!check_entry(r, ptr)) +@@ -298,7 +301,8 @@ static inline bool tomoyo_scan_transition + { + const struct tomoyo_transition_control *ptr; + +- list_for_each_entry_rcu(ptr, list, head.list) { ++ list_for_each_entry_rcu(ptr, list, head.list, ++ srcu_read_lock_held(&tomoyo_ss)) { + if (ptr->head.is_deleted || ptr->type != type) + continue; + if (ptr->domainname) { +@@ -735,7 +739,8 @@ retry: + + /* Check 'aggregator' directive. */ + candidate = &exename; +- list_for_each_entry_rcu(ptr, list, head.list) { ++ list_for_each_entry_rcu(ptr, list, head.list, ++ srcu_read_lock_held(&tomoyo_ss)) { + if (ptr->head.is_deleted || + !tomoyo_path_matches_pattern(&exename, + ptr->original_name)) +diff --git a/security/tomoyo/group.c b/security/tomoyo/group.c +index a37c7dc66e44..1cecdd797597 100644 +--- a/security/tomoyo/group.c ++++ b/security/tomoyo/group.c +@@ -133,7 +133,8 @@ tomoyo_path_matches_group(const struct tomoyo_path_info *pathname, + { + struct tomoyo_path_group *member; + +- list_for_each_entry_rcu(member, &group->member_list, head.list) { ++ list_for_each_entry_rcu(member, &group->member_list, head.list, ++ srcu_read_lock_held(&tomoyo_ss)) { + if (member->head.is_deleted) + continue; + if (!tomoyo_path_matches_pattern(pathname, member->member_name)) +@@ -161,7 +162,8 @@ bool tomoyo_number_matches_group(const unsigned long min, + struct tomoyo_number_group *member; + bool matched = false; + +- list_for_each_entry_rcu(member, &group->member_list, head.list) { ++ list_for_each_entry_rcu(member, &group->member_list, head.list, ++ srcu_read_lock_held(&tomoyo_ss)) { + if (member->head.is_deleted) + continue; + if (min > member->number.values[1] || +@@ -191,7 +193,8 @@ bool tomoyo_address_matches_group(const bool is_ipv6, const __be32 *address, + bool matched = false; + const u8 size = is_ipv6 ? 16 : 4; + +- list_for_each_entry_rcu(member, &group->member_list, head.list) { ++ list_for_each_entry_rcu(member, &group->member_list, head.list, ++ srcu_read_lock_held(&tomoyo_ss)) { + if (member->head.is_deleted) + continue; + if (member->address.is_ipv6 != is_ipv6) +diff --git a/security/tomoyo/util.c b/security/tomoyo/util.c +index 52752e1a84ed..eba0b3395851 100644 +--- a/security/tomoyo/util.c ++++ b/security/tomoyo/util.c +@@ -594,7 +594,8 @@ struct tomoyo_domain_info *tomoyo_find_domain(const char *domainname) + + name.name = domainname; + tomoyo_fill_path_info(&name); +- list_for_each_entry_rcu(domain, &tomoyo_domain_list, list) { ++ list_for_each_entry_rcu(domain, &tomoyo_domain_list, list, ++ srcu_read_lock_held(&tomoyo_ss)) { + if (!domain->is_deleted && + !tomoyo_pathcmp(&name, domain->domainname)) + return domain; +@@ -1028,7 +1029,8 @@ bool tomoyo_domain_quota_is_ok(struct tomoyo_request_info *r) + return false; + if (!domain) + return true; +- list_for_each_entry_rcu(ptr, &domain->acl_info_list, list) { ++ list_for_each_entry_rcu(ptr, &domain->acl_info_list, list, ++ srcu_read_lock_held(&tomoyo_ss)) { + u16 perm; + u8 i; + +diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c +index a78e4ab478df..c7a49d03463a 100644 +--- a/sound/soc/fsl/fsl_esai.c ++++ b/sound/soc/fsl/fsl_esai.c +@@ -33,6 +33,7 @@ + * @fsysclk: system clock source to derive HCK, SCK and FS + * @spbaclk: SPBA clock (optional, depending on SoC design) + * @task: tasklet to handle the reset operation ++ * @lock: spin lock between hw_reset() and trigger() + * @fifo_depth: depth of tx/rx FIFO + * @slot_width: width of each DAI slot + * @slots: number of slots +@@ -56,6 +57,7 @@ struct fsl_esai { + struct clk *fsysclk; + struct clk *spbaclk; + struct tasklet_struct task; ++ spinlock_t lock; /* Protect hw_reset and trigger */ + u32 fifo_depth; + u32 slot_width; + u32 slots; +@@ -676,8 +678,10 @@ static void fsl_esai_hw_reset(unsigned long arg) + { + struct fsl_esai *esai_priv = (struct fsl_esai *)arg; + bool tx = true, rx = false, enabled[2]; ++ unsigned long lock_flags; + u32 tfcr, rfcr; + ++ spin_lock_irqsave(&esai_priv->lock, lock_flags); + /* Save the registers */ + regmap_read(esai_priv->regmap, REG_ESAI_TFCR, &tfcr); + regmap_read(esai_priv->regmap, REG_ESAI_RFCR, &rfcr); +@@ -715,6 +719,8 @@ static void fsl_esai_hw_reset(unsigned long arg) + fsl_esai_trigger_start(esai_priv, tx); + if (enabled[rx]) + fsl_esai_trigger_start(esai_priv, rx); ++ ++ spin_unlock_irqrestore(&esai_priv->lock, lock_flags); + } + + static int fsl_esai_trigger(struct snd_pcm_substream *substream, int cmd, +@@ -722,6 +728,7 @@ static int fsl_esai_trigger(struct snd_pcm_substream *substream, int cmd, + { + struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai); + bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; ++ unsigned long lock_flags; + + esai_priv->channels[tx] = substream->runtime->channels; + +@@ -729,12 +736,16 @@ static int fsl_esai_trigger(struct snd_pcm_substream *substream, int cmd, + case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_RESUME: + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: ++ spin_lock_irqsave(&esai_priv->lock, lock_flags); + fsl_esai_trigger_start(esai_priv, tx); ++ spin_unlock_irqrestore(&esai_priv->lock, lock_flags); + break; + case SNDRV_PCM_TRIGGER_SUSPEND: + case SNDRV_PCM_TRIGGER_STOP: + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: ++ spin_lock_irqsave(&esai_priv->lock, lock_flags); + fsl_esai_trigger_stop(esai_priv, tx); ++ spin_unlock_irqrestore(&esai_priv->lock, lock_flags); + break; + default: + return -EINVAL; +@@ -1002,6 +1013,7 @@ static int fsl_esai_probe(struct platform_device *pdev) + + dev_set_drvdata(&pdev->dev, esai_priv); + ++ spin_lock_init(&esai_priv->lock); + ret = fsl_esai_hw_init(esai_priv); + if (ret) + return ret; +diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig +index 01c99750212a..ef493cae78ff 100644 +--- a/sound/soc/intel/Kconfig ++++ b/sound/soc/intel/Kconfig +@@ -59,6 +59,9 @@ config SND_SOC_INTEL_HASWELL + If you have a Intel Haswell or Broadwell platform connected to + an I2S codec, then enable this option by saying Y or m. This is + typically used for Chromebooks. This is a recommended option. ++ This option is mutually exclusive with the SOF support on ++ Broadwell. If you want to enable SOF on Broadwell, you need to ++ deselect this option first. + + config SND_SOC_INTEL_BAYTRAIL + tristate "Baytrail (legacy) Platforms" +diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c +index e9596c2096cd..a6c1cf987e6e 100644 +--- a/sound/soc/sh/rcar/core.c ++++ b/sound/soc/sh/rcar/core.c +@@ -376,6 +376,17 @@ u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io) + */ + u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io) + { ++ static const u32 dalign_values[8][2] = { ++ {0x76543210, 0x67452301}, ++ {0x00000032, 0x00000023}, ++ {0x00007654, 0x00006745}, ++ {0x00000076, 0x00000067}, ++ {0xfedcba98, 0xefcdab89}, ++ {0x000000ba, 0x000000ab}, ++ {0x0000fedc, 0x0000efcd}, ++ {0x000000fe, 0x000000ef}, ++ }; ++ int id = 0, inv; + struct rsnd_mod *ssiu = rsnd_io_to_mod_ssiu(io); + struct rsnd_mod *target; + struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); +@@ -411,13 +422,18 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io) + target = cmd ? cmd : ssiu; + } + ++ if (mod == ssiu) ++ id = rsnd_mod_id_sub(mod); ++ + /* Non target mod or non 16bit needs normal DALIGN */ + if ((snd_pcm_format_width(runtime->format) != 16) || + (mod != target)) +- return 0x76543210; ++ inv = 0; + /* Target mod needs inverted DALIGN when 16bit */ + else +- return 0x67452301; ++ inv = 1; ++ ++ return dalign_values[id][inv]; + } + + u32 rsnd_get_busif_shift(struct rsnd_dai_stream *io, struct rsnd_mod *mod) +diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c +index 88978a3036c4..9d3b546bae7b 100644 +--- a/sound/soc/soc-core.c ++++ b/sound/soc/soc-core.c +@@ -1886,6 +1886,8 @@ match: + + /* convert non BE into BE */ + dai_link->no_pcm = 1; ++ dai_link->dpcm_playback = 1; ++ dai_link->dpcm_capture = 1; + + /* override any BE fixups */ + dai_link->be_hw_params_fixup = +diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c +index a6e96cf1d8ff..d07026a846b9 100644 +--- a/sound/soc/soc-pcm.c ++++ b/sound/soc/soc-pcm.c +@@ -1148,7 +1148,9 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, + { + struct snd_soc_dpcm *dpcm; + unsigned long flags; ++#ifdef CONFIG_DEBUG_FS + char *name; ++#endif + + /* only add new dpcms */ + for_each_dpcm_be(fe, stream, dpcm) { +diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c +index 2a22b18e5ec0..69785f688ddf 100644 +--- a/sound/soc/sof/imx/imx8.c ++++ b/sound/soc/sof/imx/imx8.c +@@ -209,7 +209,7 @@ static int imx8_probe(struct snd_sof_dev *sdev) + + priv->pd_dev = devm_kmalloc_array(&pdev->dev, priv->num_domains, + sizeof(*priv->pd_dev), GFP_KERNEL); +- if (!priv) ++ if (!priv->pd_dev) + return -ENOMEM; + + priv->link = devm_kmalloc_array(&pdev->dev, priv->num_domains, +@@ -304,6 +304,9 @@ static int imx8_probe(struct snd_sof_dev *sdev) + } + sdev->mailbox_bar = SOF_FW_BLK_TYPE_SRAM; + ++ /* set default mailbox offset for FW ready message */ ++ sdev->dsp_box.offset = MBOX_OFFSET; ++ + return 0; + + exit_pdev_unregister: +diff --git a/sound/soc/sof/intel/Kconfig b/sound/soc/sof/intel/Kconfig +index d62f51d33be1..8421b97d949e 100644 +--- a/sound/soc/sof/intel/Kconfig ++++ b/sound/soc/sof/intel/Kconfig +@@ -76,10 +76,18 @@ config SND_SOC_SOF_BAYTRAIL + + config SND_SOC_SOF_BROADWELL_SUPPORT + bool "SOF support for Broadwell" ++ depends on SND_SOC_INTEL_HASWELL=n + help + This adds support for Sound Open Firmware for Intel(R) platforms + using the Broadwell processors. +- Say Y if you have such a device. ++ This option is mutually exclusive with the Haswell/Broadwell legacy ++ driver. If you want to enable SOF on Broadwell you need to deselect ++ the legacy driver first. ++ SOF does fully support Broadwell yet, so this option is not ++ recommended for distros. At some point all legacy drivers will be ++ deprecated but not before all userspace firmware/topology/UCM files ++ are made available to downstream distros. ++ Say Y if you want to enable SOF on Broadwell + If unsure select "N". + + config SND_SOC_SOF_BROADWELL +diff --git a/sound/soc/stm/stm32_spdifrx.c b/sound/soc/stm/stm32_spdifrx.c +index cd4b235fce57..e53fb4bd66b3 100644 +--- a/sound/soc/stm/stm32_spdifrx.c ++++ b/sound/soc/stm/stm32_spdifrx.c +@@ -12,7 +12,6 @@ + #include + #include + #include +-#include + #include + #include + +@@ -220,6 +219,7 @@ + * @slave_config: dma slave channel runtime config pointer + * @phys_addr: SPDIFRX registers physical base address + * @lock: synchronization enabling lock ++ * @irq_lock: prevent race condition with IRQ on stream state + * @cs: channel status buffer + * @ub: user data buffer + * @irq: SPDIFRX interrupt line +@@ -240,6 +240,7 @@ struct stm32_spdifrx_data { + struct dma_slave_config slave_config; + dma_addr_t phys_addr; + spinlock_t lock; /* Sync enabling lock */ ++ spinlock_t irq_lock; /* Prevent race condition on stream state */ + unsigned char cs[SPDIFRX_CS_BYTES_NB]; + unsigned char ub[SPDIFRX_UB_BYTES_NB]; + int irq; +@@ -320,6 +321,7 @@ static void stm32_spdifrx_dma_ctrl_stop(struct stm32_spdifrx_data *spdifrx) + static int stm32_spdifrx_start_sync(struct stm32_spdifrx_data *spdifrx) + { + int cr, cr_mask, imr, ret; ++ unsigned long flags; + + /* Enable IRQs */ + imr = SPDIFRX_IMR_IFEIE | SPDIFRX_IMR_SYNCDIE | SPDIFRX_IMR_PERRIE; +@@ -327,7 +329,7 @@ static int stm32_spdifrx_start_sync(struct stm32_spdifrx_data *spdifrx) + if (ret) + return ret; + +- spin_lock(&spdifrx->lock); ++ spin_lock_irqsave(&spdifrx->lock, flags); + + spdifrx->refcount++; + +@@ -360,7 +362,7 @@ static int stm32_spdifrx_start_sync(struct stm32_spdifrx_data *spdifrx) + "Failed to start synchronization\n"); + } + +- spin_unlock(&spdifrx->lock); ++ spin_unlock_irqrestore(&spdifrx->lock, flags); + + return ret; + } +@@ -368,11 +370,12 @@ static int stm32_spdifrx_start_sync(struct stm32_spdifrx_data *spdifrx) + static void stm32_spdifrx_stop(struct stm32_spdifrx_data *spdifrx) + { + int cr, cr_mask, reg; ++ unsigned long flags; + +- spin_lock(&spdifrx->lock); ++ spin_lock_irqsave(&spdifrx->lock, flags); + + if (--spdifrx->refcount) { +- spin_unlock(&spdifrx->lock); ++ spin_unlock_irqrestore(&spdifrx->lock, flags); + return; + } + +@@ -391,7 +394,7 @@ static void stm32_spdifrx_stop(struct stm32_spdifrx_data *spdifrx) + regmap_read(spdifrx->regmap, STM32_SPDIFRX_DR, ®); + regmap_read(spdifrx->regmap, STM32_SPDIFRX_CSR, ®); + +- spin_unlock(&spdifrx->lock); ++ spin_unlock_irqrestore(&spdifrx->lock, flags); + } + + static int stm32_spdifrx_dma_ctrl_register(struct device *dev, +@@ -478,8 +481,6 @@ static int stm32_spdifrx_get_ctrl_data(struct stm32_spdifrx_data *spdifrx) + memset(spdifrx->cs, 0, SPDIFRX_CS_BYTES_NB); + memset(spdifrx->ub, 0, SPDIFRX_UB_BYTES_NB); + +- pinctrl_pm_select_default_state(&spdifrx->pdev->dev); +- + ret = stm32_spdifrx_dma_ctrl_start(spdifrx); + if (ret < 0) + return ret; +@@ -511,7 +512,6 @@ static int stm32_spdifrx_get_ctrl_data(struct stm32_spdifrx_data *spdifrx) + + end: + clk_disable_unprepare(spdifrx->kclk); +- pinctrl_pm_select_sleep_state(&spdifrx->pdev->dev); + + return ret; + } +@@ -663,7 +663,6 @@ static const struct regmap_config stm32_h7_spdifrx_regmap_conf = { + static irqreturn_t stm32_spdifrx_isr(int irq, void *devid) + { + struct stm32_spdifrx_data *spdifrx = (struct stm32_spdifrx_data *)devid; +- struct snd_pcm_substream *substream = spdifrx->substream; + struct platform_device *pdev = spdifrx->pdev; + unsigned int cr, mask, sr, imr; + unsigned int flags; +@@ -731,14 +730,19 @@ static irqreturn_t stm32_spdifrx_isr(int irq, void *devid) + regmap_update_bits(spdifrx->regmap, STM32_SPDIFRX_CR, + SPDIFRX_CR_SPDIFEN_MASK, cr); + +- if (substream) +- snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED); ++ spin_lock(&spdifrx->irq_lock); ++ if (spdifrx->substream) ++ snd_pcm_stop(spdifrx->substream, ++ SNDRV_PCM_STATE_DISCONNECTED); ++ spin_unlock(&spdifrx->irq_lock); + + return IRQ_HANDLED; + } + +- if (err_xrun && substream) +- snd_pcm_stop_xrun(substream); ++ spin_lock(&spdifrx->irq_lock); ++ if (err_xrun && spdifrx->substream) ++ snd_pcm_stop_xrun(spdifrx->substream); ++ spin_unlock(&spdifrx->irq_lock); + + return IRQ_HANDLED; + } +@@ -747,9 +751,12 @@ static int stm32_spdifrx_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *cpu_dai) + { + struct stm32_spdifrx_data *spdifrx = snd_soc_dai_get_drvdata(cpu_dai); ++ unsigned long flags; + int ret; + ++ spin_lock_irqsave(&spdifrx->irq_lock, flags); + spdifrx->substream = substream; ++ spin_unlock_irqrestore(&spdifrx->irq_lock, flags); + + ret = clk_prepare_enable(spdifrx->kclk); + if (ret) +@@ -825,8 +832,12 @@ static void stm32_spdifrx_shutdown(struct snd_pcm_substream *substream, + struct snd_soc_dai *cpu_dai) + { + struct stm32_spdifrx_data *spdifrx = snd_soc_dai_get_drvdata(cpu_dai); ++ unsigned long flags; + ++ spin_lock_irqsave(&spdifrx->irq_lock, flags); + spdifrx->substream = NULL; ++ spin_unlock_irqrestore(&spdifrx->irq_lock, flags); ++ + clk_disable_unprepare(spdifrx->kclk); + } + +@@ -930,6 +941,7 @@ static int stm32_spdifrx_probe(struct platform_device *pdev) + spdifrx->pdev = pdev; + init_completion(&spdifrx->cs_completion); + spin_lock_init(&spdifrx->lock); ++ spin_lock_init(&spdifrx->irq_lock); + + platform_set_drvdata(pdev, spdifrx); + +diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile +index 56ce6292071b..33e2638ef7f0 100644 +--- a/tools/lib/bpf/Makefile ++++ b/tools/lib/bpf/Makefile +@@ -215,7 +215,7 @@ check_abi: $(OUTPUT)libbpf.so + "versioned symbols in $^ ($(VERSIONED_SYM_COUNT))." \ + "Please make sure all LIBBPF_API symbols are" \ + "versioned in $(VERSION_SCRIPT)." >&2; \ +- readelf -s --wide $(OUTPUT)libbpf-in.o | \ ++ readelf -s --wide $(BPF_IN_SHARED) | \ + cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \ + awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$8}'| \ + sort -u > $(OUTPUT)libbpf_global_syms.tmp; \ +diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c +index cb1e51fcc84e..32b7c6f9043d 100644 +--- a/tools/pci/pcitest.c ++++ b/tools/pci/pcitest.c +@@ -129,6 +129,7 @@ static int run_test(struct pci_test *test) + } + + fflush(stdout); ++ close(fd); + return (ret < 0) ? ret : 1 - ret; /* return 0 if test succeeded */ + } + +diff --git a/tools/perf/pmu-events/arch/s390/cf_z14/extended.json b/tools/perf/pmu-events/arch/s390/cf_z14/extended.json +index 68618152ea2c..89e070727e1b 100644 +--- a/tools/perf/pmu-events/arch/s390/cf_z14/extended.json ++++ b/tools/perf/pmu-events/arch/s390/cf_z14/extended.json +@@ -4,7 +4,7 @@ + "EventCode": "128", + "EventName": "L1D_RO_EXCL_WRITES", + "BriefDescription": "L1D Read-only Exclusive Writes", +- "PublicDescription": "L1D_RO_EXCL_WRITES A directory write to the Level-1 Data cache where the line was originally in a Read-Only state in the cache but has been updated to be in the Exclusive state that allows stores to the cache line" ++ "PublicDescription": "A directory write to the Level-1 Data cache where the line was originally in a Read-Only state in the cache but has been updated to be in the Exclusive state that allows stores to the cache line" + }, + { + "Unit": "CPU-M-CF", +diff --git a/tools/testing/selftests/firmware/fw_lib.sh b/tools/testing/selftests/firmware/fw_lib.sh +index b879305a766d..5b8c0fedee76 100755 +--- a/tools/testing/selftests/firmware/fw_lib.sh ++++ b/tools/testing/selftests/firmware/fw_lib.sh +@@ -34,6 +34,12 @@ test_modprobe() + + check_mods() + { ++ local uid=$(id -u) ++ if [ $uid -ne 0 ]; then ++ echo "skip all tests: must be run as root" >&2 ++ exit $ksft_skip ++ fi ++ + trap "test_modprobe" EXIT + if [ ! -d $DIR ]; then + modprobe test_firmware +diff --git a/tools/testing/selftests/net/forwarding/loopback.sh b/tools/testing/selftests/net/forwarding/loopback.sh +index 6e4626ae71b0..8f4057310b5b 100755 +--- a/tools/testing/selftests/net/forwarding/loopback.sh ++++ b/tools/testing/selftests/net/forwarding/loopback.sh +@@ -1,6 +1,9 @@ + #!/bin/bash + # SPDX-License-Identifier: GPL-2.0 + ++# Kselftest framework requirement - SKIP code is 4. ++ksft_skip=4 ++ + ALL_TESTS="loopback_test" + NUM_NETIFS=2 + source tc_common.sh +@@ -72,6 +75,11 @@ setup_prepare() + + h1_create + h2_create ++ ++ if ethtool -k $h1 | grep loopback | grep -q fixed; then ++ log_test "SKIP: dev $h1 does not support loopback feature" ++ exit $ksft_skip ++ fi + } + + cleanup() +diff --git a/tools/testing/selftests/rseq/settings b/tools/testing/selftests/rseq/settings +new file mode 100644 +index 000000000000..e7b9417537fb +--- /dev/null ++++ b/tools/testing/selftests/rseq/settings +@@ -0,0 +1 @@ ++timeout=0 diff --git a/patch/kernel/odroidxu4-current/03-patch-5.4.13-14.patch b/patch/kernel/odroidxu4-current/03-patch-5.4.13-14.patch new file mode 100644 index 000000000..beb51d5c9 --- /dev/null +++ b/patch/kernel/odroidxu4-current/03-patch-5.4.13-14.patch @@ -0,0 +1,8137 @@ +diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml +index 4845e29411e4..e08cd4c4d568 100644 +--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml ++++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml +@@ -347,6 +347,7 @@ allOf: + - st,spear600-gmac + + then: ++ properties: + snps,tso: + $ref: /schemas/types.yaml#definitions/flag + description: +diff --git a/Makefile b/Makefile +index d4cf4700ae3f..2b2080d08bb2 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 13 ++SUBLEVEL = 14 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/arch/arm/boot/dts/am571x-idk.dts b/arch/arm/boot/dts/am571x-idk.dts +index 0aaacea1d887..9d6a872c2b23 100644 +--- a/arch/arm/boot/dts/am571x-idk.dts ++++ b/arch/arm/boot/dts/am571x-idk.dts +@@ -167,7 +167,7 @@ + + &pcie1_rc { + status = "okay"; +- gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; ++ gpios = <&gpio5 18 GPIO_ACTIVE_HIGH>; + }; + + &pcie1_ep { +diff --git a/arch/arm/boot/dts/dra7-l4.dtsi b/arch/arm/boot/dts/dra7-l4.dtsi +index 5cac2dd58241..c3954e34835b 100644 +--- a/arch/arm/boot/dts/dra7-l4.dtsi ++++ b/arch/arm/boot/dts/dra7-l4.dtsi +@@ -3059,7 +3059,7 @@ + + davinci_mdio: mdio@1000 { + compatible = "ti,cpsw-mdio","ti,davinci_mdio"; +- clocks = <&gmac_clkctrl DRA7_GMAC_GMAC_CLKCTRL 0>; ++ clocks = <&gmac_main_clk>; + clock-names = "fck"; + #address-cells = <1>; + #size-cells = <0>; +diff --git a/arch/arm/boot/dts/imx6dl-icore-mipi.dts b/arch/arm/boot/dts/imx6dl-icore-mipi.dts +index e43bccb78ab2..d8f3821a0ffd 100644 +--- a/arch/arm/boot/dts/imx6dl-icore-mipi.dts ++++ b/arch/arm/boot/dts/imx6dl-icore-mipi.dts +@@ -8,7 +8,7 @@ + /dts-v1/; + + #include "imx6dl.dtsi" +-#include "imx6qdl-icore.dtsi" ++#include "imx6qdl-icore-1.5.dtsi" + + / { + model = "Engicam i.CoreM6 DualLite/Solo MIPI Starter Kit"; +diff --git a/arch/arm/boot/dts/imx6q-dhcom-pdk2.dts b/arch/arm/boot/dts/imx6q-dhcom-pdk2.dts +index 9c61e3be2d9a..1c46df6827f5 100644 +--- a/arch/arm/boot/dts/imx6q-dhcom-pdk2.dts ++++ b/arch/arm/boot/dts/imx6q-dhcom-pdk2.dts +@@ -55,7 +55,7 @@ + #sound-dai-cells = <0>; + clocks = <&clk_ext_audio_codec>; + VDDA-supply = <®_3p3v>; +- VDDIO-supply = <®_3p3v>; ++ VDDIO-supply = <&sw2_reg>; + }; + }; + +diff --git a/arch/arm/boot/dts/imx6q-dhcom-som.dtsi b/arch/arm/boot/dts/imx6q-dhcom-som.dtsi +index 387801dde02e..08a2e17e0539 100644 +--- a/arch/arm/boot/dts/imx6q-dhcom-som.dtsi ++++ b/arch/arm/boot/dts/imx6q-dhcom-som.dtsi +@@ -206,7 +206,7 @@ + }; + + rtc@56 { +- compatible = "rv3029c2"; ++ compatible = "microcrystal,rv3029"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_rtc_hw300>; + reg = <0x56>; +diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi +index 71ca76a5e4a5..fe59dde41b64 100644 +--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi ++++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi +@@ -749,10 +749,6 @@ + vin-supply = <&vgen5_reg>; + }; + +-®_vdd3p0 { +- vin-supply = <&sw2_reg>; +-}; +- + ®_vdd2p5 { + vin-supply = <&vgen5_reg>; + }; +diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts +index 4829aa682aeb..bc86cfaaa9c2 100644 +--- a/arch/arm/boot/dts/imx6sl-evk.dts ++++ b/arch/arm/boot/dts/imx6sl-evk.dts +@@ -584,10 +584,6 @@ + vin-supply = <&sw2_reg>; + }; + +-®_vdd3p0 { +- vin-supply = <&sw2_reg>; +-}; +- + ®_vdd2p5 { + vin-supply = <&sw2_reg>; + }; +diff --git a/arch/arm/boot/dts/imx6sll-evk.dts b/arch/arm/boot/dts/imx6sll-evk.dts +index 3e1d32fdf4b8..5ace9e6acf85 100644 +--- a/arch/arm/boot/dts/imx6sll-evk.dts ++++ b/arch/arm/boot/dts/imx6sll-evk.dts +@@ -265,10 +265,6 @@ + status = "okay"; + }; + +-®_3p0 { +- vin-supply = <&sw2_reg>; +-}; +- + &snvs_poweroff { + status = "okay"; + }; +diff --git a/arch/arm/boot/dts/imx6sx-sdb-reva.dts b/arch/arm/boot/dts/imx6sx-sdb-reva.dts +index f1830ed387a5..91a7548fdb8d 100644 +--- a/arch/arm/boot/dts/imx6sx-sdb-reva.dts ++++ b/arch/arm/boot/dts/imx6sx-sdb-reva.dts +@@ -159,10 +159,6 @@ + vin-supply = <&vgen6_reg>; + }; + +-®_vdd3p0 { +- vin-supply = <&sw2_reg>; +-}; +- + ®_vdd2p5 { + vin-supply = <&vgen6_reg>; + }; +diff --git a/arch/arm/boot/dts/imx6sx-sdb.dts b/arch/arm/boot/dts/imx6sx-sdb.dts +index a8ee7087af5a..5a63ca615722 100644 +--- a/arch/arm/boot/dts/imx6sx-sdb.dts ++++ b/arch/arm/boot/dts/imx6sx-sdb.dts +@@ -141,10 +141,6 @@ + vin-supply = <&vgen6_reg>; + }; + +-®_vdd3p0 { +- vin-supply = <&sw2_reg>; +-}; +- + ®_vdd2p5 { + vin-supply = <&vgen6_reg>; + }; +diff --git a/arch/arm/boot/dts/imx6ul-kontron-n6310-s.dts b/arch/arm/boot/dts/imx6ul-kontron-n6310-s.dts +index 0205fd56d975..4e99e6c79a68 100644 +--- a/arch/arm/boot/dts/imx6ul-kontron-n6310-s.dts ++++ b/arch/arm/boot/dts/imx6ul-kontron-n6310-s.dts +@@ -157,10 +157,6 @@ + status = "okay"; + }; + +-&snvs_poweroff { +- status = "okay"; +-}; +- + &uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart1>; +diff --git a/arch/arm/boot/dts/imx7s-colibri.dtsi b/arch/arm/boot/dts/imx7s-colibri.dtsi +index 1fb1ec5d3d70..6d16e32aed89 100644 +--- a/arch/arm/boot/dts/imx7s-colibri.dtsi ++++ b/arch/arm/boot/dts/imx7s-colibri.dtsi +@@ -49,3 +49,7 @@ + reg = <0x80000000 0x10000000>; + }; + }; ++ ++&gpmi { ++ status = "okay"; ++}; +diff --git a/arch/arm/boot/dts/imx7ulp.dtsi b/arch/arm/boot/dts/imx7ulp.dtsi +index 6859a3a83750..3dac6898cdc5 100644 +--- a/arch/arm/boot/dts/imx7ulp.dtsi ++++ b/arch/arm/boot/dts/imx7ulp.dtsi +@@ -37,10 +37,10 @@ + #address-cells = <1>; + #size-cells = <0>; + +- cpu0: cpu@0 { ++ cpu0: cpu@f00 { + compatible = "arm,cortex-a7"; + device_type = "cpu"; +- reg = <0>; ++ reg = <0xf00>; + }; + }; + +diff --git a/arch/arm/boot/dts/meson8.dtsi b/arch/arm/boot/dts/meson8.dtsi +index 5a7e3e5caebe..3c534cd50ee3 100644 +--- a/arch/arm/boot/dts/meson8.dtsi ++++ b/arch/arm/boot/dts/meson8.dtsi +@@ -253,7 +253,7 @@ + &aobus { + pmu: pmu@e0 { + compatible = "amlogic,meson8-pmu", "syscon"; +- reg = <0xe0 0x8>; ++ reg = <0xe0 0x18>; + }; + + pinctrl_aobus: pinctrl@84 { +diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi +index 7cc95bc1598b..e5506ab669fc 100644 +--- a/arch/arm/boot/dts/omap4.dtsi ++++ b/arch/arm/boot/dts/omap4.dtsi +@@ -330,8 +330,8 @@ + + target-module@56000000 { + compatible = "ti,sysc-omap4", "ti,sysc"; +- reg = <0x5601fc00 0x4>, +- <0x5601fc10 0x4>; ++ reg = <0x5600fe00 0x4>, ++ <0x5600fe10 0x4>; + reg-names = "rev", "sysc"; + ti,sysc-midle = , + , +diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig +index dd427bd2768c..02b180ad7245 100644 +--- a/arch/arm/mach-davinci/Kconfig ++++ b/arch/arm/mach-davinci/Kconfig +@@ -9,6 +9,7 @@ menuconfig ARCH_DAVINCI + select PM_GENERIC_DOMAINS if PM + select PM_GENERIC_DOMAINS_OF if PM && OF + select REGMAP_MMIO ++ select RESET_CONTROLLER + select HAVE_IDE + select PINCTRL_SINGLE + +diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c +index 1b7cf81ff035..33688e1d9acf 100644 +--- a/arch/arm/mach-omap2/pdata-quirks.c ++++ b/arch/arm/mach-omap2/pdata-quirks.c +@@ -368,10 +368,14 @@ static void __init dra7x_evm_mmc_quirk(void) + + static struct clockdomain *ti_sysc_find_one_clockdomain(struct clk *clk) + { ++ struct clk_hw *hw = __clk_get_hw(clk); + struct clockdomain *clkdm = NULL; + struct clk_hw_omap *hwclk; + +- hwclk = to_clk_hw_omap(__clk_get_hw(clk)); ++ hwclk = to_clk_hw_omap(hw); ++ if (!omap2_clk_is_hw_omap(hw)) ++ return NULL; ++ + if (hwclk && hwclk->clkdm_name) + clkdm = clkdm_lookup(hwclk->clkdm_name); + +diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino-emmc.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino-emmc.dts +index 96ab0227e82d..121e6cc4849b 100644 +--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino-emmc.dts ++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino-emmc.dts +@@ -15,7 +15,7 @@ + pinctrl-names = "default"; + pinctrl-0 = <&mmc2_pins>; + vmmc-supply = <®_dcdc1>; +- vqmmc-supply = <®_dcdc1>; ++ vqmmc-supply = <®_eldo1>; + bus-width = <8>; + non-removable; + cap-mmc-hw-reset; +diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts +index 01a9a52edae4..393c1948a495 100644 +--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts ++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts +@@ -140,7 +140,7 @@ + &mmc1 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc1_pins>; +- vmmc-supply = <®_aldo2>; ++ vmmc-supply = <®_dcdc1>; + vqmmc-supply = <®_dldo4>; + mmc-pwrseq = <&wifi_pwrseq>; + bus-width = <4>; +diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +index 70f4cce6be43..ba41c1b85887 100644 +--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi ++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +@@ -142,6 +142,15 @@ + clock-output-names = "ext-osc32k"; + }; + ++ pmu { ++ compatible = "arm,cortex-a53-pmu"; ++ interrupts = , ++ , ++ , ++ ; ++ interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>; ++ }; ++ + psci { + compatible = "arm,psci-0.2"; + method = "smc"; +diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +index 144a2c19ac02..d1fc9c2055f4 100644 +--- a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi ++++ b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +@@ -61,10 +61,10 @@ + + pmu { + compatible = "arm,armv8-pmuv3"; +- interrupts = <0 120 8>, +- <0 121 8>, +- <0 122 8>, +- <0 123 8>; ++ interrupts = <0 170 4>, ++ <0 171 4>, ++ <0 172 4>, ++ <0 173 4>; + interrupt-affinity = <&cpu0>, + <&cpu1>, + <&cpu2>, +diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi +index 82919b106010..bb4a2acb9970 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi +@@ -1162,7 +1162,7 @@ + + toddr_a: audio-controller@100 { + compatible = "amlogic,axg-toddr"; +- reg = <0x0 0x100 0x0 0x1c>; ++ reg = <0x0 0x100 0x0 0x2c>; + #sound-dai-cells = <0>; + sound-name-prefix = "TODDR_A"; + interrupts = ; +@@ -1173,7 +1173,7 @@ + + toddr_b: audio-controller@140 { + compatible = "amlogic,axg-toddr"; +- reg = <0x0 0x140 0x0 0x1c>; ++ reg = <0x0 0x140 0x0 0x2c>; + #sound-dai-cells = <0>; + sound-name-prefix = "TODDR_B"; + interrupts = ; +@@ -1184,7 +1184,7 @@ + + toddr_c: audio-controller@180 { + compatible = "amlogic,axg-toddr"; +- reg = <0x0 0x180 0x0 0x1c>; ++ reg = <0x0 0x180 0x0 0x2c>; + #sound-dai-cells = <0>; + sound-name-prefix = "TODDR_C"; + interrupts = ; +@@ -1195,7 +1195,7 @@ + + frddr_a: audio-controller@1c0 { + compatible = "amlogic,axg-frddr"; +- reg = <0x0 0x1c0 0x0 0x1c>; ++ reg = <0x0 0x1c0 0x0 0x2c>; + #sound-dai-cells = <0>; + sound-name-prefix = "FRDDR_A"; + interrupts = ; +@@ -1206,7 +1206,7 @@ + + frddr_b: audio-controller@200 { + compatible = "amlogic,axg-frddr"; +- reg = <0x0 0x200 0x0 0x1c>; ++ reg = <0x0 0x200 0x0 0x2c>; + #sound-dai-cells = <0>; + sound-name-prefix = "FRDDR_B"; + interrupts = ; +@@ -1217,7 +1217,7 @@ + + frddr_c: audio-controller@240 { + compatible = "amlogic,axg-frddr"; +- reg = <0x0 0x240 0x0 0x1c>; ++ reg = <0x0 0x240 0x0 0x2c>; + #sound-dai-cells = <0>; + sound-name-prefix = "FRDDR_C"; + interrupts = ; +diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +index 3f39e020f74e..0ee8a369c547 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi ++++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +@@ -1509,7 +1509,7 @@ + toddr_a: audio-controller@100 { + compatible = "amlogic,g12a-toddr", + "amlogic,axg-toddr"; +- reg = <0x0 0x100 0x0 0x1c>; ++ reg = <0x0 0x100 0x0 0x2c>; + #sound-dai-cells = <0>; + sound-name-prefix = "TODDR_A"; + interrupts = ; +@@ -1521,7 +1521,7 @@ + toddr_b: audio-controller@140 { + compatible = "amlogic,g12a-toddr", + "amlogic,axg-toddr"; +- reg = <0x0 0x140 0x0 0x1c>; ++ reg = <0x0 0x140 0x0 0x2c>; + #sound-dai-cells = <0>; + sound-name-prefix = "TODDR_B"; + interrupts = ; +@@ -1533,7 +1533,7 @@ + toddr_c: audio-controller@180 { + compatible = "amlogic,g12a-toddr", + "amlogic,axg-toddr"; +- reg = <0x0 0x180 0x0 0x1c>; ++ reg = <0x0 0x180 0x0 0x2c>; + #sound-dai-cells = <0>; + sound-name-prefix = "TODDR_C"; + interrupts = ; +@@ -1545,7 +1545,7 @@ + frddr_a: audio-controller@1c0 { + compatible = "amlogic,g12a-frddr", + "amlogic,axg-frddr"; +- reg = <0x0 0x1c0 0x0 0x1c>; ++ reg = <0x0 0x1c0 0x0 0x2c>; + #sound-dai-cells = <0>; + sound-name-prefix = "FRDDR_A"; + interrupts = ; +@@ -1557,7 +1557,7 @@ + frddr_b: audio-controller@200 { + compatible = "amlogic,g12a-frddr", + "amlogic,axg-frddr"; +- reg = <0x0 0x200 0x0 0x1c>; ++ reg = <0x0 0x200 0x0 0x2c>; + #sound-dai-cells = <0>; + sound-name-prefix = "FRDDR_B"; + interrupts = ; +@@ -1569,7 +1569,7 @@ + frddr_c: audio-controller@240 { + compatible = "amlogic,g12a-frddr", + "amlogic,axg-frddr"; +- reg = <0x0 0x240 0x0 0x1c>; ++ reg = <0x0 0x240 0x0 0x2c>; + #sound-dai-cells = <0>; + sound-name-prefix = "FRDDR_C"; + interrupts = ; +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts +index 8d6f316a5c7b..440bc23c7342 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts +@@ -33,11 +33,9 @@ + + gpio-keys-polled { + compatible = "gpio-keys-polled"; +- #address-cells = <1>; +- #size-cells = <0>; + poll-interval = <100>; + +- button@0 { ++ power-button { + label = "power"; + linux,code = ; + gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>; +diff --git a/arch/arm64/boot/dts/arm/juno-base.dtsi b/arch/arm64/boot/dts/arm/juno-base.dtsi +index 26a039a028b8..8c11660bbe40 100644 +--- a/arch/arm64/boot/dts/arm/juno-base.dtsi ++++ b/arch/arm64/boot/dts/arm/juno-base.dtsi +@@ -6,7 +6,6 @@ + /* + * Devices shared by all Juno boards + */ +- dma-ranges = <0 0 0 0 0x100 0>; + + memtimer: timer@2a810000 { + compatible = "arm,armv7-timer-mem"; +diff --git a/arch/arm64/boot/dts/arm/juno-clocks.dtsi b/arch/arm64/boot/dts/arm/juno-clocks.dtsi +index e5e265dfa902..2870b5eeb198 100644 +--- a/arch/arm64/boot/dts/arm/juno-clocks.dtsi ++++ b/arch/arm64/boot/dts/arm/juno-clocks.dtsi +@@ -8,10 +8,10 @@ + */ + / { + /* SoC fixed clocks */ +- soc_uartclk: refclk7273800hz { ++ soc_uartclk: refclk7372800hz { + compatible = "fixed-clock"; + #clock-cells = <0>; +- clock-frequency = <7273800>; ++ clock-frequency = <7372800>; + clock-output-names = "juno:uartclk"; + }; + +diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +index bb960fe2bb64..9589b15693d6 100644 +--- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi ++++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +@@ -158,7 +158,7 @@ + dcfg: syscon@1e00000 { + compatible = "fsl,ls1028a-dcfg", "syscon"; + reg = <0x0 0x1e00000 0x0 0x10000>; +- big-endian; ++ little-endian; + }; + + rst: syscon@1e60000 { +diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts +index f7a15f3904c2..13137451b438 100644 +--- a/arch/arm64/boot/dts/freescale/imx8mm-evk.dts ++++ b/arch/arm64/boot/dts/freescale/imx8mm-evk.dts +@@ -62,6 +62,8 @@ + + cpudai: simple-audio-card,cpu { + sound-dai = <&sai3>; ++ dai-tdm-slot-num = <2>; ++ dai-tdm-slot-width = <32>; + }; + + simple-audio-card,codec { +diff --git a/arch/arm64/boot/dts/freescale/imx8mm.dtsi b/arch/arm64/boot/dts/freescale/imx8mm.dtsi +index 23c8fad7932b..fde1849d36ca 100644 +--- a/arch/arm64/boot/dts/freescale/imx8mm.dtsi ++++ b/arch/arm64/boot/dts/freescale/imx8mm.dtsi +@@ -479,14 +479,18 @@ + <&clk IMX8MM_CLK_AUDIO_AHB>, + <&clk IMX8MM_CLK_IPG_AUDIO_ROOT>, + <&clk IMX8MM_SYS_PLL3>, +- <&clk IMX8MM_VIDEO_PLL1>; ++ <&clk IMX8MM_VIDEO_PLL1>, ++ <&clk IMX8MM_AUDIO_PLL1>, ++ <&clk IMX8MM_AUDIO_PLL2>; + assigned-clock-parents = <&clk IMX8MM_SYS_PLL3_OUT>, + <&clk IMX8MM_SYS_PLL1_800M>; + assigned-clock-rates = <0>, + <400000000>, + <400000000>, + <750000000>, +- <594000000>; ++ <594000000>, ++ <393216000>, ++ <361267200>; + }; + + src: reset-controller@30390000 { +@@ -741,7 +745,7 @@ + reg = <0x30bd0000 0x10000>; + interrupts = ; + clocks = <&clk IMX8MM_CLK_SDMA1_ROOT>, +- <&clk IMX8MM_CLK_SDMA1_ROOT>; ++ <&clk IMX8MM_CLK_AHB>; + clock-names = "ipg", "ahb"; + #dma-cells = <3>; + fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin"; +diff --git a/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts b/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts +index 683a11035643..98cfe67b7db7 100644 +--- a/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts ++++ b/arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts +@@ -421,7 +421,7 @@ + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_imu>; + interrupt-parent = <&gpio3>; +- interrupts = <19 IRQ_TYPE_LEVEL_LOW>; ++ interrupts = <19 IRQ_TYPE_LEVEL_HIGH>; + vdd-supply = <®_3v3_p>; + vddio-supply = <®_3v3_p>; + }; +diff --git a/arch/arm64/boot/dts/intel/socfpga_agilex.dtsi b/arch/arm64/boot/dts/intel/socfpga_agilex.dtsi +index 36abc25320a8..d2cb28da3fff 100644 +--- a/arch/arm64/boot/dts/intel/socfpga_agilex.dtsi ++++ b/arch/arm64/boot/dts/intel/socfpga_agilex.dtsi +@@ -47,10 +47,10 @@ + + pmu { + compatible = "arm,armv8-pmuv3"; +- interrupts = <0 120 8>, +- <0 121 8>, +- <0 122 8>, +- <0 123 8>; ++ interrupts = <0 170 4>, ++ <0 171 4>, ++ <0 172 4>, ++ <0 173 4>; + interrupt-affinity = <&cpu0>, + <&cpu1>, + <&cpu2>, +diff --git a/arch/arm64/boot/dts/marvell/armada-ap806-dual.dtsi b/arch/arm64/boot/dts/marvell/armada-ap806-dual.dtsi +index 9024a2d9db07..62ae016ee6aa 100644 +--- a/arch/arm64/boot/dts/marvell/armada-ap806-dual.dtsi ++++ b/arch/arm64/boot/dts/marvell/armada-ap806-dual.dtsi +@@ -21,6 +21,7 @@ + reg = <0x000>; + enable-method = "psci"; + #cooling-cells = <2>; ++ clocks = <&cpu_clk 0>; + }; + cpu1: cpu@1 { + device_type = "cpu"; +@@ -28,6 +29,7 @@ + reg = <0x001>; + enable-method = "psci"; + #cooling-cells = <2>; ++ clocks = <&cpu_clk 0>; + }; + }; + }; +diff --git a/arch/arm64/boot/dts/marvell/armada-cp110.dtsi b/arch/arm64/boot/dts/marvell/armada-cp110.dtsi +index d81944902650..8259fc8f86f2 100644 +--- a/arch/arm64/boot/dts/marvell/armada-cp110.dtsi ++++ b/arch/arm64/boot/dts/marvell/armada-cp110.dtsi +@@ -438,10 +438,10 @@ + + CP110_LABEL(nand_controller): nand@720000 { + /* +- * Due to the limitation of the pins available +- * this controller is only usable on the CPM +- * for A7K and on the CPS for A8K. +- */ ++ * Due to the limitation of the pins available ++ * this controller is only usable on the CPM ++ * for A7K and on the CPS for A8K. ++ */ + compatible = "marvell,armada-8k-nand-controller", + "marvell,armada370-nand-controller"; + reg = <0x720000 0x54>; +diff --git a/arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi b/arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi +index 108667ce4f31..8d15572d18e6 100644 +--- a/arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi ++++ b/arch/arm64/boot/dts/qcom/msm8998-mtp.dtsi +@@ -27,6 +27,66 @@ + status = "okay"; + }; + ++&etf { ++ status = "okay"; ++}; ++ ++&etm1 { ++ status = "okay"; ++}; ++ ++&etm2 { ++ status = "okay"; ++}; ++ ++&etm3 { ++ status = "okay"; ++}; ++ ++&etm4 { ++ status = "okay"; ++}; ++ ++&etm5 { ++ status = "okay"; ++}; ++ ++&etm6 { ++ status = "okay"; ++}; ++ ++&etm7 { ++ status = "okay"; ++}; ++ ++&etm8 { ++ status = "okay"; ++}; ++ ++&etr { ++ status = "okay"; ++}; ++ ++&funnel1 { ++ status = "okay"; ++}; ++ ++&funnel2 { ++ status = "okay"; ++}; ++ ++&funnel3 { ++ status = "okay"; ++}; ++ ++&funnel4 { ++ status = "okay"; ++}; ++ ++&funnel5 { ++ status = "okay"; ++}; ++ + &pm8005_lsid1 { + pm8005-regulators { + compatible = "qcom,pm8005-regulators"; +@@ -51,6 +111,10 @@ + vdda-phy-dpdm-supply = <&vreg_l24a_3p075>; + }; + ++&replicator1 { ++ status = "okay"; ++}; ++ + &rpm_requests { + pm8998-regulators { + compatible = "qcom,rpm-pm8998-regulators"; +@@ -249,6 +313,10 @@ + pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdc2_cd_off>; + }; + ++&stm { ++ status = "okay"; ++}; ++ + &ufshc { + vcc-supply = <&vreg_l20a_2p95>; + vccq-supply = <&vreg_l26a_1p2>; +diff --git a/arch/arm64/boot/dts/qcom/msm8998.dtsi b/arch/arm64/boot/dts/qcom/msm8998.dtsi +index c6f81431983e..ffb64fc239ee 100644 +--- a/arch/arm64/boot/dts/qcom/msm8998.dtsi ++++ b/arch/arm64/boot/dts/qcom/msm8998.dtsi +@@ -998,11 +998,12 @@ + #interrupt-cells = <0x2>; + }; + +- stm@6002000 { ++ stm: stm@6002000 { + compatible = "arm,coresight-stm", "arm,primecell"; + reg = <0x06002000 0x1000>, + <0x16280000 0x180000>; + reg-names = "stm-base", "stm-data-base"; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +@@ -1016,9 +1017,10 @@ + }; + }; + +- funnel@6041000 { ++ funnel1: funnel@6041000 { + compatible = "arm,coresight-dynamic-funnel", "arm,primecell"; + reg = <0x06041000 0x1000>; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +@@ -1045,9 +1047,10 @@ + }; + }; + +- funnel@6042000 { ++ funnel2: funnel@6042000 { + compatible = "arm,coresight-dynamic-funnel", "arm,primecell"; + reg = <0x06042000 0x1000>; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +@@ -1075,9 +1078,10 @@ + }; + }; + +- funnel@6045000 { ++ funnel3: funnel@6045000 { + compatible = "arm,coresight-dynamic-funnel", "arm,primecell"; + reg = <0x06045000 0x1000>; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +@@ -1113,9 +1117,10 @@ + }; + }; + +- replicator@6046000 { ++ replicator1: replicator@6046000 { + compatible = "arm,coresight-dynamic-replicator", "arm,primecell"; + reg = <0x06046000 0x1000>; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +@@ -1137,9 +1142,10 @@ + }; + }; + +- etf@6047000 { ++ etf: etf@6047000 { + compatible = "arm,coresight-tmc", "arm,primecell"; + reg = <0x06047000 0x1000>; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +@@ -1163,9 +1169,10 @@ + }; + }; + +- etr@6048000 { ++ etr: etr@6048000 { + compatible = "arm,coresight-tmc", "arm,primecell"; + reg = <0x06048000 0x1000>; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +@@ -1181,9 +1188,10 @@ + }; + }; + +- etm@7840000 { ++ etm1: etm@7840000 { + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0x07840000 0x1000>; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +@@ -1200,9 +1208,10 @@ + }; + }; + +- etm@7940000 { ++ etm2: etm@7940000 { + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0x07940000 0x1000>; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +@@ -1219,9 +1228,10 @@ + }; + }; + +- etm@7a40000 { ++ etm3: etm@7a40000 { + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0x07a40000 0x1000>; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +@@ -1238,9 +1248,10 @@ + }; + }; + +- etm@7b40000 { ++ etm4: etm@7b40000 { + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0x07b40000 0x1000>; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +@@ -1257,9 +1268,10 @@ + }; + }; + +- funnel@7b60000 { /* APSS Funnel */ ++ funnel4: funnel@7b60000 { /* APSS Funnel */ + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0x07b60000 0x1000>; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +@@ -1343,9 +1355,10 @@ + }; + }; + +- funnel@7b70000 { ++ funnel5: funnel@7b70000 { + compatible = "arm,coresight-dynamic-funnel", "arm,primecell"; + reg = <0x07b70000 0x1000>; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +@@ -1369,9 +1382,10 @@ + }; + }; + +- etm@7c40000 { ++ etm5: etm@7c40000 { + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0x07c40000 0x1000>; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +@@ -1385,9 +1399,10 @@ + }; + }; + +- etm@7d40000 { ++ etm6: etm@7d40000 { + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0x07d40000 0x1000>; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +@@ -1401,9 +1416,10 @@ + }; + }; + +- etm@7e40000 { ++ etm7: etm@7e40000 { + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0x07e40000 0x1000>; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +@@ -1417,9 +1433,10 @@ + }; + }; + +- etm@7f40000 { ++ etm8: etm@7f40000 { + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0x07f40000 0x1000>; ++ status = "disabled"; + + clocks = <&rpmcc RPM_SMD_QDSS_CLK>, <&rpmcc RPM_SMD_QDSS_A_CLK>; + clock-names = "apb_pclk", "atclk"; +diff --git a/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi b/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +index 34881c0113cb..99a28d64ee62 100644 +--- a/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi ++++ b/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +@@ -165,6 +165,8 @@ + /delete-node/ &venus_mem; + /delete-node/ &cdsp_mem; + /delete-node/ &cdsp_pas; ++/delete-node/ &zap_shader; ++/delete-node/ &gpu_mem; + + /* Increase the size from 120 MB to 128 MB */ + &mpss_region { +diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi +index f406a4340b05..2287354fef86 100644 +--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi ++++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi +@@ -2824,7 +2824,7 @@ + + qcom,gmu = <&gmu>; + +- zap-shader { ++ zap_shader: zap-shader { + memory-region = <&gpu_mem>; + }; + +diff --git a/arch/arm64/boot/dts/renesas/hihope-common.dtsi b/arch/arm64/boot/dts/renesas/hihope-common.dtsi +index 3e376d29a730..69585d6e3653 100644 +--- a/arch/arm64/boot/dts/renesas/hihope-common.dtsi ++++ b/arch/arm64/boot/dts/renesas/hihope-common.dtsi +@@ -86,7 +86,7 @@ + + label = "rcar-sound"; + +- dais = <&rsnd_port0>; ++ dais = <&rsnd_port>; + }; + + vbus0_usb2: regulator-vbus0-usb2 { +@@ -191,7 +191,7 @@ + port@2 { + reg = <2>; + dw_hdmi0_snd_in: endpoint { +- remote-endpoint = <&rsnd_endpoint0>; ++ remote-endpoint = <&rsnd_endpoint>; + }; + }; + }; +@@ -327,17 +327,15 @@ + /* Single DAI */ + #sound-dai-cells = <0>; + +- ports { +- rsnd_port0: port@0 { +- rsnd_endpoint0: endpoint { +- remote-endpoint = <&dw_hdmi0_snd_in>; ++ rsnd_port: port { ++ rsnd_endpoint: endpoint { ++ remote-endpoint = <&dw_hdmi0_snd_in>; + +- dai-format = "i2s"; +- bitclock-master = <&rsnd_endpoint0>; +- frame-master = <&rsnd_endpoint0>; ++ dai-format = "i2s"; ++ bitclock-master = <&rsnd_endpoint>; ++ frame-master = <&rsnd_endpoint>; + +- playback = <&ssi2>; +- }; ++ playback = <&ssi2>; + }; + }; + }; +diff --git a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi +index 06c7c849c8ab..c2a7ec3fc209 100644 +--- a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi +@@ -1726,17 +1726,6 @@ + "ssi.1", "ssi.0"; + status = "disabled"; + +- ports { +- #address-cells = <1>; +- #size-cells = <0>; +- port@0 { +- reg = <0>; +- }; +- port@1 { +- reg = <1>; +- }; +- }; +- + rcar_sound,ctu { + ctu00: ctu-0 { }; + ctu01: ctu-1 { }; +diff --git a/arch/arm64/boot/dts/renesas/r8a77970.dtsi b/arch/arm64/boot/dts/renesas/r8a77970.dtsi +index 0cd3b376635d..4952981bb6ba 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77970.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a77970.dtsi +@@ -652,7 +652,7 @@ + }; + + pwm3: pwm@e6e33000 { +- compatible = "renesas,pwm-r8a7790", "renesas,pwm-rcar"; ++ compatible = "renesas,pwm-r8a77970", "renesas,pwm-rcar"; + reg = <0 0xe6e33000 0 8>; + #pwm-cells = <2>; + clocks = <&cpg CPG_MOD 523>; +diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c +index 3ff291bc63b7..b95e6fa34cc8 100644 +--- a/arch/s390/kernel/setup.c ++++ b/arch/s390/kernel/setup.c +@@ -1059,7 +1059,7 @@ static void __init log_component_list(void) + + if (!early_ipl_comp_list_addr) + return; +- if (ipl_block.hdr.flags & IPL_PL_FLAG_IPLSR) ++ if (ipl_block.hdr.flags & IPL_PL_FLAG_SIPL) + pr_info("Linux is running with Secure-IPL enabled\n"); + else + pr_info("Linux is running with Secure-IPL disabled\n"); +diff --git a/arch/um/drivers/Kconfig b/arch/um/drivers/Kconfig +index fea5a0d522dc..388096fb45a2 100644 +--- a/arch/um/drivers/Kconfig ++++ b/arch/um/drivers/Kconfig +@@ -337,7 +337,7 @@ config UML_NET_SLIRP + endmenu + + config VIRTIO_UML +- tristate "UML driver for virtio devices" ++ bool "UML driver for virtio devices" + select VIRTIO + help + This driver provides support for virtio based paravirtual device +diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c +index c5643a59a8c7..179b41ad63ba 100644 +--- a/arch/um/drivers/virtio_uml.c ++++ b/arch/um/drivers/virtio_uml.c +@@ -4,12 +4,12 @@ + * + * Copyright(c) 2019 Intel Corporation + * +- * This module allows virtio devices to be used over a vhost-user socket. ++ * This driver allows virtio devices to be used over a vhost-user socket. + * + * Guest devices can be instantiated by kernel module or command line + * parameters. One device will be created for each parameter. Syntax: + * +- * [virtio_uml.]device=:[:] ++ * virtio_uml.device=:[:] + * where: + * := vhost-user socket path to connect + * := virtio device id (as in virtio_ids.h) +diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c +index 8014dfac644d..c8a42ecbd7a2 100644 +--- a/arch/um/os-Linux/main.c ++++ b/arch/um/os-Linux/main.c +@@ -170,7 +170,7 @@ int __init main(int argc, char **argv, char **envp) + * that they won't be delivered after the exec, when + * they are definitely not expected. + */ +- unblock_signals_trace(); ++ unblock_signals(); + + os_info("\n"); + /* Reboot */ +diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S +index d98cd483377e..e9a7f7cadb12 100644 +--- a/arch/x86/boot/compressed/head_64.S ++++ b/arch/x86/boot/compressed/head_64.S +@@ -244,6 +244,11 @@ ENTRY(efi32_stub_entry) + leal efi32_config(%ebp), %eax + movl %eax, efi_config(%ebp) + ++ /* Disable paging */ ++ movl %cr0, %eax ++ btrl $X86_CR0_PG_BIT, %eax ++ movl %eax, %cr0 ++ + jmp startup_32 + ENDPROC(efi32_stub_entry) + #endif +diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c +index b10a5ec79e48..011644802ce7 100644 +--- a/arch/x86/events/intel/uncore_snbep.c ++++ b/arch/x86/events/intel/uncore_snbep.c +@@ -4536,6 +4536,7 @@ static struct uncore_event_desc snr_uncore_imc_freerunning_events[] = { + INTEL_UNCORE_EVENT_DESC(write, "event=0xff,umask=0x21"), + INTEL_UNCORE_EVENT_DESC(write.scale, "3.814697266e-6"), + INTEL_UNCORE_EVENT_DESC(write.unit, "MiB"), ++ { /* end: all zeroes */ }, + }; + + static struct intel_uncore_ops snr_uncore_imc_freerunning_ops = { +diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c +index 90f75e515876..62c30279be77 100644 +--- a/arch/x86/kernel/cpu/amd.c ++++ b/arch/x86/kernel/cpu/amd.c +@@ -615,9 +615,9 @@ static void early_detect_mem_encrypt(struct cpuinfo_x86 *c) + return; + + clear_all: +- clear_cpu_cap(c, X86_FEATURE_SME); ++ setup_clear_cpu_cap(X86_FEATURE_SME); + clear_sev: +- clear_cpu_cap(c, X86_FEATURE_SEV); ++ setup_clear_cpu_cap(X86_FEATURE_SEV); + } + } + +diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c +index 03eb90d00af0..89049b343c7a 100644 +--- a/arch/x86/kernel/cpu/resctrl/core.c ++++ b/arch/x86/kernel/cpu/resctrl/core.c +@@ -618,7 +618,7 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r) + if (static_branch_unlikely(&rdt_mon_enable_key)) + rmdir_mondata_subdir_allrdtgrp(r, d->id); + list_del(&d->list); +- if (is_mbm_enabled()) ++ if (r->mon_capable && is_mbm_enabled()) + cancel_delayed_work(&d->mbm_over); + if (is_llc_occupancy_enabled() && has_busy_rmid(r, d)) { + /* +diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c +index 2e3b06d6bbc6..dac7209a0708 100644 +--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c ++++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c +@@ -1741,9 +1741,6 @@ static int set_cache_qos_cfg(int level, bool enable) + struct rdt_domain *d; + int cpu; + +- if (!zalloc_cpumask_var(&cpu_mask, GFP_KERNEL)) +- return -ENOMEM; +- + if (level == RDT_RESOURCE_L3) + update = l3_qos_cfg_update; + else if (level == RDT_RESOURCE_L2) +@@ -1751,6 +1748,9 @@ static int set_cache_qos_cfg(int level, bool enable) + else + return -EINVAL; + ++ if (!zalloc_cpumask_var(&cpu_mask, GFP_KERNEL)) ++ return -ENOMEM; ++ + r_l = &rdt_resources_all[level]; + list_for_each_entry(d, &r_l->domains, list) { + /* Pick one CPU from each domain instance to update MSR */ +diff --git a/block/blk-settings.c b/block/blk-settings.c +index 5f6dcc7a47bd..c8eda2e7b91e 100644 +--- a/block/blk-settings.c ++++ b/block/blk-settings.c +@@ -328,7 +328,7 @@ EXPORT_SYMBOL(blk_queue_max_segment_size); + * storage device can address. The default of 512 covers most + * hardware. + **/ +-void blk_queue_logical_block_size(struct request_queue *q, unsigned short size) ++void blk_queue_logical_block_size(struct request_queue *q, unsigned int size) + { + q->limits.logical_block_size = size; + +diff --git a/block/bsg-lib.c b/block/bsg-lib.c +index 347dda16c2f4..6cbb7926534c 100644 +--- a/block/bsg-lib.c ++++ b/block/bsg-lib.c +@@ -266,7 +266,7 @@ static blk_status_t bsg_queue_rq(struct blk_mq_hw_ctx *hctx, + struct request *req = bd->rq; + struct bsg_set *bset = + container_of(q->tag_set, struct bsg_set, tag_set); +- int sts = BLK_STS_IOERR; ++ blk_status_t sts = BLK_STS_IOERR; + int ret; + + blk_mq_start_request(req); +diff --git a/drivers/base/firmware_loader/builtin/Makefile b/drivers/base/firmware_loader/builtin/Makefile +index 4a66888e7253..5fa7ce3745a0 100644 +--- a/drivers/base/firmware_loader/builtin/Makefile ++++ b/drivers/base/firmware_loader/builtin/Makefile +@@ -17,7 +17,7 @@ PROGBITS = $(if $(CONFIG_ARM),%,@)progbits + filechk_fwbin = \ + echo "/* Generated by $(src)/Makefile */" ;\ + echo " .section .rodata" ;\ +- echo " .p2align $(ASM_ALIGN)" ;\ ++ echo " .p2align 4" ;\ + echo "_fw_$(FWSTR)_bin:" ;\ + echo " .incbin \"$(fwdir)/$(FWNAME)\"" ;\ + echo "_fw_end:" ;\ +diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c +index a74d03913822..c02be06c5299 100644 +--- a/drivers/block/xen-blkfront.c ++++ b/drivers/block/xen-blkfront.c +@@ -1113,8 +1113,8 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity, + if (!VDEV_IS_EXTENDED(info->vdevice)) { + err = xen_translate_vdev(info->vdevice, &minor, &offset); + if (err) +- return err; +- nr_parts = PARTS_PER_DISK; ++ return err; ++ nr_parts = PARTS_PER_DISK; + } else { + minor = BLKIF_MINOR_EXT(info->vdevice); + nr_parts = PARTS_PER_EXT_DISK; +diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c +index 34bd9bf4e68a..abbf281ee337 100644 +--- a/drivers/bus/ti-sysc.c ++++ b/drivers/bus/ti-sysc.c +@@ -343,6 +343,12 @@ static int sysc_get_clocks(struct sysc *ddata) + return -EINVAL; + } + ++ /* Always add a slot for main clocks fck and ick even if unused */ ++ if (!nr_fck) ++ ddata->nr_clocks++; ++ if (!nr_ick) ++ ddata->nr_clocks++; ++ + ddata->clocks = devm_kcalloc(ddata->dev, + ddata->nr_clocks, sizeof(*ddata->clocks), + GFP_KERNEL); +@@ -421,7 +427,7 @@ static int sysc_enable_opt_clocks(struct sysc *ddata) + struct clk *clock; + int i, error; + +- if (!ddata->clocks) ++ if (!ddata->clocks || ddata->nr_clocks < SYSC_OPTFCK0 + 1) + return 0; + + for (i = SYSC_OPTFCK0; i < SYSC_MAX_CLOCKS; i++) { +@@ -455,7 +461,7 @@ static void sysc_disable_opt_clocks(struct sysc *ddata) + struct clk *clock; + int i; + +- if (!ddata->clocks) ++ if (!ddata->clocks || ddata->nr_clocks < SYSC_OPTFCK0 + 1) + return; + + for (i = SYSC_OPTFCK0; i < SYSC_MAX_CLOCKS; i++) { +diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c +index 4fc294c2f9e8..67f592fa083a 100644 +--- a/drivers/clk/clk.c ++++ b/drivers/clk/clk.c +@@ -3408,11 +3408,17 @@ static int __clk_core_init(struct clk_core *core) + if (core->flags & CLK_IS_CRITICAL) { + unsigned long flags; + +- clk_core_prepare(core); ++ ret = clk_core_prepare(core); ++ if (ret) ++ goto out; + + flags = clk_enable_lock(); +- clk_core_enable(core); ++ ret = clk_core_enable(core); + clk_enable_unlock(flags); ++ if (ret) { ++ clk_core_unprepare(core); ++ goto out; ++ } + } + + clk_core_reparent_orphans_nolock(); +diff --git a/drivers/clk/imx/clk-imx7ulp.c b/drivers/clk/imx/clk-imx7ulp.c +index a0f650150367..04a3ae979281 100644 +--- a/drivers/clk/imx/clk-imx7ulp.c ++++ b/drivers/clk/imx/clk-imx7ulp.c +@@ -24,8 +24,8 @@ static const char * const spll_pfd_sels[] = { "spll_pfd0", "spll_pfd1", "spll_pf + static const char * const spll_sels[] = { "spll", "spll_pfd_sel", }; + static const char * const apll_pfd_sels[] = { "apll_pfd0", "apll_pfd1", "apll_pfd2", "apll_pfd3", }; + static const char * const apll_sels[] = { "apll", "apll_pfd_sel", }; +-static const char * const scs_sels[] = { "dummy", "sosc", "sirc", "firc", "dummy", "apll_sel", "spll_sel", "upll", }; +-static const char * const ddr_sels[] = { "apll_pfd_sel", "upll", }; ++static const char * const scs_sels[] = { "dummy", "sosc", "sirc", "firc", "dummy", "apll_sel", "spll_sel", "dummy", }; ++static const char * const ddr_sels[] = { "apll_pfd_sel", "dummy", "dummy", "dummy", }; + static const char * const nic_sels[] = { "firc", "ddr_clk", }; + static const char * const periph_plat_sels[] = { "dummy", "nic1_bus_clk", "nic1_clk", "ddr_clk", "apll_pfd2", "apll_pfd1", "apll_pfd0", "upll", }; + static const char * const periph_bus_sels[] = { "dummy", "sosc_bus_clk", "mpll", "firc_bus_clk", "rosc", "nic1_bus_clk", "nic1_clk", "spll_bus_clk", }; +@@ -119,7 +119,7 @@ static void __init imx7ulp_clk_scg1_init(struct device_node *np) + clks[IMX7ULP_CLK_SYS_SEL] = imx_clk_hw_mux2("scs_sel", base + 0x14, 24, 4, scs_sels, ARRAY_SIZE(scs_sels)); + clks[IMX7ULP_CLK_HSRUN_SYS_SEL] = imx_clk_hw_mux2("hsrun_scs_sel", base + 0x1c, 24, 4, scs_sels, ARRAY_SIZE(scs_sels)); + clks[IMX7ULP_CLK_NIC_SEL] = imx_clk_hw_mux2("nic_sel", base + 0x40, 28, 1, nic_sels, ARRAY_SIZE(nic_sels)); +- clks[IMX7ULP_CLK_DDR_SEL] = imx_clk_hw_mux_flags("ddr_sel", base + 0x30, 24, 1, ddr_sels, ARRAY_SIZE(ddr_sels), CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE); ++ clks[IMX7ULP_CLK_DDR_SEL] = imx_clk_hw_mux_flags("ddr_sel", base + 0x30, 24, 2, ddr_sels, ARRAY_SIZE(ddr_sels), CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE); + + clks[IMX7ULP_CLK_CORE_DIV] = imx_clk_hw_divider_flags("divcore", "scs_sel", base + 0x14, 16, 4, CLK_SET_RATE_PARENT); + clks[IMX7ULP_CLK_HSRUN_CORE_DIV] = imx_clk_hw_divider_flags("hsrun_divcore", "hsrun_scs_sel", base + 0x1c, 16, 4, CLK_SET_RATE_PARENT); +diff --git a/drivers/clk/qcom/gcc-sdm845.c b/drivers/clk/qcom/gcc-sdm845.c +index 95be125c3bdd..56d22dd225c9 100644 +--- a/drivers/clk/qcom/gcc-sdm845.c ++++ b/drivers/clk/qcom/gcc-sdm845.c +@@ -3255,6 +3255,7 @@ static struct gdsc hlos1_vote_aggre_noc_mmu_audio_tbu_gdsc = { + .name = "hlos1_vote_aggre_noc_mmu_audio_tbu_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, ++ .flags = VOTABLE, + }; + + static struct gdsc hlos1_vote_aggre_noc_mmu_pcie_tbu_gdsc = { +@@ -3263,6 +3264,7 @@ static struct gdsc hlos1_vote_aggre_noc_mmu_pcie_tbu_gdsc = { + .name = "hlos1_vote_aggre_noc_mmu_pcie_tbu_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, ++ .flags = VOTABLE, + }; + + static struct gdsc hlos1_vote_aggre_noc_mmu_tbu1_gdsc = { +@@ -3271,6 +3273,7 @@ static struct gdsc hlos1_vote_aggre_noc_mmu_tbu1_gdsc = { + .name = "hlos1_vote_aggre_noc_mmu_tbu1_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, ++ .flags = VOTABLE, + }; + + static struct gdsc hlos1_vote_aggre_noc_mmu_tbu2_gdsc = { +@@ -3279,6 +3282,7 @@ static struct gdsc hlos1_vote_aggre_noc_mmu_tbu2_gdsc = { + .name = "hlos1_vote_aggre_noc_mmu_tbu2_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, ++ .flags = VOTABLE, + }; + + static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc = { +@@ -3287,6 +3291,7 @@ static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc = { + .name = "hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, ++ .flags = VOTABLE, + }; + + static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf1_gdsc = { +@@ -3295,6 +3300,7 @@ static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf1_gdsc = { + .name = "hlos1_vote_mmnoc_mmu_tbu_hf1_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, ++ .flags = VOTABLE, + }; + + static struct gdsc hlos1_vote_mmnoc_mmu_tbu_sf_gdsc = { +@@ -3303,6 +3309,7 @@ static struct gdsc hlos1_vote_mmnoc_mmu_tbu_sf_gdsc = { + .name = "hlos1_vote_mmnoc_mmu_tbu_sf_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, ++ .flags = VOTABLE, + }; + + static struct clk_regmap *gcc_sdm845_clocks[] = { +diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c +index 3b7601647d7b..27fd274e92f8 100644 +--- a/drivers/clk/samsung/clk-exynos5420.c ++++ b/drivers/clk/samsung/clk-exynos5420.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + + #include "clk.h" + #include "clk-cpu.h" +@@ -1630,6 +1631,13 @@ static void __init exynos5x_clk_init(struct device_node *np, + exynos5x_subcmus); + } + ++ /* ++ * Keep top part of G3D clock path enabled permanently to ensure ++ * that the internal busses get their clock regardless of the ++ * main G3D clock enablement status. ++ */ ++ clk_prepare_enable(__clk_lookup("mout_sw_aclk_g3d")); ++ + samsung_clk_of_add_provider(np, ctx); + } + +diff --git a/drivers/clk/sprd/common.c b/drivers/clk/sprd/common.c +index 9d56eac43832..7ad5ba26dfba 100644 +--- a/drivers/clk/sprd/common.c ++++ b/drivers/clk/sprd/common.c +@@ -46,7 +46,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev, + + if (of_find_property(node, "sprd,syscon", NULL)) { + regmap = syscon_regmap_lookup_by_phandle(node, "sprd,syscon"); +- if (IS_ERR_OR_NULL(regmap)) { ++ if (IS_ERR(regmap)) { + pr_err("%s: failed to get syscon regmap\n", __func__); + return PTR_ERR(regmap); + } +diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-r40.c b/drivers/clk/sunxi-ng/ccu-sun8i-r40.c +index 897490800102..23bfe1d12f21 100644 +--- a/drivers/clk/sunxi-ng/ccu-sun8i-r40.c ++++ b/drivers/clk/sunxi-ng/ccu-sun8i-r40.c +@@ -761,7 +761,8 @@ static struct ccu_mp outa_clk = { + .reg = 0x1f0, + .features = CCU_FEATURE_FIXED_PREDIV, + .hw.init = CLK_HW_INIT_PARENTS("outa", out_parents, +- &ccu_mp_ops, 0), ++ &ccu_mp_ops, ++ CLK_SET_RATE_PARENT), + } + }; + +@@ -779,7 +780,8 @@ static struct ccu_mp outb_clk = { + .reg = 0x1f4, + .features = CCU_FEATURE_FIXED_PREDIV, + .hw.init = CLK_HW_INIT_PARENTS("outb", out_parents, +- &ccu_mp_ops, 0), ++ &ccu_mp_ops, ++ CLK_SET_RATE_PARENT), + } + }; + +diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c +index b9b9156618e6..703047434ee1 100644 +--- a/drivers/cpuidle/governors/teo.c ++++ b/drivers/cpuidle/governors/teo.c +@@ -194,7 +194,7 @@ static void teo_update(struct cpuidle_driver *drv, struct cpuidle_device *dev) + * pattern detection. + */ + cpu_data->intervals[cpu_data->interval_idx++] = measured_us; +- if (cpu_data->interval_idx > INTERVALS) ++ if (cpu_data->interval_idx >= INTERVALS) + cpu_data->interval_idx = 0; + } + +diff --git a/drivers/firmware/efi/earlycon.c b/drivers/firmware/efi/earlycon.c +index d4077db6dc97..5d4f84781aa0 100644 +--- a/drivers/firmware/efi/earlycon.c ++++ b/drivers/firmware/efi/earlycon.c +@@ -17,7 +17,7 @@ static const struct console *earlycon_console __initdata; + static const struct font_desc *font; + static u32 efi_x, efi_y; + static u64 fb_base; +-static pgprot_t fb_prot; ++static bool fb_wb; + static void *efi_fb; + + /* +@@ -33,10 +33,8 @@ static int __init efi_earlycon_remap_fb(void) + if (!earlycon_console || !(earlycon_console->flags & CON_ENABLED)) + return 0; + +- if (pgprot_val(fb_prot) == pgprot_val(PAGE_KERNEL)) +- efi_fb = memremap(fb_base, screen_info.lfb_size, MEMREMAP_WB); +- else +- efi_fb = memremap(fb_base, screen_info.lfb_size, MEMREMAP_WC); ++ efi_fb = memremap(fb_base, screen_info.lfb_size, ++ fb_wb ? MEMREMAP_WB : MEMREMAP_WC); + + return efi_fb ? 0 : -ENOMEM; + } +@@ -53,9 +51,12 @@ late_initcall(efi_earlycon_unmap_fb); + + static __ref void *efi_earlycon_map(unsigned long start, unsigned long len) + { ++ pgprot_t fb_prot; ++ + if (efi_fb) + return efi_fb + start; + ++ fb_prot = fb_wb ? PAGE_KERNEL : pgprot_writecombine(PAGE_KERNEL); + return early_memremap_prot(fb_base + start, len, pgprot_val(fb_prot)); + } + +@@ -215,10 +216,7 @@ static int __init efi_earlycon_setup(struct earlycon_device *device, + if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE) + fb_base |= (u64)screen_info.ext_lfb_base << 32; + +- if (opt && !strcmp(opt, "ram")) +- fb_prot = PAGE_KERNEL; +- else +- fb_prot = pgprot_writecombine(PAGE_KERNEL); ++ fb_wb = opt && !strcmp(opt, "ram"); + + si = &screen_info; + xres = si->lfb_width; +diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig +index 38e096e6925f..ceb908f7dbe5 100644 +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -546,7 +546,6 @@ config GPIO_THUNDERX + tristate "Cavium ThunderX/OCTEON-TX GPIO" + depends on ARCH_THUNDER || (64BIT && COMPILE_TEST) + depends on PCI_MSI +- select GPIOLIB_IRQCHIP + select IRQ_DOMAIN_HIERARCHY + select IRQ_FASTEOI_HIERARCHY_HANDLERS + help +diff --git a/drivers/gpio/gpio-thunderx.c b/drivers/gpio/gpio-thunderx.c +index ddad5c7ea617..715371b5102a 100644 +--- a/drivers/gpio/gpio-thunderx.c ++++ b/drivers/gpio/gpio-thunderx.c +@@ -53,6 +53,7 @@ struct thunderx_line { + struct thunderx_gpio { + struct gpio_chip chip; + u8 __iomem *register_base; ++ struct irq_domain *irqd; + struct msix_entry *msix_entries; /* per line MSI-X */ + struct thunderx_line *line_entries; /* per line irq info */ + raw_spinlock_t lock; +@@ -282,60 +283,54 @@ static void thunderx_gpio_set_multiple(struct gpio_chip *chip, + } + } + +-static void thunderx_gpio_irq_ack(struct irq_data *d) ++static void thunderx_gpio_irq_ack(struct irq_data *data) + { +- struct gpio_chip *gc = irq_data_get_irq_chip_data(d); +- struct thunderx_gpio *txgpio = gpiochip_get_data(gc); ++ struct thunderx_line *txline = irq_data_get_irq_chip_data(data); + + writeq(GPIO_INTR_INTR, +- txgpio->register_base + intr_reg(irqd_to_hwirq(d))); ++ txline->txgpio->register_base + intr_reg(txline->line)); + } + +-static void thunderx_gpio_irq_mask(struct irq_data *d) ++static void thunderx_gpio_irq_mask(struct irq_data *data) + { +- struct gpio_chip *gc = irq_data_get_irq_chip_data(d); +- struct thunderx_gpio *txgpio = gpiochip_get_data(gc); ++ struct thunderx_line *txline = irq_data_get_irq_chip_data(data); + + writeq(GPIO_INTR_ENA_W1C, +- txgpio->register_base + intr_reg(irqd_to_hwirq(d))); ++ txline->txgpio->register_base + intr_reg(txline->line)); + } + +-static void thunderx_gpio_irq_mask_ack(struct irq_data *d) ++static void thunderx_gpio_irq_mask_ack(struct irq_data *data) + { +- struct gpio_chip *gc = irq_data_get_irq_chip_data(d); +- struct thunderx_gpio *txgpio = gpiochip_get_data(gc); ++ struct thunderx_line *txline = irq_data_get_irq_chip_data(data); + + writeq(GPIO_INTR_ENA_W1C | GPIO_INTR_INTR, +- txgpio->register_base + intr_reg(irqd_to_hwirq(d))); ++ txline->txgpio->register_base + intr_reg(txline->line)); + } + +-static void thunderx_gpio_irq_unmask(struct irq_data *d) ++static void thunderx_gpio_irq_unmask(struct irq_data *data) + { +- struct gpio_chip *gc = irq_data_get_irq_chip_data(d); +- struct thunderx_gpio *txgpio = gpiochip_get_data(gc); ++ struct thunderx_line *txline = irq_data_get_irq_chip_data(data); + + writeq(GPIO_INTR_ENA_W1S, +- txgpio->register_base + intr_reg(irqd_to_hwirq(d))); ++ txline->txgpio->register_base + intr_reg(txline->line)); + } + +-static int thunderx_gpio_irq_set_type(struct irq_data *d, ++static int thunderx_gpio_irq_set_type(struct irq_data *data, + unsigned int flow_type) + { +- struct gpio_chip *gc = irq_data_get_irq_chip_data(d); +- struct thunderx_gpio *txgpio = gpiochip_get_data(gc); +- struct thunderx_line *txline = +- &txgpio->line_entries[irqd_to_hwirq(d)]; ++ struct thunderx_line *txline = irq_data_get_irq_chip_data(data); ++ struct thunderx_gpio *txgpio = txline->txgpio; + u64 bit_cfg; + +- irqd_set_trigger_type(d, flow_type); ++ irqd_set_trigger_type(data, flow_type); + + bit_cfg = txline->fil_bits | GPIO_BIT_CFG_INT_EN; + + if (flow_type & IRQ_TYPE_EDGE_BOTH) { +- irq_set_handler_locked(d, handle_fasteoi_ack_irq); ++ irq_set_handler_locked(data, handle_fasteoi_ack_irq); + bit_cfg |= GPIO_BIT_CFG_INT_TYPE; + } else { +- irq_set_handler_locked(d, handle_fasteoi_mask_irq); ++ irq_set_handler_locked(data, handle_fasteoi_mask_irq); + } + + raw_spin_lock(&txgpio->lock); +@@ -364,6 +359,33 @@ static void thunderx_gpio_irq_disable(struct irq_data *data) + irq_chip_disable_parent(data); + } + ++static int thunderx_gpio_irq_request_resources(struct irq_data *data) ++{ ++ struct thunderx_line *txline = irq_data_get_irq_chip_data(data); ++ struct thunderx_gpio *txgpio = txline->txgpio; ++ int r; ++ ++ r = gpiochip_lock_as_irq(&txgpio->chip, txline->line); ++ if (r) ++ return r; ++ ++ r = irq_chip_request_resources_parent(data); ++ if (r) ++ gpiochip_unlock_as_irq(&txgpio->chip, txline->line); ++ ++ return r; ++} ++ ++static void thunderx_gpio_irq_release_resources(struct irq_data *data) ++{ ++ struct thunderx_line *txline = irq_data_get_irq_chip_data(data); ++ struct thunderx_gpio *txgpio = txline->txgpio; ++ ++ irq_chip_release_resources_parent(data); ++ ++ gpiochip_unlock_as_irq(&txgpio->chip, txline->line); ++} ++ + /* + * Interrupts are chained from underlying MSI-X vectors. We have + * these irq_chip functions to be able to handle level triggering +@@ -380,24 +402,50 @@ static struct irq_chip thunderx_gpio_irq_chip = { + .irq_unmask = thunderx_gpio_irq_unmask, + .irq_eoi = irq_chip_eoi_parent, + .irq_set_affinity = irq_chip_set_affinity_parent, ++ .irq_request_resources = thunderx_gpio_irq_request_resources, ++ .irq_release_resources = thunderx_gpio_irq_release_resources, + .irq_set_type = thunderx_gpio_irq_set_type, + + .flags = IRQCHIP_SET_TYPE_MASKED + }; + +-static int thunderx_gpio_child_to_parent_hwirq(struct gpio_chip *gc, +- unsigned int child, +- unsigned int child_type, +- unsigned int *parent, +- unsigned int *parent_type) ++static int thunderx_gpio_irq_translate(struct irq_domain *d, ++ struct irq_fwspec *fwspec, ++ irq_hw_number_t *hwirq, ++ unsigned int *type) + { +- struct thunderx_gpio *txgpio = gpiochip_get_data(gc); +- +- *parent = txgpio->base_msi + (2 * child); +- *parent_type = IRQ_TYPE_LEVEL_HIGH; ++ struct thunderx_gpio *txgpio = d->host_data; ++ ++ if (WARN_ON(fwspec->param_count < 2)) ++ return -EINVAL; ++ if (fwspec->param[0] >= txgpio->chip.ngpio) ++ return -EINVAL; ++ *hwirq = fwspec->param[0]; ++ *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; + return 0; + } + ++static int thunderx_gpio_irq_alloc(struct irq_domain *d, unsigned int virq, ++ unsigned int nr_irqs, void *arg) ++{ ++ struct thunderx_line *txline = arg; ++ ++ return irq_domain_set_hwirq_and_chip(d, virq, txline->line, ++ &thunderx_gpio_irq_chip, txline); ++} ++ ++static const struct irq_domain_ops thunderx_gpio_irqd_ops = { ++ .alloc = thunderx_gpio_irq_alloc, ++ .translate = thunderx_gpio_irq_translate ++}; ++ ++static int thunderx_gpio_to_irq(struct gpio_chip *chip, unsigned int offset) ++{ ++ struct thunderx_gpio *txgpio = gpiochip_get_data(chip); ++ ++ return irq_find_mapping(txgpio->irqd, offset); ++} ++ + static int thunderx_gpio_probe(struct pci_dev *pdev, + const struct pci_device_id *id) + { +@@ -405,7 +453,6 @@ static int thunderx_gpio_probe(struct pci_dev *pdev, + struct device *dev = &pdev->dev; + struct thunderx_gpio *txgpio; + struct gpio_chip *chip; +- struct gpio_irq_chip *girq; + int ngpio, i; + int err = 0; + +@@ -450,8 +497,8 @@ static int thunderx_gpio_probe(struct pci_dev *pdev, + } + + txgpio->msix_entries = devm_kcalloc(dev, +- ngpio, sizeof(struct msix_entry), +- GFP_KERNEL); ++ ngpio, sizeof(struct msix_entry), ++ GFP_KERNEL); + if (!txgpio->msix_entries) { + err = -ENOMEM; + goto out; +@@ -492,6 +539,27 @@ static int thunderx_gpio_probe(struct pci_dev *pdev, + if (err < 0) + goto out; + ++ /* ++ * Push GPIO specific irqdomain on hierarchy created as a side ++ * effect of the pci_enable_msix() ++ */ ++ txgpio->irqd = irq_domain_create_hierarchy(irq_get_irq_data(txgpio->msix_entries[0].vector)->domain, ++ 0, 0, of_node_to_fwnode(dev->of_node), ++ &thunderx_gpio_irqd_ops, txgpio); ++ if (!txgpio->irqd) { ++ err = -ENOMEM; ++ goto out; ++ } ++ ++ /* Push on irq_data and the domain for each line. */ ++ for (i = 0; i < ngpio; i++) { ++ err = irq_domain_push_irq(txgpio->irqd, ++ txgpio->msix_entries[i].vector, ++ &txgpio->line_entries[i]); ++ if (err < 0) ++ dev_err(dev, "irq_domain_push_irq: %d\n", err); ++ } ++ + chip->label = KBUILD_MODNAME; + chip->parent = dev; + chip->owner = THIS_MODULE; +@@ -506,28 +574,11 @@ static int thunderx_gpio_probe(struct pci_dev *pdev, + chip->set = thunderx_gpio_set; + chip->set_multiple = thunderx_gpio_set_multiple; + chip->set_config = thunderx_gpio_set_config; +- girq = &chip->irq; +- girq->chip = &thunderx_gpio_irq_chip; +- girq->fwnode = of_node_to_fwnode(dev->of_node); +- girq->parent_domain = +- irq_get_irq_data(txgpio->msix_entries[0].vector)->domain; +- girq->child_to_parent_hwirq = thunderx_gpio_child_to_parent_hwirq; +- girq->handler = handle_bad_irq; +- girq->default_type = IRQ_TYPE_NONE; +- ++ chip->to_irq = thunderx_gpio_to_irq; + err = devm_gpiochip_add_data(dev, chip, txgpio); + if (err) + goto out; + +- /* Push on irq_data and the domain for each line. */ +- for (i = 0; i < ngpio; i++) { +- err = irq_domain_push_irq(chip->irq.domain, +- txgpio->msix_entries[i].vector, +- chip); +- if (err < 0) +- dev_err(dev, "irq_domain_push_irq: %d\n", err); +- } +- + dev_info(dev, "ThunderX GPIO: %d lines with base %d.\n", + ngpio, chip->base); + return 0; +@@ -542,10 +593,10 @@ static void thunderx_gpio_remove(struct pci_dev *pdev) + struct thunderx_gpio *txgpio = pci_get_drvdata(pdev); + + for (i = 0; i < txgpio->chip.ngpio; i++) +- irq_domain_pop_irq(txgpio->chip.irq.domain, ++ irq_domain_pop_irq(txgpio->irqd, + txgpio->msix_entries[i].vector); + +- irq_domain_remove(txgpio->chip.irq.domain); ++ irq_domain_remove(txgpio->irqd); + + pci_set_drvdata(pdev, NULL); + } +diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +index ab4a0d8545dc..0125ea7c4103 100644 +--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c ++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +@@ -2923,7 +2923,9 @@ static void gfx_v9_0_init_pg(struct amdgpu_device *adev) + * And it's needed by gfxoff feature. + */ + if (adev->gfx.rlc.is_rlc_v2_1) { +- if (adev->asic_type == CHIP_VEGA12) ++ if (adev->asic_type == CHIP_VEGA12 || ++ (adev->asic_type == CHIP_RAVEN && ++ adev->rev_id >= 8)) + gfx_v9_1_init_rlc_save_restore_list(adev); + gfx_v9_0_enable_save_restore_machine(adev); + } +diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c +index 793aa8e8ec9a..c0f1c62c59b4 100644 +--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c ++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c +@@ -809,8 +809,8 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason) + } + + case SIGNAL_TYPE_EDP: { +- read_edp_current_link_settings_on_detect(link); + detect_edp_sink_caps(link); ++ read_edp_current_link_settings_on_detect(link); + sink_caps.transaction_type = + DDC_TRANSACTION_TYPE_I2C_OVER_AUX; + sink_caps.signal = SIGNAL_TYPE_EDP; +diff --git a/drivers/gpu/drm/i915/selftests/i915_random.h b/drivers/gpu/drm/i915/selftests/i915_random.h +index 8e1ff9c105b6..22335cee2203 100644 +--- a/drivers/gpu/drm/i915/selftests/i915_random.h ++++ b/drivers/gpu/drm/i915/selftests/i915_random.h +@@ -25,6 +25,7 @@ + #ifndef __I915_SELFTESTS_RANDOM_H__ + #define __I915_SELFTESTS_RANDOM_H__ + ++#include + #include + + #include "../i915_selftest.h" +diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c +index d44745e498e7..929c909ac27a 100644 +--- a/drivers/hwmon/pmbus/ibm-cffps.c ++++ b/drivers/hwmon/pmbus/ibm-cffps.c +@@ -39,9 +39,13 @@ + #define CFFPS_MFR_VAUX_FAULT BIT(6) + #define CFFPS_MFR_CURRENT_SHARE_WARNING BIT(7) + ++/* ++ * LED off state actually relinquishes LED control to PSU firmware, so it can ++ * turn on the LED for faults. ++ */ ++#define CFFPS_LED_OFF 0 + #define CFFPS_LED_BLINK BIT(0) + #define CFFPS_LED_ON BIT(1) +-#define CFFPS_LED_OFF BIT(2) + #define CFFPS_BLINK_RATE_MS 250 + + enum { +@@ -292,28 +296,38 @@ static int ibm_cffps_read_word_data(struct i2c_client *client, int page, + return rc; + } + +-static void ibm_cffps_led_brightness_set(struct led_classdev *led_cdev, +- enum led_brightness brightness) ++static int ibm_cffps_led_brightness_set(struct led_classdev *led_cdev, ++ enum led_brightness brightness) + { + int rc; ++ u8 next_led_state; + struct ibm_cffps *psu = container_of(led_cdev, struct ibm_cffps, led); + + if (brightness == LED_OFF) { +- psu->led_state = CFFPS_LED_OFF; ++ next_led_state = CFFPS_LED_OFF; + } else { + brightness = LED_FULL; ++ + if (psu->led_state != CFFPS_LED_BLINK) +- psu->led_state = CFFPS_LED_ON; ++ next_led_state = CFFPS_LED_ON; ++ else ++ next_led_state = CFFPS_LED_BLINK; + } + ++ dev_dbg(&psu->client->dev, "LED brightness set: %d. Command: %d.\n", ++ brightness, next_led_state); ++ + pmbus_set_page(psu->client, 0); + + rc = i2c_smbus_write_byte_data(psu->client, CFFPS_SYS_CONFIG_CMD, +- psu->led_state); ++ next_led_state); + if (rc < 0) +- return; ++ return rc; + ++ psu->led_state = next_led_state; + led_cdev->brightness = brightness; ++ ++ return 0; + } + + static int ibm_cffps_led_blink_set(struct led_classdev *led_cdev, +@@ -323,10 +337,7 @@ static int ibm_cffps_led_blink_set(struct led_classdev *led_cdev, + int rc; + struct ibm_cffps *psu = container_of(led_cdev, struct ibm_cffps, led); + +- psu->led_state = CFFPS_LED_BLINK; +- +- if (led_cdev->brightness == LED_OFF) +- return 0; ++ dev_dbg(&psu->client->dev, "LED blink set.\n"); + + pmbus_set_page(psu->client, 0); + +@@ -335,6 +346,8 @@ static int ibm_cffps_led_blink_set(struct led_classdev *led_cdev, + if (rc < 0) + return rc; + ++ psu->led_state = CFFPS_LED_BLINK; ++ led_cdev->brightness = LED_FULL; + *delay_on = CFFPS_BLINK_RATE_MS; + *delay_off = CFFPS_BLINK_RATE_MS; + +@@ -351,7 +364,7 @@ static void ibm_cffps_create_led_class(struct ibm_cffps *psu) + client->addr); + psu->led.name = psu->led_name; + psu->led.max_brightness = LED_FULL; +- psu->led.brightness_set = ibm_cffps_led_brightness_set; ++ psu->led.brightness_set_blocking = ibm_cffps_led_brightness_set; + psu->led.blink_set = ibm_cffps_led_blink_set; + + rc = devm_led_classdev_register(dev, &psu->led); +diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c +index 38556381f4ca..2f8b8050a223 100644 +--- a/drivers/i2c/busses/i2c-iop3xx.c ++++ b/drivers/i2c/busses/i2c-iop3xx.c +@@ -433,13 +433,17 @@ iop3xx_i2c_probe(struct platform_device *pdev) + adapter_data->gpio_scl = devm_gpiod_get_optional(&pdev->dev, + "scl", + GPIOD_ASIS); +- if (IS_ERR(adapter_data->gpio_scl)) +- return PTR_ERR(adapter_data->gpio_scl); ++ if (IS_ERR(adapter_data->gpio_scl)) { ++ ret = PTR_ERR(adapter_data->gpio_scl); ++ goto free_both; ++ } + adapter_data->gpio_sda = devm_gpiod_get_optional(&pdev->dev, + "sda", + GPIOD_ASIS); +- if (IS_ERR(adapter_data->gpio_sda)) +- return PTR_ERR(adapter_data->gpio_sda); ++ if (IS_ERR(adapter_data->gpio_sda)) { ++ ret = PTR_ERR(adapter_data->gpio_sda); ++ goto free_both; ++ } + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { +diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c +index c1683f9338b4..dbc43cfec19d 100644 +--- a/drivers/i2c/busses/i2c-tegra.c ++++ b/drivers/i2c/busses/i2c-tegra.c +@@ -1608,14 +1608,18 @@ static int tegra_i2c_probe(struct platform_device *pdev) + } + + pm_runtime_enable(&pdev->dev); +- if (!pm_runtime_enabled(&pdev->dev)) ++ if (!pm_runtime_enabled(&pdev->dev)) { + ret = tegra_i2c_runtime_resume(&pdev->dev); +- else ++ if (ret < 0) { ++ dev_err(&pdev->dev, "runtime resume failed\n"); ++ goto unprepare_div_clk; ++ } ++ } else { + ret = pm_runtime_get_sync(i2c_dev->dev); +- +- if (ret < 0) { +- dev_err(&pdev->dev, "runtime resume failed\n"); +- goto unprepare_div_clk; ++ if (ret < 0) { ++ dev_err(&pdev->dev, "runtime resume failed\n"); ++ goto disable_rpm; ++ } + } + + if (i2c_dev->is_multimaster_mode) { +@@ -1623,7 +1627,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) + if (ret < 0) { + dev_err(i2c_dev->dev, "div_clk enable failed %d\n", + ret); +- goto disable_rpm; ++ goto put_rpm; + } + } + +@@ -1671,11 +1675,16 @@ disable_div_clk: + if (i2c_dev->is_multimaster_mode) + clk_disable(i2c_dev->div_clk); + +-disable_rpm: +- pm_runtime_disable(&pdev->dev); +- if (!pm_runtime_status_suspended(&pdev->dev)) ++put_rpm: ++ if (pm_runtime_enabled(&pdev->dev)) ++ pm_runtime_put_sync(&pdev->dev); ++ else + tegra_i2c_runtime_suspend(&pdev->dev); + ++disable_rpm: ++ if (pm_runtime_enabled(&pdev->dev)) ++ pm_runtime_disable(&pdev->dev); ++ + unprepare_div_clk: + clk_unprepare(i2c_dev->div_clk); + +@@ -1710,9 +1719,14 @@ static int tegra_i2c_remove(struct platform_device *pdev) + static int __maybe_unused tegra_i2c_suspend(struct device *dev) + { + struct tegra_i2c_dev *i2c_dev = dev_get_drvdata(dev); ++ int err; + + i2c_mark_adapter_suspended(&i2c_dev->adapter); + ++ err = pm_runtime_force_suspend(dev); ++ if (err < 0) ++ return err; ++ + return 0; + } + +@@ -1733,6 +1747,10 @@ static int __maybe_unused tegra_i2c_resume(struct device *dev) + if (err) + return err; + ++ err = pm_runtime_force_resume(dev); ++ if (err < 0) ++ return err; ++ + i2c_mark_adapter_resumed(&i2c_dev->adapter); + + return 0; +diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c +index 3f03abf100b5..306bf15023a7 100644 +--- a/drivers/iio/adc/ad7124.c ++++ b/drivers/iio/adc/ad7124.c +@@ -494,13 +494,11 @@ static int ad7124_of_parse_channel_config(struct iio_dev *indio_dev, + st->channel_config[channel].buf_negative = + of_property_read_bool(child, "adi,buffered-negative"); + +- *chan = ad7124_channel_template; +- chan->address = channel; +- chan->scan_index = channel; +- chan->channel = ain[0]; +- chan->channel2 = ain[1]; +- +- chan++; ++ chan[channel] = ad7124_channel_template; ++ chan[channel].address = channel; ++ chan[channel].scan_index = channel; ++ chan[channel].channel = ain[0]; ++ chan[channel].channel2 = ain[1]; + } + + return 0; +diff --git a/drivers/iio/chemical/Kconfig b/drivers/iio/chemical/Kconfig +index fa4586037bb8..0b91de4df8f4 100644 +--- a/drivers/iio/chemical/Kconfig ++++ b/drivers/iio/chemical/Kconfig +@@ -65,6 +65,7 @@ config IAQCORE + config PMS7003 + tristate "Plantower PMS7003 particulate matter sensor" + depends on SERIAL_DEV_BUS ++ select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say Y here to build support for the Plantower PMS7003 particulate +diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +index 3e0528793d95..057a4b010010 100644 +--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c ++++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +@@ -911,7 +911,8 @@ static int st_lsm6dsx_check_whoami(struct st_lsm6dsx_hw *hw, int id, + + for (i = 0; i < ARRAY_SIZE(st_lsm6dsx_sensor_settings); i++) { + for (j = 0; j < ST_LSM6DSX_MAX_ID; j++) { +- if (id == st_lsm6dsx_sensor_settings[i].id[j].hw_id) ++ if (st_lsm6dsx_sensor_settings[i].id[j].name && ++ id == st_lsm6dsx_sensor_settings[i].id[j].hw_id) + break; + } + if (j < ST_LSM6DSX_MAX_ID) +diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c +index c193d64e5217..112225c0e486 100644 +--- a/drivers/iio/industrialio-buffer.c ++++ b/drivers/iio/industrialio-buffer.c +@@ -566,7 +566,7 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev, + const unsigned long *mask, bool timestamp) + { + unsigned bytes = 0; +- int length, i; ++ int length, i, largest = 0; + + /* How much space will the demuxed element take? */ + for_each_set_bit(i, mask, +@@ -574,13 +574,17 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev, + length = iio_storage_bytes_for_si(indio_dev, i); + bytes = ALIGN(bytes, length); + bytes += length; ++ largest = max(largest, length); + } + + if (timestamp) { + length = iio_storage_bytes_for_timestamp(indio_dev); + bytes = ALIGN(bytes, length); + bytes += length; ++ largest = max(largest, length); + } ++ ++ bytes = ALIGN(bytes, largest); + return bytes; + } + +diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c +index 16dacea9eadf..b0e241aaefb4 100644 +--- a/drivers/iio/light/vcnl4000.c ++++ b/drivers/iio/light/vcnl4000.c +@@ -163,7 +163,6 @@ static int vcnl4200_init(struct vcnl4000_data *data) + if (ret < 0) + return ret; + +- data->al_scale = 24000; + data->vcnl4200_al.reg = VCNL4200_AL_DATA; + data->vcnl4200_ps.reg = VCNL4200_PS_DATA; + switch (id) { +@@ -172,11 +171,13 @@ static int vcnl4200_init(struct vcnl4000_data *data) + /* show 54ms in total. */ + data->vcnl4200_al.sampling_rate = ktime_set(0, 54000 * 1000); + data->vcnl4200_ps.sampling_rate = ktime_set(0, 4200 * 1000); ++ data->al_scale = 24000; + break; + case VCNL4040_PROD_ID: + /* Integration time is 80ms, add 10ms. */ + data->vcnl4200_al.sampling_rate = ktime_set(0, 100000 * 1000); + data->vcnl4200_ps.sampling_rate = ktime_set(0, 100000 * 1000); ++ data->al_scale = 120000; + break; + } + data->vcnl4200_al.last_measurement = ktime_set(0, 0); +diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig +index ccbb8973a324..97f9c001d8ff 100644 +--- a/drivers/irqchip/Kconfig ++++ b/drivers/irqchip/Kconfig +@@ -483,8 +483,6 @@ config TI_SCI_INTA_IRQCHIP + If you wish to use interrupt aggregator irq resources managed by the + TI System Controller, say Y here. Otherwise, say N. + +-endmenu +- + config SIFIVE_PLIC + bool "SiFive Platform-Level Interrupt Controller" + depends on RISCV +@@ -496,3 +494,5 @@ config SIFIVE_PLIC + interrupt sources are subordinate to the PLIC. + + If you don't know what to do here, say Y. ++ ++endmenu +diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c +index 3c50c4e4da8f..963d3774c93e 100644 +--- a/drivers/md/dm-snap-persistent.c ++++ b/drivers/md/dm-snap-persistent.c +@@ -17,7 +17,7 @@ + #include + + #define DM_MSG_PREFIX "persistent snapshot" +-#define DM_CHUNK_SIZE_DEFAULT_SECTORS 32 /* 16KB */ ++#define DM_CHUNK_SIZE_DEFAULT_SECTORS 32U /* 16KB */ + + #define DM_PREFETCH_CHUNKS 12 + +diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c +index b7c20979bd19..322386ff5d22 100644 +--- a/drivers/md/raid0.c ++++ b/drivers/md/raid0.c +@@ -87,7 +87,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) + char b[BDEVNAME_SIZE]; + char b2[BDEVNAME_SIZE]; + struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL); +- unsigned short blksize = 512; ++ unsigned blksize = 512; + + *private_conf = ERR_PTR(-ENOMEM); + if (!conf) +diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c +index f9ac22413000..1074b882c57c 100644 +--- a/drivers/message/fusion/mptctl.c ++++ b/drivers/message/fusion/mptctl.c +@@ -100,19 +100,19 @@ struct buflist { + * Function prototypes. Called from OS entry point mptctl_ioctl. + * arg contents specific to function. + */ +-static int mptctl_fw_download(unsigned long arg); +-static int mptctl_getiocinfo(unsigned long arg, unsigned int cmd); +-static int mptctl_gettargetinfo(unsigned long arg); +-static int mptctl_readtest(unsigned long arg); +-static int mptctl_mpt_command(unsigned long arg); +-static int mptctl_eventquery(unsigned long arg); +-static int mptctl_eventenable(unsigned long arg); +-static int mptctl_eventreport(unsigned long arg); +-static int mptctl_replace_fw(unsigned long arg); +- +-static int mptctl_do_reset(unsigned long arg); +-static int mptctl_hp_hostinfo(unsigned long arg, unsigned int cmd); +-static int mptctl_hp_targetinfo(unsigned long arg); ++static int mptctl_fw_download(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_getiocinfo(MPT_ADAPTER *iocp, unsigned long arg, unsigned int cmd); ++static int mptctl_gettargetinfo(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_readtest(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_mpt_command(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_eventquery(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_eventenable(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_eventreport(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_replace_fw(MPT_ADAPTER *iocp, unsigned long arg); ++ ++static int mptctl_do_reset(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_hp_hostinfo(MPT_ADAPTER *iocp, unsigned long arg, unsigned int cmd); ++static int mptctl_hp_targetinfo(MPT_ADAPTER *iocp, unsigned long arg); + + static int mptctl_probe(struct pci_dev *, const struct pci_device_id *); + static void mptctl_remove(struct pci_dev *); +@@ -123,8 +123,8 @@ static long compat_mpctl_ioctl(struct file *f, unsigned cmd, unsigned long arg); + /* + * Private function calls. + */ +-static int mptctl_do_mpt_command(struct mpt_ioctl_command karg, void __user *mfPtr); +-static int mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen); ++static int mptctl_do_mpt_command(MPT_ADAPTER *iocp, struct mpt_ioctl_command karg, void __user *mfPtr); ++static int mptctl_do_fw_download(MPT_ADAPTER *iocp, char __user *ufwbuf, size_t fwlen); + static MptSge_t *kbuf_alloc_2_sgl(int bytes, u32 dir, int sge_offset, int *frags, + struct buflist **blp, dma_addr_t *sglbuf_dma, MPT_ADAPTER *ioc); + static void kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, +@@ -656,19 +656,19 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + * by TM and FW reloads. + */ + if ((cmd & ~IOCSIZE_MASK) == (MPTIOCINFO & ~IOCSIZE_MASK)) { +- return mptctl_getiocinfo(arg, _IOC_SIZE(cmd)); ++ return mptctl_getiocinfo(iocp, arg, _IOC_SIZE(cmd)); + } else if (cmd == MPTTARGETINFO) { +- return mptctl_gettargetinfo(arg); ++ return mptctl_gettargetinfo(iocp, arg); + } else if (cmd == MPTTEST) { +- return mptctl_readtest(arg); ++ return mptctl_readtest(iocp, arg); + } else if (cmd == MPTEVENTQUERY) { +- return mptctl_eventquery(arg); ++ return mptctl_eventquery(iocp, arg); + } else if (cmd == MPTEVENTENABLE) { +- return mptctl_eventenable(arg); ++ return mptctl_eventenable(iocp, arg); + } else if (cmd == MPTEVENTREPORT) { +- return mptctl_eventreport(arg); ++ return mptctl_eventreport(iocp, arg); + } else if (cmd == MPTFWREPLACE) { +- return mptctl_replace_fw(arg); ++ return mptctl_replace_fw(iocp, arg); + } + + /* All of these commands require an interrupt or +@@ -678,15 +678,15 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + return ret; + + if (cmd == MPTFWDOWNLOAD) +- ret = mptctl_fw_download(arg); ++ ret = mptctl_fw_download(iocp, arg); + else if (cmd == MPTCOMMAND) +- ret = mptctl_mpt_command(arg); ++ ret = mptctl_mpt_command(iocp, arg); + else if (cmd == MPTHARDRESET) +- ret = mptctl_do_reset(arg); ++ ret = mptctl_do_reset(iocp, arg); + else if ((cmd & ~IOCSIZE_MASK) == (HP_GETHOSTINFO & ~IOCSIZE_MASK)) +- ret = mptctl_hp_hostinfo(arg, _IOC_SIZE(cmd)); ++ ret = mptctl_hp_hostinfo(iocp, arg, _IOC_SIZE(cmd)); + else if (cmd == HP_GETTARGETINFO) +- ret = mptctl_hp_targetinfo(arg); ++ ret = mptctl_hp_targetinfo(iocp, arg); + else + ret = -EINVAL; + +@@ -705,11 +705,10 @@ mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + return ret; + } + +-static int mptctl_do_reset(unsigned long arg) ++static int mptctl_do_reset(MPT_ADAPTER *iocp, unsigned long arg) + { + struct mpt_ioctl_diag_reset __user *urinfo = (void __user *) arg; + struct mpt_ioctl_diag_reset krinfo; +- MPT_ADAPTER *iocp; + + if (copy_from_user(&krinfo, urinfo, sizeof(struct mpt_ioctl_diag_reset))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_do_reset - " +@@ -718,12 +717,6 @@ static int mptctl_do_reset(unsigned long arg) + return -EFAULT; + } + +- if (mpt_verify_adapter(krinfo.hdr.iocnum, &iocp) < 0) { +- printk(KERN_DEBUG MYNAM "%s@%d::mptctl_do_reset - ioc%d not found!\n", +- __FILE__, __LINE__, krinfo.hdr.iocnum); +- return -ENODEV; /* (-6) No such device or address */ +- } +- + dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "mptctl_do_reset called.\n", + iocp->name)); + +@@ -754,7 +747,7 @@ static int mptctl_do_reset(unsigned long arg) + * -ENOMSG if FW upload returned bad status + */ + static int +-mptctl_fw_download(unsigned long arg) ++mptctl_fw_download(MPT_ADAPTER *iocp, unsigned long arg) + { + struct mpt_fw_xfer __user *ufwdl = (void __user *) arg; + struct mpt_fw_xfer kfwdl; +@@ -766,7 +759,7 @@ mptctl_fw_download(unsigned long arg) + return -EFAULT; + } + +- return mptctl_do_fw_download(kfwdl.iocnum, kfwdl.bufp, kfwdl.fwlen); ++ return mptctl_do_fw_download(iocp, kfwdl.bufp, kfwdl.fwlen); + } + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ +@@ -784,11 +777,10 @@ mptctl_fw_download(unsigned long arg) + * -ENOMSG if FW upload returned bad status + */ + static int +-mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) ++mptctl_do_fw_download(MPT_ADAPTER *iocp, char __user *ufwbuf, size_t fwlen) + { + FWDownload_t *dlmsg; + MPT_FRAME_HDR *mf; +- MPT_ADAPTER *iocp; + FWDownloadTCSGE_t *ptsge; + MptSge_t *sgl, *sgIn; + char *sgOut; +@@ -808,17 +800,10 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) + pFWDownloadReply_t ReplyMsg = NULL; + unsigned long timeleft; + +- if (mpt_verify_adapter(ioc, &iocp) < 0) { +- printk(KERN_DEBUG MYNAM "ioctl_fwdl - ioc%d not found!\n", +- ioc); +- return -ENODEV; /* (-6) No such device or address */ +- } else { +- +- /* Valid device. Get a message frame and construct the FW download message. +- */ +- if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL) +- return -EAGAIN; +- } ++ /* Valid device. Get a message frame and construct the FW download message. ++ */ ++ if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL) ++ return -EAGAIN; + + dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT + "mptctl_do_fwdl called. mptctl_id = %xh.\n", iocp->name, mptctl_id)); +@@ -826,8 +811,6 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) + iocp->name, ufwbuf)); + dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.fwlen = %d\n", + iocp->name, (int)fwlen)); +- dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.ioc = %04xh\n", +- iocp->name, ioc)); + + dlmsg = (FWDownload_t*) mf; + ptsge = (FWDownloadTCSGE_t *) &dlmsg->SGL; +@@ -1238,13 +1221,11 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE + * -ENODEV if no such device/adapter + */ + static int +-mptctl_getiocinfo (unsigned long arg, unsigned int data_size) ++mptctl_getiocinfo (MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size) + { + struct mpt_ioctl_iocinfo __user *uarg = (void __user *) arg; + struct mpt_ioctl_iocinfo *karg; +- MPT_ADAPTER *ioc; + struct pci_dev *pdev; +- int iocnum; + unsigned int port; + int cim_rev; + struct scsi_device *sdev; +@@ -1272,14 +1253,6 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) + return PTR_ERR(karg); + } + +- if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- kfree(karg); +- return -ENODEV; +- } +- + /* Verify the data transfer size is correct. */ + if (karg->hdr.maxDataSize != data_size) { + printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_getiocinfo - " +@@ -1385,15 +1358,13 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) + * -ENODEV if no such device/adapter + */ + static int +-mptctl_gettargetinfo (unsigned long arg) ++mptctl_gettargetinfo (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_targetinfo __user *uarg = (void __user *) arg; + struct mpt_ioctl_targetinfo karg; +- MPT_ADAPTER *ioc; + VirtDevice *vdevice; + char *pmem; + int *pdata; +- int iocnum; + int numDevices = 0; + int lun; + int maxWordsLeft; +@@ -1408,13 +1379,6 @@ mptctl_gettargetinfo (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_gettargetinfo called.\n", + ioc->name)); + /* Get the port number and set the maximum number of bytes +@@ -1510,12 +1474,10 @@ mptctl_gettargetinfo (unsigned long arg) + * -ENODEV if no such device/adapter + */ + static int +-mptctl_readtest (unsigned long arg) ++mptctl_readtest (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_test __user *uarg = (void __user *) arg; + struct mpt_ioctl_test karg; +- MPT_ADAPTER *ioc; +- int iocnum; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_readtest - " +@@ -1524,13 +1486,6 @@ mptctl_readtest (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_readtest() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_readtest called.\n", + ioc->name)); + /* Fill in the data and return the structure to the calling +@@ -1571,12 +1526,10 @@ mptctl_readtest (unsigned long arg) + * -ENODEV if no such device/adapter + */ + static int +-mptctl_eventquery (unsigned long arg) ++mptctl_eventquery (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_eventquery __user *uarg = (void __user *) arg; + struct mpt_ioctl_eventquery karg; +- MPT_ADAPTER *ioc; +- int iocnum; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventquery))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_eventquery - " +@@ -1585,13 +1538,6 @@ mptctl_eventquery (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_eventquery() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventquery called.\n", + ioc->name)); + karg.eventEntries = MPTCTL_EVENT_LOG_SIZE; +@@ -1610,12 +1556,10 @@ mptctl_eventquery (unsigned long arg) + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ + static int +-mptctl_eventenable (unsigned long arg) ++mptctl_eventenable (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_eventenable __user *uarg = (void __user *) arg; + struct mpt_ioctl_eventenable karg; +- MPT_ADAPTER *ioc; +- int iocnum; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_eventenable - " +@@ -1624,13 +1568,6 @@ mptctl_eventenable (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_eventenable() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventenable called.\n", + ioc->name)); + if (ioc->events == NULL) { +@@ -1658,12 +1595,10 @@ mptctl_eventenable (unsigned long arg) + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ + static int +-mptctl_eventreport (unsigned long arg) ++mptctl_eventreport (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_eventreport __user *uarg = (void __user *) arg; + struct mpt_ioctl_eventreport karg; +- MPT_ADAPTER *ioc; +- int iocnum; + int numBytes, maxEvents, max; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventreport))) { +@@ -1673,12 +1608,6 @@ mptctl_eventreport (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_eventreport() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventreport called.\n", + ioc->name)); + +@@ -1712,12 +1641,10 @@ mptctl_eventreport (unsigned long arg) + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ + static int +-mptctl_replace_fw (unsigned long arg) ++mptctl_replace_fw (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_replace_fw __user *uarg = (void __user *) arg; + struct mpt_ioctl_replace_fw karg; +- MPT_ADAPTER *ioc; +- int iocnum; + int newFwSize; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) { +@@ -1727,13 +1654,6 @@ mptctl_replace_fw (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_replace_fw() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_replace_fw called.\n", + ioc->name)); + /* If caching FW, Free the old FW image +@@ -1780,12 +1700,10 @@ mptctl_replace_fw (unsigned long arg) + * -ENOMEM if memory allocation error + */ + static int +-mptctl_mpt_command (unsigned long arg) ++mptctl_mpt_command (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_command __user *uarg = (void __user *) arg; + struct mpt_ioctl_command karg; +- MPT_ADAPTER *ioc; +- int iocnum; + int rc; + + +@@ -1796,14 +1714,7 @@ mptctl_mpt_command (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_mpt_command() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- +- rc = mptctl_do_mpt_command (karg, &uarg->MF); ++ rc = mptctl_do_mpt_command (ioc, karg, &uarg->MF); + + return rc; + } +@@ -1821,9 +1732,8 @@ mptctl_mpt_command (unsigned long arg) + * -EPERM if SCSI I/O and target is untagged + */ + static int +-mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) ++mptctl_do_mpt_command (MPT_ADAPTER *ioc, struct mpt_ioctl_command karg, void __user *mfPtr) + { +- MPT_ADAPTER *ioc; + MPT_FRAME_HDR *mf = NULL; + MPIHeader_t *hdr; + char *psge; +@@ -1832,7 +1742,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) + dma_addr_t dma_addr_in; + dma_addr_t dma_addr_out; + int sgSize = 0; /* Num SG elements */ +- int iocnum, flagsLength; ++ int flagsLength; + int sz, rc = 0; + int msgContext; + u16 req_idx; +@@ -1847,13 +1757,6 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) + bufIn.kptr = bufOut.kptr = NULL; + bufIn.len = bufOut.len = 0; + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + spin_lock_irqsave(&ioc->taskmgmt_lock, flags); + if (ioc->ioc_reset_in_progress) { + spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags); +@@ -2418,17 +2321,15 @@ done_free_mem: + * -ENOMEM if memory allocation error + */ + static int +-mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) ++mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size) + { + hp_host_info_t __user *uarg = (void __user *) arg; +- MPT_ADAPTER *ioc; + struct pci_dev *pdev; + char *pbuf=NULL; + dma_addr_t buf_dma; + hp_host_info_t karg; + CONFIGPARMS cfg; + ConfigPageHeader_t hdr; +- int iocnum; + int rc, cim_rev; + ToolboxIstwiReadWriteRequest_t *IstwiRWRequest; + MPT_FRAME_HDR *mf = NULL; +@@ -2452,12 +2353,6 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": mptctl_hp_hostinfo called.\n", + ioc->name)); + +@@ -2659,15 +2554,13 @@ retry_wait: + * -ENOMEM if memory allocation error + */ + static int +-mptctl_hp_targetinfo(unsigned long arg) ++mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg) + { + hp_target_info_t __user *uarg = (void __user *) arg; + SCSIDevicePage0_t *pg0_alloc; + SCSIDevicePage3_t *pg3_alloc; +- MPT_ADAPTER *ioc; + MPT_SCSI_HOST *hd = NULL; + hp_target_info_t karg; +- int iocnum; + int data_sz; + dma_addr_t page_dma; + CONFIGPARMS cfg; +@@ -2681,12 +2574,6 @@ mptctl_hp_targetinfo(unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } + if (karg.hdr.id >= MPT_MAX_FC_DEVICES) + return -EINVAL; + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_hp_targetinfo called.\n", +@@ -2854,7 +2741,7 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd, + kfw.fwlen = kfw32.fwlen; + kfw.bufp = compat_ptr(kfw32.bufp); + +- ret = mptctl_do_fw_download(kfw.iocnum, kfw.bufp, kfw.fwlen); ++ ret = mptctl_do_fw_download(iocp, kfw.bufp, kfw.fwlen); + + mutex_unlock(&iocp->ioctl_cmds.mutex); + +@@ -2908,7 +2795,7 @@ compat_mpt_command(struct file *filp, unsigned int cmd, + + /* Pass new structure to do_mpt_command + */ +- ret = mptctl_do_mpt_command (karg, &uarg->MF); ++ ret = mptctl_do_mpt_command (iocp, karg, &uarg->MF); + + mutex_unlock(&iocp->ioctl_cmds.mutex); + +diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c +index cf8c8be40a9c..a4f2d8cdca12 100644 +--- a/drivers/mtd/chips/cfi_cmdset_0002.c ++++ b/drivers/mtd/chips/cfi_cmdset_0002.c +@@ -123,19 +123,23 @@ static int cfi_use_status_reg(struct cfi_private *cfi) + (extp->SoftwareFeatures & poll_mask) == CFI_POLL_STATUS_REG; + } + +-static void cfi_check_err_status(struct map_info *map, struct flchip *chip, +- unsigned long adr) ++static int cfi_check_err_status(struct map_info *map, struct flchip *chip, ++ unsigned long adr) + { + struct cfi_private *cfi = map->fldrv_priv; + map_word status; + + if (!cfi_use_status_reg(cfi)) +- return; ++ return 0; + + cfi_send_gen_cmd(0x70, cfi->addr_unlock1, chip->start, map, cfi, + cfi->device_type, NULL); + status = map_read(map, adr); + ++ /* The error bits are invalid while the chip's busy */ ++ if (!map_word_bitsset(map, status, CMD(CFI_SR_DRB))) ++ return 0; ++ + if (map_word_bitsset(map, status, CMD(0x3a))) { + unsigned long chipstatus = MERGESTATUS(status); + +@@ -151,7 +155,12 @@ static void cfi_check_err_status(struct map_info *map, struct flchip *chip, + if (chipstatus & CFI_SR_SLSB) + pr_err("%s sector write protected, status %lx\n", + map->name, chipstatus); ++ ++ /* Erase/Program status bits are set on the operation failure */ ++ if (chipstatus & (CFI_SR_ESB | CFI_SR_PSB)) ++ return 1; + } ++ return 0; + } + + /* #define DEBUG_CFI_FEATURES */ +@@ -848,20 +857,16 @@ static int __xipram chip_good(struct map_info *map, struct flchip *chip, + + if (cfi_use_status_reg(cfi)) { + map_word ready = CMD(CFI_SR_DRB); +- map_word err = CMD(CFI_SR_PSB | CFI_SR_ESB); ++ + /* + * For chips that support status register, check device +- * ready bit and Erase/Program status bit to know if +- * operation succeeded. ++ * ready bit + */ + cfi_send_gen_cmd(0x70, cfi->addr_unlock1, chip->start, map, cfi, + cfi->device_type, NULL); + curd = map_read(map, addr); + +- if (map_word_andequal(map, curd, ready, ready)) +- return !map_word_bitsset(map, curd, err); +- +- return 0; ++ return map_word_andequal(map, curd, ready, ready); + } + + oldd = map_read(map, addr); +@@ -1699,8 +1704,11 @@ static int __xipram do_write_oneword_once(struct map_info *map, + break; + } + +- if (chip_good(map, chip, adr, datum)) ++ if (chip_good(map, chip, adr, datum)) { ++ if (cfi_check_err_status(map, chip, adr)) ++ ret = -EIO; + break; ++ } + + /* Latency issues. Drop the lock, wait a while and retry */ + UDELAY(map, chip, adr, 1); +@@ -1773,7 +1781,6 @@ static int __xipram do_write_oneword_retry(struct map_info *map, + ret = do_write_oneword_once(map, chip, adr, datum, mode, cfi); + if (ret) { + /* reset on all failures. */ +- cfi_check_err_status(map, chip, adr); + map_write(map, CMD(0xF0), chip->start); + /* FIXME - should have reset delay before continuing */ + +@@ -1970,12 +1977,17 @@ static int __xipram do_write_buffer_wait(struct map_info *map, + */ + if (time_after(jiffies, timeo) && + !chip_good(map, chip, adr, datum)) { ++ pr_err("MTD %s(): software timeout, address:0x%.8lx.\n", ++ __func__, adr); + ret = -EIO; + break; + } + +- if (chip_good(map, chip, adr, datum)) ++ if (chip_good(map, chip, adr, datum)) { ++ if (cfi_check_err_status(map, chip, adr)) ++ ret = -EIO; + break; ++ } + + /* Latency issues. Drop the lock, wait a while and retry */ + UDELAY(map, chip, adr, 1); +@@ -2071,12 +2083,8 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, + chip->word_write_time); + + ret = do_write_buffer_wait(map, chip, adr, datum); +- if (ret) { +- cfi_check_err_status(map, chip, adr); ++ if (ret) + do_write_buffer_reset(map, chip, cfi); +- pr_err("MTD %s(): software timeout, address:0x%.8lx.\n", +- __func__, adr); +- } + + xip_enable(map, chip, adr); + +@@ -2271,9 +2279,9 @@ retry: + udelay(1); + } + +- if (!chip_good(map, chip, adr, datum)) { ++ if (!chip_good(map, chip, adr, datum) || ++ cfi_check_err_status(map, chip, adr)) { + /* reset on all failures. */ +- cfi_check_err_status(map, chip, adr); + map_write(map, CMD(0xF0), chip->start); + /* FIXME - should have reset delay before continuing */ + +@@ -2467,8 +2475,11 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip) + chip->erase_suspended = 0; + } + +- if (chip_good(map, chip, adr, map_word_ff(map))) ++ if (chip_good(map, chip, adr, map_word_ff(map))) { ++ if (cfi_check_err_status(map, chip, adr)) ++ ret = -EIO; + break; ++ } + + if (time_after(jiffies, timeo)) { + printk(KERN_WARNING "MTD %s(): software timeout\n", +@@ -2483,7 +2494,6 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip) + /* Did we succeed? */ + if (ret) { + /* reset on all failures. */ +- cfi_check_err_status(map, chip, adr); + map_write(map, CMD(0xF0), chip->start); + /* FIXME - should have reset delay before continuing */ + +@@ -2564,8 +2574,11 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, + chip->erase_suspended = 0; + } + +- if (chip_good(map, chip, adr, map_word_ff(map))) ++ if (chip_good(map, chip, adr, map_word_ff(map))) { ++ if (cfi_check_err_status(map, chip, adr)) ++ ret = -EIO; + break; ++ } + + if (time_after(jiffies, timeo)) { + printk(KERN_WARNING "MTD %s(): software timeout\n", +@@ -2580,7 +2593,6 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, + /* Did we succeed? */ + if (ret) { + /* reset on all failures. */ +- cfi_check_err_status(map, chip, adr); + map_write(map, CMD(0xF0), chip->start); + /* FIXME - should have reset delay before continuing */ + +diff --git a/drivers/mtd/devices/mchp23k256.c b/drivers/mtd/devices/mchp23k256.c +index b20d02b4f830..77c872fd3d83 100644 +--- a/drivers/mtd/devices/mchp23k256.c ++++ b/drivers/mtd/devices/mchp23k256.c +@@ -64,15 +64,17 @@ static int mchp23k256_write(struct mtd_info *mtd, loff_t to, size_t len, + struct spi_transfer transfer[2] = {}; + struct spi_message message; + unsigned char command[MAX_CMD_SIZE]; +- int ret; ++ int ret, cmd_len; + + spi_message_init(&message); + ++ cmd_len = mchp23k256_cmdsz(flash); ++ + command[0] = MCHP23K256_CMD_WRITE; + mchp23k256_addr2cmd(flash, to, command); + + transfer[0].tx_buf = command; +- transfer[0].len = mchp23k256_cmdsz(flash); ++ transfer[0].len = cmd_len; + spi_message_add_tail(&transfer[0], &message); + + transfer[1].tx_buf = buf; +@@ -88,8 +90,8 @@ static int mchp23k256_write(struct mtd_info *mtd, loff_t to, size_t len, + if (ret) + return ret; + +- if (retlen && message.actual_length > sizeof(command)) +- *retlen += message.actual_length - sizeof(command); ++ if (retlen && message.actual_length > cmd_len) ++ *retlen += message.actual_length - cmd_len; + + return 0; + } +@@ -101,16 +103,18 @@ static int mchp23k256_read(struct mtd_info *mtd, loff_t from, size_t len, + struct spi_transfer transfer[2] = {}; + struct spi_message message; + unsigned char command[MAX_CMD_SIZE]; +- int ret; ++ int ret, cmd_len; + + spi_message_init(&message); + ++ cmd_len = mchp23k256_cmdsz(flash); ++ + memset(&transfer, 0, sizeof(transfer)); + command[0] = MCHP23K256_CMD_READ; + mchp23k256_addr2cmd(flash, from, command); + + transfer[0].tx_buf = command; +- transfer[0].len = mchp23k256_cmdsz(flash); ++ transfer[0].len = cmd_len; + spi_message_add_tail(&transfer[0], &message); + + transfer[1].rx_buf = buf; +@@ -126,8 +130,8 @@ static int mchp23k256_read(struct mtd_info *mtd, loff_t from, size_t len, + if (ret) + return ret; + +- if (retlen && message.actual_length > sizeof(command)) +- *retlen += message.actual_length - sizeof(command); ++ if (retlen && message.actual_length > cmd_len) ++ *retlen += message.actual_length - cmd_len; + + return 0; + } +diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +index 334fe3130285..b9d5d55a5edb 100644 +--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c ++++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +@@ -148,6 +148,10 @@ static int gpmi_init(struct gpmi_nand_data *this) + struct resources *r = &this->resources; + int ret; + ++ ret = pm_runtime_get_sync(this->dev); ++ if (ret < 0) ++ return ret; ++ + ret = gpmi_reset_block(r->gpmi_regs, false); + if (ret) + goto err_out; +@@ -179,8 +183,9 @@ static int gpmi_init(struct gpmi_nand_data *this) + */ + writel(BM_GPMI_CTRL1_DECOUPLE_CS, r->gpmi_regs + HW_GPMI_CTRL1_SET); + +- return 0; + err_out: ++ pm_runtime_mark_last_busy(this->dev); ++ pm_runtime_put_autosuspend(this->dev); + return ret; + } + +@@ -2722,6 +2727,10 @@ static int gpmi_pm_resume(struct device *dev) + return ret; + } + ++ /* Set flag to get timing setup restored for next exec_op */ ++ if (this->hw.clk_rate) ++ this->hw.must_apply_timings = true; ++ + /* re-init the BCH registers */ + ret = bch_set_geometry(this); + if (ret) { +diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c +index 1548e0f7f5f4..309c808351ac 100644 +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -4544,9 +4544,7 @@ static void spi_nor_info_init_params(struct spi_nor *nor) + + static void spansion_post_sfdp_fixups(struct spi_nor *nor) + { +- struct mtd_info *mtd = &nor->mtd; +- +- if (mtd->size <= SZ_16M) ++ if (nor->params.size <= SZ_16M) + return; + + nor->flags |= SNOR_F_4B_OPCODES; +diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c +index 69fc13046ac7..47b21096b577 100644 +--- a/drivers/net/dsa/bcm_sf2.c ++++ b/drivers/net/dsa/bcm_sf2.c +@@ -68,7 +68,7 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port) + + /* Force link status for IMP port */ + reg = core_readl(priv, offset); +- reg |= (MII_SW_OR | LINK_STS); ++ reg |= (MII_SW_OR | LINK_STS | GMII_SPEED_UP_2G); + core_writel(priv, reg, offset); + + /* Enable Broadcast, Multicast, Unicast forwarding to IMP port */ +diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c +index 7763221286d4..3b51e87a3714 100644 +--- a/drivers/net/dsa/sja1105/sja1105_main.c ++++ b/drivers/net/dsa/sja1105/sja1105_main.c +@@ -619,7 +619,7 @@ static int sja1105_parse_ports_node(struct sja1105_private *priv, + struct device *dev = &priv->spidev->dev; + struct device_node *child; + +- for_each_child_of_node(ports_node, child) { ++ for_each_available_child_of_node(ports_node, child) { + struct device_node *phy_node; + int phy_mode; + u32 index; +diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c +index a977a459bd20..b4c664957266 100644 +--- a/drivers/net/ethernet/broadcom/bcmsysport.c ++++ b/drivers/net/ethernet/broadcom/bcmsysport.c +@@ -2323,7 +2323,7 @@ static int bcm_sysport_map_queues(struct notifier_block *nb, + ring->switch_queue = qp; + ring->switch_port = port; + ring->inspect = true; +- priv->ring_map[q + port * num_tx_queues] = ring; ++ priv->ring_map[qp + port * num_tx_queues] = ring; + qp++; + } + +@@ -2338,7 +2338,7 @@ static int bcm_sysport_unmap_queues(struct notifier_block *nb, + struct net_device *slave_dev; + unsigned int num_tx_queues; + struct net_device *dev; +- unsigned int q, port; ++ unsigned int q, qp, port; + + priv = container_of(nb, struct bcm_sysport_priv, dsa_notifier); + if (priv->netdev != info->master) +@@ -2364,7 +2364,8 @@ static int bcm_sysport_unmap_queues(struct notifier_block *nb, + continue; + + ring->inspect = false; +- priv->ring_map[q + port * num_tx_queues] = NULL; ++ qp = ring->switch_queue; ++ priv->ring_map[qp + port * num_tx_queues] = NULL; + } + + return 0; +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c +index 5c75b061243f..cf292f7c3d3c 100644 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c +@@ -10991,11 +10991,23 @@ static bool bnxt_fltr_match(struct bnxt_ntuple_filter *f1, + struct flow_keys *keys1 = &f1->fkeys; + struct flow_keys *keys2 = &f2->fkeys; + +- if (keys1->addrs.v4addrs.src == keys2->addrs.v4addrs.src && +- keys1->addrs.v4addrs.dst == keys2->addrs.v4addrs.dst && +- keys1->ports.ports == keys2->ports.ports && +- keys1->basic.ip_proto == keys2->basic.ip_proto && +- keys1->basic.n_proto == keys2->basic.n_proto && ++ if (keys1->basic.n_proto != keys2->basic.n_proto || ++ keys1->basic.ip_proto != keys2->basic.ip_proto) ++ return false; ++ ++ if (keys1->basic.n_proto == htons(ETH_P_IP)) { ++ if (keys1->addrs.v4addrs.src != keys2->addrs.v4addrs.src || ++ keys1->addrs.v4addrs.dst != keys2->addrs.v4addrs.dst) ++ return false; ++ } else { ++ if (memcmp(&keys1->addrs.v6addrs.src, &keys2->addrs.v6addrs.src, ++ sizeof(keys1->addrs.v6addrs.src)) || ++ memcmp(&keys1->addrs.v6addrs.dst, &keys2->addrs.v6addrs.dst, ++ sizeof(keys1->addrs.v6addrs.dst))) ++ return false; ++ } ++ ++ if (keys1->ports.ports == keys2->ports.ports && + keys1->control.flags == keys2->control.flags && + ether_addr_equal(f1->src_mac_addr, f2->src_mac_addr) && + ether_addr_equal(f1->dst_mac_addr, f2->dst_mac_addr)) +@@ -11287,7 +11299,7 @@ int bnxt_get_port_parent_id(struct net_device *dev, + return -EOPNOTSUPP; + + /* The PF and it's VF-reps only support the switchdev framework */ +- if (!BNXT_PF(bp)) ++ if (!BNXT_PF(bp) || !(bp->flags & BNXT_FLAG_DSN_VALID)) + return -EOPNOTSUPP; + + ppid->id_len = sizeof(bp->switch_id); +@@ -11679,6 +11691,7 @@ static int bnxt_pcie_dsn_get(struct bnxt *bp, u8 dsn[]) + put_unaligned_le32(dw, &dsn[0]); + pci_read_config_dword(pdev, pos + 4, &dw); + put_unaligned_le32(dw, &dsn[4]); ++ bp->flags |= BNXT_FLAG_DSN_VALID; + return 0; + } + +@@ -11790,9 +11803,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) + + if (BNXT_PF(bp)) { + /* Read the adapter's DSN to use as the eswitch switch_id */ +- rc = bnxt_pcie_dsn_get(bp, bp->switch_id); +- if (rc) +- goto init_err_pci_clean; ++ bnxt_pcie_dsn_get(bp, bp->switch_id); + } + + /* MTU range: 60 - FW defined max */ +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h +index dc26e3ace43f..2e6ad53fdc75 100644 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h +@@ -1510,6 +1510,7 @@ struct bnxt { + #define BNXT_FLAG_NO_AGG_RINGS 0x20000 + #define BNXT_FLAG_RX_PAGE_MODE 0x40000 + #define BNXT_FLAG_MULTI_HOST 0x100000 ++ #define BNXT_FLAG_DSN_VALID 0x200000 + #define BNXT_FLAG_DOUBLE_DB 0x400000 + #define BNXT_FLAG_CHIP_NITRO_A0 0x1000000 + #define BNXT_FLAG_DIM 0x2000000 +@@ -1904,9 +1905,6 @@ static inline bool bnxt_cfa_hwrm_message(u16 req_type) + case HWRM_CFA_ENCAP_RECORD_FREE: + case HWRM_CFA_DECAP_FILTER_ALLOC: + case HWRM_CFA_DECAP_FILTER_FREE: +- case HWRM_CFA_NTUPLE_FILTER_ALLOC: +- case HWRM_CFA_NTUPLE_FILTER_FREE: +- case HWRM_CFA_NTUPLE_FILTER_CFG: + case HWRM_CFA_EM_FLOW_ALLOC: + case HWRM_CFA_EM_FLOW_FREE: + case HWRM_CFA_EM_FLOW_CFG: +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c +index f9bf7d7250ab..b010b34cdaf8 100644 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c +@@ -398,6 +398,9 @@ static int bnxt_vf_reps_create(struct bnxt *bp) + struct net_device *dev; + int rc, i; + ++ if (!(bp->flags & BNXT_FLAG_DSN_VALID)) ++ return -ENODEV; ++ + bp->vf_reps = kcalloc(num_vfs, sizeof(vf_rep), GFP_KERNEL); + if (!bp->vf_reps) + return -ENOMEM; +diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c +index 14ab20491fd0..eb69e5c81a4d 100644 +--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c ++++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c +@@ -565,7 +565,6 @@ static int hns_nic_poll_rx_skb(struct hns_nic_ring_data *ring_data, + skb = *out_skb = napi_alloc_skb(&ring_data->napi, + HNS_RX_HEAD_SIZE); + if (unlikely(!skb)) { +- netdev_err(ndev, "alloc rx skb fail\n"); + ring->stats.sw_err_cnt++; + return -ENOMEM; + } +@@ -1056,7 +1055,6 @@ static int hns_nic_common_poll(struct napi_struct *napi, int budget) + container_of(napi, struct hns_nic_ring_data, napi); + struct hnae_ring *ring = ring_data->ring; + +-try_again: + clean_complete += ring_data->poll_one( + ring_data, budget - clean_complete, + ring_data->ex_process); +@@ -1066,7 +1064,7 @@ try_again: + napi_complete(napi); + ring->q->handle->dev->ops->toggle_ring_irq(ring, 0); + } else { +- goto try_again; ++ return budget; + } + } + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +index 84d8816c8681..0c8d2269bc46 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +@@ -54,6 +54,8 @@ MODULE_PARM_DESC(debug, " Network interface message level setting"); + #define HNS3_INNER_VLAN_TAG 1 + #define HNS3_OUTER_VLAN_TAG 2 + ++#define HNS3_MIN_TX_LEN 33U ++ + /* hns3_pci_tbl - PCI Device ID Table + * + * Last entry must be all 0s +@@ -1329,6 +1331,10 @@ netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev) + int ret; + int i; + ++ /* Hardware can only handle short frames above 32 bytes */ ++ if (skb_put_padto(skb, HNS3_MIN_TX_LEN)) ++ return NETDEV_TX_OK; ++ + /* Prefetch the data used later */ + prefetch(skb->data); + +diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c +index 4960c9c3e773..a8dd0228b678 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_main.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c +@@ -7168,6 +7168,7 @@ static int i40e_setup_macvlans(struct i40e_vsi *vsi, u16 macvlan_cnt, u16 qcnt, + ch->num_queue_pairs = qcnt; + if (!i40e_setup_channel(pf, vsi, ch)) { + ret = -EINVAL; ++ kfree(ch); + goto err_free; + } + ch->parent_vsi = vsi; +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +index 3ec18fb0d479..a806c6190bb1 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +@@ -812,23 +812,17 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb, + u64 len; + int err; + ++ if (skb_cow_head(skb, MLXSW_TXHDR_LEN)) { ++ this_cpu_inc(mlxsw_sp_port->pcpu_stats->tx_dropped); ++ dev_kfree_skb_any(skb); ++ return NETDEV_TX_OK; ++ } ++ + memset(skb->cb, 0, sizeof(struct mlxsw_skb_cb)); + + if (mlxsw_core_skb_transmit_busy(mlxsw_sp->core, &tx_info)) + return NETDEV_TX_BUSY; + +- if (unlikely(skb_headroom(skb) < MLXSW_TXHDR_LEN)) { +- struct sk_buff *skb_orig = skb; +- +- skb = skb_realloc_headroom(skb, MLXSW_TXHDR_LEN); +- if (!skb) { +- this_cpu_inc(mlxsw_sp_port->pcpu_stats->tx_dropped); +- dev_kfree_skb_any(skb_orig); +- return NETDEV_TX_OK; +- } +- dev_consume_skb_any(skb_orig); +- } +- + if (eth_skb_pad(skb)) { + this_cpu_inc(mlxsw_sp_port->pcpu_stats->tx_dropped); + return NETDEV_TX_OK; +@@ -1167,6 +1161,9 @@ static void update_stats_cache(struct work_struct *work) + periodic_hw_stats.update_dw.work); + + if (!netif_carrier_ok(mlxsw_sp_port->dev)) ++ /* Note: mlxsw_sp_port_down_wipe_counters() clears the cache as ++ * necessary when port goes down. ++ */ + goto out; + + mlxsw_sp_port_get_hw_stats(mlxsw_sp_port->dev, +@@ -4176,6 +4173,15 @@ static int mlxsw_sp_port_unsplit(struct mlxsw_core *mlxsw_core, u8 local_port, + return 0; + } + ++static void ++mlxsw_sp_port_down_wipe_counters(struct mlxsw_sp_port *mlxsw_sp_port) ++{ ++ int i; ++ ++ for (i = 0; i < TC_MAX_QUEUE; i++) ++ mlxsw_sp_port->periodic_hw_stats.xstats.backlog[i] = 0; ++} ++ + static void mlxsw_sp_pude_event_func(const struct mlxsw_reg_info *reg, + char *pude_pl, void *priv) + { +@@ -4197,6 +4203,7 @@ static void mlxsw_sp_pude_event_func(const struct mlxsw_reg_info *reg, + } else { + netdev_info(mlxsw_sp_port->dev, "link down\n"); + netif_carrier_off(mlxsw_sp_port->dev); ++ mlxsw_sp_port_down_wipe_counters(mlxsw_sp_port); + } + } + +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c +index 720514b5c006..dc63583c4948 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c +@@ -195,6 +195,20 @@ mlxsw_sp_qdisc_get_xstats(struct mlxsw_sp_port *mlxsw_sp_port, + return -EOPNOTSUPP; + } + ++static u64 ++mlxsw_sp_xstats_backlog(struct mlxsw_sp_port_xstats *xstats, int tclass_num) ++{ ++ return xstats->backlog[tclass_num] + ++ xstats->backlog[tclass_num + 8]; ++} ++ ++static u64 ++mlxsw_sp_xstats_tail_drop(struct mlxsw_sp_port_xstats *xstats, int tclass_num) ++{ ++ return xstats->tail_drop[tclass_num] + ++ xstats->tail_drop[tclass_num + 8]; ++} ++ + static void + mlxsw_sp_qdisc_bstats_per_priority_get(struct mlxsw_sp_port_xstats *xstats, + u8 prio_bitmap, u64 *tx_packets, +@@ -269,7 +283,7 @@ mlxsw_sp_setup_tc_qdisc_red_clean_stats(struct mlxsw_sp_port *mlxsw_sp_port, + &stats_base->tx_bytes); + red_base->prob_mark = xstats->ecn; + red_base->prob_drop = xstats->wred_drop[tclass_num]; +- red_base->pdrop = xstats->tail_drop[tclass_num]; ++ red_base->pdrop = mlxsw_sp_xstats_tail_drop(xstats, tclass_num); + + stats_base->overlimits = red_base->prob_drop + red_base->prob_mark; + stats_base->drops = red_base->prob_drop + red_base->pdrop; +@@ -369,7 +383,8 @@ mlxsw_sp_qdisc_get_red_xstats(struct mlxsw_sp_port *mlxsw_sp_port, + + early_drops = xstats->wred_drop[tclass_num] - xstats_base->prob_drop; + marks = xstats->ecn - xstats_base->prob_mark; +- pdrops = xstats->tail_drop[tclass_num] - xstats_base->pdrop; ++ pdrops = mlxsw_sp_xstats_tail_drop(xstats, tclass_num) - ++ xstats_base->pdrop; + + res->pdrop += pdrops; + res->prob_drop += early_drops; +@@ -402,9 +417,10 @@ mlxsw_sp_qdisc_get_red_stats(struct mlxsw_sp_port *mlxsw_sp_port, + + overlimits = xstats->wred_drop[tclass_num] + xstats->ecn - + stats_base->overlimits; +- drops = xstats->wred_drop[tclass_num] + xstats->tail_drop[tclass_num] - ++ drops = xstats->wred_drop[tclass_num] + ++ mlxsw_sp_xstats_tail_drop(xstats, tclass_num) - + stats_base->drops; +- backlog = xstats->backlog[tclass_num]; ++ backlog = mlxsw_sp_xstats_backlog(xstats, tclass_num); + + _bstats_update(stats_ptr->bstats, tx_bytes, tx_packets); + stats_ptr->qstats->overlimits += overlimits; +@@ -575,9 +591,9 @@ mlxsw_sp_qdisc_get_prio_stats(struct mlxsw_sp_port *mlxsw_sp_port, + tx_packets = stats->tx_packets - stats_base->tx_packets; + + for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { +- drops += xstats->tail_drop[i]; ++ drops += mlxsw_sp_xstats_tail_drop(xstats, i); + drops += xstats->wred_drop[i]; +- backlog += xstats->backlog[i]; ++ backlog += mlxsw_sp_xstats_backlog(xstats, i); + } + drops = drops - stats_base->drops; + +@@ -613,7 +629,7 @@ mlxsw_sp_setup_tc_qdisc_prio_clean_stats(struct mlxsw_sp_port *mlxsw_sp_port, + + stats_base->drops = 0; + for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { +- stats_base->drops += xstats->tail_drop[i]; ++ stats_base->drops += mlxsw_sp_xstats_tail_drop(xstats, i); + stats_base->drops += xstats->wred_drop[i]; + } + +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c +index 7ba35a0bdb29..8aa1b1bda96d 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -2204,24 +2204,28 @@ static size_t __sh_eth_get_regs(struct net_device *ndev, u32 *buf) + if (cd->tsu) { + add_tsu_reg(ARSTR); + add_tsu_reg(TSU_CTRST); +- add_tsu_reg(TSU_FWEN0); +- add_tsu_reg(TSU_FWEN1); +- add_tsu_reg(TSU_FCM); +- add_tsu_reg(TSU_BSYSL0); +- add_tsu_reg(TSU_BSYSL1); +- add_tsu_reg(TSU_PRISL0); +- add_tsu_reg(TSU_PRISL1); +- add_tsu_reg(TSU_FWSL0); +- add_tsu_reg(TSU_FWSL1); ++ if (cd->dual_port) { ++ add_tsu_reg(TSU_FWEN0); ++ add_tsu_reg(TSU_FWEN1); ++ add_tsu_reg(TSU_FCM); ++ add_tsu_reg(TSU_BSYSL0); ++ add_tsu_reg(TSU_BSYSL1); ++ add_tsu_reg(TSU_PRISL0); ++ add_tsu_reg(TSU_PRISL1); ++ add_tsu_reg(TSU_FWSL0); ++ add_tsu_reg(TSU_FWSL1); ++ } + add_tsu_reg(TSU_FWSLC); +- add_tsu_reg(TSU_QTAGM0); +- add_tsu_reg(TSU_QTAGM1); +- add_tsu_reg(TSU_FWSR); +- add_tsu_reg(TSU_FWINMK); +- add_tsu_reg(TSU_ADQT0); +- add_tsu_reg(TSU_ADQT1); +- add_tsu_reg(TSU_VTAG0); +- add_tsu_reg(TSU_VTAG1); ++ if (cd->dual_port) { ++ add_tsu_reg(TSU_QTAGM0); ++ add_tsu_reg(TSU_QTAGM1); ++ add_tsu_reg(TSU_FWSR); ++ add_tsu_reg(TSU_FWINMK); ++ add_tsu_reg(TSU_ADQT0); ++ add_tsu_reg(TSU_ADQT1); ++ add_tsu_reg(TSU_VTAG0); ++ add_tsu_reg(TSU_VTAG1); ++ } + add_tsu_reg(TSU_ADSBSY); + add_tsu_reg(TSU_TEN); + add_tsu_reg(TSU_POST1); +diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c +index 6e984d5a729f..38d39c4b5ac8 100644 +--- a/drivers/net/ethernet/socionext/sni_ave.c ++++ b/drivers/net/ethernet/socionext/sni_ave.c +@@ -424,16 +424,22 @@ static void ave_ethtool_get_wol(struct net_device *ndev, + phy_ethtool_get_wol(ndev->phydev, wol); + } + +-static int ave_ethtool_set_wol(struct net_device *ndev, +- struct ethtool_wolinfo *wol) ++static int __ave_ethtool_set_wol(struct net_device *ndev, ++ struct ethtool_wolinfo *wol) + { +- int ret; +- + if (!ndev->phydev || + (wol->wolopts & (WAKE_ARP | WAKE_MAGICSECURE))) + return -EOPNOTSUPP; + +- ret = phy_ethtool_set_wol(ndev->phydev, wol); ++ return phy_ethtool_set_wol(ndev->phydev, wol); ++} ++ ++static int ave_ethtool_set_wol(struct net_device *ndev, ++ struct ethtool_wolinfo *wol) ++{ ++ int ret; ++ ++ ret = __ave_ethtool_set_wol(ndev, wol); + if (!ret) + device_set_wakeup_enable(&ndev->dev, !!wol->wolopts); + +@@ -1216,7 +1222,7 @@ static int ave_init(struct net_device *ndev) + + /* set wol initial state disabled */ + wol.wolopts = 0; +- ave_ethtool_set_wol(ndev, &wol); ++ __ave_ethtool_set_wol(ndev, &wol); + + if (!phy_interface_is_rgmii(phydev)) + phy_set_max_speed(phydev, SPEED_100); +@@ -1768,7 +1774,7 @@ static int ave_resume(struct device *dev) + + ave_ethtool_get_wol(ndev, &wol); + wol.wolopts = priv->wolopts; +- ave_ethtool_set_wol(ndev, &wol); ++ __ave_ethtool_set_wol(ndev, &wol); + + if (ndev->phydev) { + ret = phy_resume(ndev->phydev); +diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h +index 912bbb6515b2..bc82cdf36cc3 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/common.h ++++ b/drivers/net/ethernet/stmicro/stmmac/common.h +@@ -364,9 +364,8 @@ struct dma_features { + unsigned int arpoffsel; + }; + +-/* GMAC TX FIFO is 8K, Rx FIFO is 16K */ +-#define BUF_SIZE_16KiB 16384 +-/* RX Buffer size must be < 8191 and multiple of 4/8/16 bytes */ ++/* RX Buffer size must be multiple of 4/8/16 bytes */ ++#define BUF_SIZE_16KiB 16368 + #define BUF_SIZE_8KiB 8188 + #define BUF_SIZE_4KiB 4096 + #define BUF_SIZE_2KiB 2048 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +index 903c5d8a226e..1b3520d0e59e 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -1108,7 +1108,9 @@ static int stmmac_set_bfsize(int mtu, int bufsize) + { + int ret = bufsize; + +- if (mtu >= BUF_SIZE_4KiB) ++ if (mtu >= BUF_SIZE_8KiB) ++ ret = BUF_SIZE_16KiB; ++ else if (mtu >= BUF_SIZE_4KiB) + ret = BUF_SIZE_8KiB; + else if (mtu >= BUF_SIZE_2KiB) + ret = BUF_SIZE_4KiB; +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +index a0513deab1a0..ba03a2d77434 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +@@ -80,7 +80,7 @@ static struct sk_buff *stmmac_test_get_udp_skb(struct stmmac_priv *priv, + if (attr->max_size && (attr->max_size > size)) + size = attr->max_size; + +- skb = netdev_alloc_skb_ip_align(priv->dev, size); ++ skb = netdev_alloc_skb(priv->dev, size); + if (!skb) + return NULL; + +@@ -244,6 +244,8 @@ static int stmmac_test_loopback_validate(struct sk_buff *skb, + struct net_device *orig_ndev) + { + struct stmmac_test_priv *tpriv = pt->af_packet_priv; ++ unsigned char *src = tpriv->packet->src; ++ unsigned char *dst = tpriv->packet->dst; + struct stmmachdr *shdr; + struct ethhdr *ehdr; + struct udphdr *uhdr; +@@ -260,15 +262,15 @@ static int stmmac_test_loopback_validate(struct sk_buff *skb, + goto out; + + ehdr = (struct ethhdr *)skb_mac_header(skb); +- if (tpriv->packet->dst) { +- if (!ether_addr_equal(ehdr->h_dest, tpriv->packet->dst)) ++ if (dst) { ++ if (!ether_addr_equal_unaligned(ehdr->h_dest, dst)) + goto out; + } + if (tpriv->packet->sarc) { +- if (!ether_addr_equal(ehdr->h_source, ehdr->h_dest)) ++ if (!ether_addr_equal_unaligned(ehdr->h_source, ehdr->h_dest)) + goto out; +- } else if (tpriv->packet->src) { +- if (!ether_addr_equal(ehdr->h_source, tpriv->packet->src)) ++ } else if (src) { ++ if (!ether_addr_equal_unaligned(ehdr->h_source, src)) + goto out; + } + +@@ -714,7 +716,7 @@ static int stmmac_test_flowctrl_validate(struct sk_buff *skb, + struct ethhdr *ehdr; + + ehdr = (struct ethhdr *)skb_mac_header(skb); +- if (!ether_addr_equal(ehdr->h_source, orig_ndev->dev_addr)) ++ if (!ether_addr_equal_unaligned(ehdr->h_source, orig_ndev->dev_addr)) + goto out; + if (ehdr->h_proto != htons(ETH_P_PAUSE)) + goto out; +@@ -851,12 +853,16 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb, + if (tpriv->vlan_id) { + if (skb->vlan_proto != htons(proto)) + goto out; +- if (skb->vlan_tci != tpriv->vlan_id) ++ if (skb->vlan_tci != tpriv->vlan_id) { ++ /* Means filter did not work. */ ++ tpriv->ok = false; ++ complete(&tpriv->comp); + goto out; ++ } + } + + ehdr = (struct ethhdr *)skb_mac_header(skb); +- if (!ether_addr_equal(ehdr->h_dest, tpriv->packet->dst)) ++ if (!ether_addr_equal_unaligned(ehdr->h_dest, tpriv->packet->dst)) + goto out; + + ihdr = ip_hdr(skb); +@@ -1291,16 +1297,19 @@ static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src, + struct stmmac_packet_attrs attr = { }; + struct flow_dissector *dissector; + struct flow_cls_offload *cls; ++ int ret, old_enable = 0; + struct flow_rule *rule; +- int ret; + + if (!tc_can_offload(priv->dev)) + return -EOPNOTSUPP; + if (!priv->dma_cap.l3l4fnum) + return -EOPNOTSUPP; +- if (priv->rss.enable) ++ if (priv->rss.enable) { ++ old_enable = priv->rss.enable; ++ priv->rss.enable = false; + stmmac_rss_configure(priv, priv->hw, NULL, + priv->plat->rx_queues_to_use); ++ } + + dissector = kzalloc(sizeof(*dissector), GFP_KERNEL); + if (!dissector) { +@@ -1367,7 +1376,8 @@ cleanup_cls: + cleanup_dissector: + kfree(dissector); + cleanup_rss: +- if (priv->rss.enable) { ++ if (old_enable) { ++ priv->rss.enable = old_enable; + stmmac_rss_configure(priv, priv->hw, &priv->rss, + priv->plat->rx_queues_to_use); + } +@@ -1412,16 +1422,19 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src, + struct stmmac_packet_attrs attr = { }; + struct flow_dissector *dissector; + struct flow_cls_offload *cls; ++ int ret, old_enable = 0; + struct flow_rule *rule; +- int ret; + + if (!tc_can_offload(priv->dev)) + return -EOPNOTSUPP; + if (!priv->dma_cap.l3l4fnum) + return -EOPNOTSUPP; +- if (priv->rss.enable) ++ if (priv->rss.enable) { ++ old_enable = priv->rss.enable; ++ priv->rss.enable = false; + stmmac_rss_configure(priv, priv->hw, NULL, + priv->plat->rx_queues_to_use); ++ } + + dissector = kzalloc(sizeof(*dissector), GFP_KERNEL); + if (!dissector) { +@@ -1493,7 +1506,8 @@ cleanup_cls: + cleanup_dissector: + kfree(dissector); + cleanup_rss: +- if (priv->rss.enable) { ++ if (old_enable) { ++ priv->rss.enable = old_enable; + stmmac_rss_configure(priv, priv->hw, &priv->rss, + priv->plat->rx_queues_to_use); + } +@@ -1546,7 +1560,7 @@ static int stmmac_test_arp_validate(struct sk_buff *skb, + struct arphdr *ahdr; + + ehdr = (struct ethhdr *)skb_mac_header(skb); +- if (!ether_addr_equal(ehdr->h_dest, tpriv->packet->src)) ++ if (!ether_addr_equal_unaligned(ehdr->h_dest, tpriv->packet->src)) + goto out; + + ahdr = arp_hdr(skb); +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +index f9a9a9d82233..1d135b02ea02 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +@@ -579,6 +579,10 @@ static int tc_setup_cls(struct stmmac_priv *priv, + { + int ret = 0; + ++ /* When RSS is enabled, the filtering will be bypassed */ ++ if (priv->rss.enable) ++ return -EBUSY; ++ + switch (cls->command) { + case FLOW_CLS_REPLACE: + ret = tc_add_flow(priv, cls); +diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c +index f81e58267a6e..b9e44bb22289 100644 +--- a/drivers/net/hyperv/rndis_filter.c ++++ b/drivers/net/hyperv/rndis_filter.c +@@ -1436,8 +1436,6 @@ void rndis_filter_device_remove(struct hv_device *dev, + /* Halt and release the rndis device */ + rndis_filter_halt_device(net_dev, rndis_dev); + +- net_dev->extension = NULL; +- + netvsc_device_remove(dev); + } + +diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c +index 747c0542a53c..c5bf61565726 100644 +--- a/drivers/net/macvlan.c ++++ b/drivers/net/macvlan.c +@@ -259,7 +259,7 @@ static void macvlan_broadcast(struct sk_buff *skb, + struct net_device *src, + enum macvlan_mode mode) + { +- const struct ethhdr *eth = skb_eth_hdr(skb); ++ const struct ethhdr *eth = eth_hdr(skb); + const struct macvlan_dev *vlan; + struct sk_buff *nskb; + unsigned int i; +@@ -513,10 +513,11 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev) + const struct macvlan_dev *dest; + + if (vlan->mode == MACVLAN_MODE_BRIDGE) { +- const struct ethhdr *eth = (void *)skb->data; ++ const struct ethhdr *eth = skb_eth_hdr(skb); + + /* send to other bridge ports directly */ + if (is_multicast_ether_addr(eth->h_dest)) { ++ skb_reset_mac_header(skb); + macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE); + goto xmit_world; + } +diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c +index cf4455bbf888..52e80434e45e 100644 +--- a/drivers/net/phy/dp83867.c ++++ b/drivers/net/phy/dp83867.c +@@ -80,6 +80,7 @@ + #define DP83867_PHYCR_FIFO_DEPTH_MAX 0x03 + #define DP83867_PHYCR_FIFO_DEPTH_MASK GENMASK(15, 14) + #define DP83867_PHYCR_RESERVED_MASK BIT(11) ++#define DP83867_PHYCR_FORCE_LINK_GOOD BIT(10) + + /* RGMIIDCTL bits */ + #define DP83867_RGMII_TX_CLK_DELAY_MAX 0xf +@@ -454,7 +455,12 @@ static int dp83867_phy_reset(struct phy_device *phydev) + + usleep_range(10, 20); + +- return 0; ++ /* After reset FORCE_LINK_GOOD bit is set. Although the ++ * default value should be unset. Disable FORCE_LINK_GOOD ++ * for the phy to work properly. ++ */ ++ return phy_modify(phydev, MII_DP83867_PHYCTRL, ++ DP83867_PHYCR_FORCE_LINK_GOOD, 0); + } + + static struct phy_driver dp83867_driver[] = { +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c +index 3e5f2f7a155e..c232f1612083 100644 +--- a/drivers/net/usb/lan78xx.c ++++ b/drivers/net/usb/lan78xx.c +@@ -3750,6 +3750,7 @@ static int lan78xx_probe(struct usb_interface *intf, + + /* MTU range: 68 - 9000 */ + netdev->max_mtu = MAX_SINGLE_PACKET_SIZE; ++ netif_set_gso_max_size(netdev, MAX_SINGLE_PACKET_SIZE - MAX_HEADER); + + dev->ep_blkin = (intf->cur_altsetting)->endpoint + 0; + dev->ep_blkout = (intf->cur_altsetting)->endpoint + 1; +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c +index b2507c59ba8b..9e4b7a400284 100644 +--- a/drivers/net/usb/r8152.c ++++ b/drivers/net/usb/r8152.c +@@ -5587,6 +5587,9 @@ static int rtl8152_probe(struct usb_interface *intf, + return -ENODEV; + } + ++ if (intf->cur_altsetting->desc.bNumEndpoints < 3) ++ return -ENODEV; ++ + usb_reset_device(udev); + netdev = alloc_etherdev(sizeof(struct r8152)); + if (!netdev) { +diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c +index ca0f3be2b6bf..aef7de225783 100644 +--- a/drivers/net/wan/fsl_ucc_hdlc.c ++++ b/drivers/net/wan/fsl_ucc_hdlc.c +@@ -73,7 +73,7 @@ static struct ucc_tdm_info utdm_primary_info = { + }, + }; + +-static struct ucc_tdm_info utdm_info[MAX_HDLC_NUM]; ++static struct ucc_tdm_info utdm_info[UCC_MAX_NUM]; + + static int uhdlc_init(struct ucc_hdlc_private *priv) + { +diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c +index d3d3f40de75e..47d199d2e7dc 100644 +--- a/drivers/net/wireless/realtek/rtw88/phy.c ++++ b/drivers/net/wireless/realtek/rtw88/phy.c +@@ -118,7 +118,7 @@ static void rtw_phy_cck_pd_init(struct rtw_dev *rtwdev) + + for (i = 0; i <= RTW_CHANNEL_WIDTH_40; i++) { + for (j = 0; j < RTW_RF_PATH_MAX; j++) +- dm_info->cck_pd_lv[i][j] = 0; ++ dm_info->cck_pd_lv[i][j] = CCK_PD_LV0; + } + + dm_info->cck_fa_avg = CCK_FA_AVG_RESET; +@@ -461,7 +461,6 @@ static void rtw_phy_dpk_track(struct rtw_dev *rtwdev) + chip->ops->dpk_track(rtwdev); + } + +-#define CCK_PD_LV_MAX 5 + #define CCK_PD_FA_LV1_MIN 1000 + #define CCK_PD_FA_LV0_MAX 500 + +@@ -471,10 +470,10 @@ static u8 rtw_phy_cck_pd_lv_unlink(struct rtw_dev *rtwdev) + u32 cck_fa_avg = dm_info->cck_fa_avg; + + if (cck_fa_avg > CCK_PD_FA_LV1_MIN) +- return 1; ++ return CCK_PD_LV1; + + if (cck_fa_avg < CCK_PD_FA_LV0_MAX) +- return 0; ++ return CCK_PD_LV0; + + return CCK_PD_LV_MAX; + } +@@ -494,15 +493,15 @@ static u8 rtw_phy_cck_pd_lv_link(struct rtw_dev *rtwdev) + u32 cck_fa_avg = dm_info->cck_fa_avg; + + if (igi > CCK_PD_IGI_LV4_VAL && rssi > CCK_PD_RSSI_LV4_VAL) +- return 4; ++ return CCK_PD_LV4; + if (igi > CCK_PD_IGI_LV3_VAL && rssi > CCK_PD_RSSI_LV3_VAL) +- return 3; ++ return CCK_PD_LV3; + if (igi > CCK_PD_IGI_LV2_VAL || rssi > CCK_PD_RSSI_LV2_VAL) +- return 2; ++ return CCK_PD_LV2; + if (cck_fa_avg > CCK_PD_FA_LV1_MIN) +- return 1; ++ return CCK_PD_LV1; + if (cck_fa_avg < CCK_PD_FA_LV0_MAX) +- return 0; ++ return CCK_PD_LV0; + + return CCK_PD_LV_MAX; + } +diff --git a/drivers/net/wireless/realtek/rtw88/phy.h b/drivers/net/wireless/realtek/rtw88/phy.h +index e79b084628e7..33a5eb9637c0 100644 +--- a/drivers/net/wireless/realtek/rtw88/phy.h ++++ b/drivers/net/wireless/realtek/rtw88/phy.h +@@ -125,6 +125,15 @@ rtw_get_tx_power_params(struct rtw_dev *rtwdev, u8 path, + u8 rate, u8 bw, u8 ch, u8 regd, + struct rtw_power_params *pwr_param); + ++enum rtw_phy_cck_pd_lv { ++ CCK_PD_LV0, ++ CCK_PD_LV1, ++ CCK_PD_LV2, ++ CCK_PD_LV3, ++ CCK_PD_LV4, ++ CCK_PD_LV_MAX, ++}; ++ + #define MASKBYTE0 0xff + #define MASKBYTE1 0xff00 + #define MASKBYTE2 0xff0000 +diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c +index c2f6cd76a658..de0505a6a365 100644 +--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c ++++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c +@@ -3168,8 +3168,8 @@ rtw8822c_phy_cck_pd_set_reg(struct rtw_dev *rtwdev, + static void rtw8822c_phy_cck_pd_set(struct rtw_dev *rtwdev, u8 new_lvl) + { + struct rtw_dm_info *dm_info = &rtwdev->dm_info; +- s8 pd_lvl[4] = {2, 4, 6, 8}; +- s8 cs_lvl[4] = {2, 2, 2, 4}; ++ s8 pd_lvl[CCK_PD_LV_MAX] = {0, 2, 4, 6, 8}; ++ s8 cs_lvl[CCK_PD_LV_MAX] = {0, 2, 2, 2, 4}; + u8 cur_lvl; + u8 nrx, bw; + +diff --git a/drivers/net/wireless/st/cw1200/fwio.c b/drivers/net/wireless/st/cw1200/fwio.c +index 6574e78e05ea..2a03dc533b6a 100644 +--- a/drivers/net/wireless/st/cw1200/fwio.c ++++ b/drivers/net/wireless/st/cw1200/fwio.c +@@ -320,12 +320,12 @@ int cw1200_load_firmware(struct cw1200_common *priv) + goto out; + } + +- priv->hw_type = cw1200_get_hw_type(val32, &major_revision); +- if (priv->hw_type < 0) { ++ ret = cw1200_get_hw_type(val32, &major_revision); ++ if (ret < 0) { + pr_err("Can't deduce hardware type.\n"); +- ret = -ENOTSUPP; + goto out; + } ++ priv->hw_type = ret; + + /* Set DPLL Reg value, and read back to confirm writes work */ + ret = cw1200_reg_write_32(priv, ST90TDS_TSET_GEN_R_W_REG_ID, +diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c +index e897e4d768ef..d7a355d05368 100644 +--- a/drivers/nfc/pn533/usb.c ++++ b/drivers/nfc/pn533/usb.c +@@ -391,7 +391,7 @@ static int pn533_acr122_poweron_rdr(struct pn533_usb_phy *phy) + cmd, sizeof(cmd), false); + + rc = usb_bulk_msg(phy->udev, phy->out_urb->pipe, buffer, sizeof(cmd), +- &transferred, 0); ++ &transferred, 5000); + kfree(buffer); + if (rc || (transferred != sizeof(cmd))) { + nfc_err(&phy->udev->dev, +diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c +index 61fafe0374ce..b84f16bbd6f2 100644 +--- a/drivers/ptp/ptp_clock.c ++++ b/drivers/ptp/ptp_clock.c +@@ -170,6 +170,7 @@ static void ptp_clock_release(struct device *dev) + { + struct ptp_clock *ptp = container_of(dev, struct ptp_clock, dev); + ++ ptp_cleanup_pin_groups(ptp); + mutex_destroy(&ptp->tsevq_mux); + mutex_destroy(&ptp->pincfg_mux); + ida_simple_remove(&ptp_clocks_map, ptp->index); +@@ -302,9 +303,8 @@ int ptp_clock_unregister(struct ptp_clock *ptp) + if (ptp->pps_source) + pps_unregister_source(ptp->pps_source); + +- ptp_cleanup_pin_groups(ptp); +- + posix_clock_unregister(&ptp->clock); ++ + return 0; + } + EXPORT_SYMBOL(ptp_clock_unregister); +diff --git a/drivers/reset/core.c b/drivers/reset/core.c +index f343bd814d32..76c0dc7f165d 100644 +--- a/drivers/reset/core.c ++++ b/drivers/reset/core.c +@@ -861,8 +861,7 @@ static int of_reset_control_get_count(struct device_node *node) + * @acquired: only one reset control may be acquired for a given controller + * and ID + * +- * Returns pointer to allocated reset_control_array on success or +- * error on failure ++ * Returns pointer to allocated reset_control on success or error on failure + */ + struct reset_control * + of_reset_control_array_get(struct device_node *np, bool shared, bool optional, +@@ -915,8 +914,7 @@ EXPORT_SYMBOL_GPL(of_reset_control_array_get); + * that just have to be asserted or deasserted, without any + * requirements on the order. + * +- * Returns pointer to allocated reset_control_array on success or +- * error on failure ++ * Returns pointer to allocated reset_control on success or error on failure + */ + struct reset_control * + devm_reset_control_array_get(struct device *dev, bool shared, bool optional) +diff --git a/drivers/s390/crypto/zcrypt_ccamisc.c b/drivers/s390/crypto/zcrypt_ccamisc.c +index c1db64a2db21..110fe9d0cb91 100644 +--- a/drivers/s390/crypto/zcrypt_ccamisc.c ++++ b/drivers/s390/crypto/zcrypt_ccamisc.c +@@ -1037,8 +1037,8 @@ static int _ip_cprb_helper(u16 cardnr, u16 domain, + prepparm = (struct iprepparm *) prepcblk->rpl_parmb; + + /* do some plausibility checks on the key block */ +- if (prepparm->kb.len < 120 + 5 * sizeof(uint16_t) || +- prepparm->kb.len > 136 + 5 * sizeof(uint16_t)) { ++ if (prepparm->kb.len < 120 + 3 * sizeof(uint16_t) || ++ prepparm->kb.len > 136 + 3 * sizeof(uint16_t)) { + DEBUG_ERR("%s reply with invalid or unknown key block\n", + __func__); + rc = -EIO; +diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c +index c5fa5f3b00e9..0b28d44d3573 100644 +--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c ++++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c +@@ -915,12 +915,12 @@ void bnx2i_free_hba(struct bnx2i_hba *hba) + INIT_LIST_HEAD(&hba->ep_ofld_list); + INIT_LIST_HEAD(&hba->ep_active_list); + INIT_LIST_HEAD(&hba->ep_destroy_list); +- pci_dev_put(hba->pcidev); + + if (hba->regview) { + pci_iounmap(hba->pcidev, hba->regview); + hba->regview = NULL; + } ++ pci_dev_put(hba->pcidev); + bnx2i_free_mp_bdt(hba); + bnx2i_release_free_cid_que(hba); + iscsi_host_free(shost); +diff --git a/drivers/scsi/esas2r/esas2r_flash.c b/drivers/scsi/esas2r/esas2r_flash.c +index 7bd376d95ed5..b02ac389e6c6 100644 +--- a/drivers/scsi/esas2r/esas2r_flash.c ++++ b/drivers/scsi/esas2r/esas2r_flash.c +@@ -1197,6 +1197,7 @@ bool esas2r_nvram_read_direct(struct esas2r_adapter *a) + if (!esas2r_read_flash_block(a, a->nvram, FLS_OFFSET_NVR, + sizeof(struct esas2r_sas_nvram))) { + esas2r_hdebug("NVRAM read failed, using defaults"); ++ up(&a->nvram_semaphore); + return false; + } + +diff --git a/drivers/scsi/fnic/vnic_dev.c b/drivers/scsi/fnic/vnic_dev.c +index 78af9cc2009b..522636e94628 100644 +--- a/drivers/scsi/fnic/vnic_dev.c ++++ b/drivers/scsi/fnic/vnic_dev.c +@@ -688,26 +688,26 @@ int vnic_dev_soft_reset_done(struct vnic_dev *vdev, int *done) + + int vnic_dev_hang_notify(struct vnic_dev *vdev) + { +- u64 a0, a1; ++ u64 a0 = 0, a1 = 0; + int wait = 1000; + return vnic_dev_cmd(vdev, CMD_HANG_NOTIFY, &a0, &a1, wait); + } + + int vnic_dev_mac_addr(struct vnic_dev *vdev, u8 *mac_addr) + { +- u64 a0, a1; ++ u64 a[2] = {}; + int wait = 1000; + int err, i; + + for (i = 0; i < ETH_ALEN; i++) + mac_addr[i] = 0; + +- err = vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a0, &a1, wait); ++ err = vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a[0], &a[1], wait); + if (err) + return err; + + for (i = 0; i < ETH_ALEN; i++) +- mac_addr[i] = ((u8 *)&a0)[i]; ++ mac_addr[i] = ((u8 *)&a)[i]; + + return 0; + } +@@ -732,30 +732,30 @@ void vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast, + + void vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr) + { +- u64 a0 = 0, a1 = 0; ++ u64 a[2] = {}; + int wait = 1000; + int err; + int i; + + for (i = 0; i < ETH_ALEN; i++) +- ((u8 *)&a0)[i] = addr[i]; ++ ((u8 *)&a)[i] = addr[i]; + +- err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait); ++ err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a[0], &a[1], wait); + if (err) + pr_err("Can't add addr [%pM], %d\n", addr, err); + } + + void vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr) + { +- u64 a0 = 0, a1 = 0; ++ u64 a[2] = {}; + int wait = 1000; + int err; + int i; + + for (i = 0; i < ETH_ALEN; i++) +- ((u8 *)&a0)[i] = addr[i]; ++ ((u8 *)&a)[i] = addr[i]; + +- err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait); ++ err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a[0], &a[1], wait); + if (err) + pr_err("Can't del addr [%pM], %d\n", addr, err); + } +diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c +index 633effb09c9c..849335d76cf6 100644 +--- a/drivers/scsi/hisi_sas/hisi_sas_main.c ++++ b/drivers/scsi/hisi_sas/hisi_sas_main.c +@@ -3719,9 +3719,6 @@ static int hisi_sas_debugfs_alloc(struct hisi_hba *hisi_hba) + int p, c, d; + size_t sz; + +- hisi_hba->debugfs_dump_dentry = +- debugfs_create_dir("dump", hisi_hba->debugfs_dir); +- + sz = hw->debugfs_reg_array[DEBUGFS_GLOBAL]->count * 4; + hisi_hba->debugfs_regs[DEBUGFS_GLOBAL] = + devm_kmalloc(dev, sz, GFP_KERNEL); +diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +index ef32ee12f606..723f51c822af 100644 +--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c ++++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +@@ -3022,11 +3022,6 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable) + hisi_sas_phy_write32(hisi_hba, phy_id, + SAS_PHY_BIST_CTRL, reg_val); + +- mdelay(100); +- reg_val |= (CFG_RX_BIST_EN_MSK | CFG_TX_BIST_EN_MSK); +- hisi_sas_phy_write32(hisi_hba, phy_id, +- SAS_PHY_BIST_CTRL, reg_val); +- + /* set the bist init value */ + hisi_sas_phy_write32(hisi_hba, phy_id, + SAS_PHY_BIST_CODE, +@@ -3035,6 +3030,11 @@ static int debugfs_set_bist_v3_hw(struct hisi_hba *hisi_hba, bool enable) + SAS_PHY_BIST_CODE1, + SAS_PHY_BIST_CODE1_INIT); + ++ mdelay(100); ++ reg_val |= (CFG_RX_BIST_EN_MSK | CFG_TX_BIST_EN_MSK); ++ hisi_sas_phy_write32(hisi_hba, phy_id, ++ SAS_PHY_BIST_CTRL, reg_val); ++ + /* clear error bit */ + mdelay(100); + hisi_sas_phy_read32(hisi_hba, phy_id, SAS_BIST_ERR_CNT); +@@ -3423,6 +3423,7 @@ static int hisi_sas_v3_resume(struct pci_dev *pdev) + if (rc) { + scsi_remove_host(shost); + pci_disable_device(pdev); ++ return rc; + } + hisi_hba->hw->phys_init(hisi_hba); + sas_resume_ha(sha); +diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c +index aa82d538a18a..40706cb842fd 100644 +--- a/drivers/scsi/lpfc/lpfc_scsi.c ++++ b/drivers/scsi/lpfc/lpfc_scsi.c +@@ -719,7 +719,7 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, + iocb->ulpLe = 1; + iocb->ulpClass = CLASS3; + +- if (lpfc_ndlp_check_qdepth(phba, ndlp)) { ++ if (lpfc_ndlp_check_qdepth(phba, ndlp) && lpfc_cmd) { + atomic_inc(&ndlp->cmd_pending); + lpfc_cmd->flags |= LPFC_SBUF_BUMP_QDEPTH; + } +diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c +index 8860f41af3ff..e2cec1f6e659 100644 +--- a/drivers/scsi/lpfc/lpfc_sli.c ++++ b/drivers/scsi/lpfc/lpfc_sli.c +@@ -20108,6 +20108,13 @@ void lpfc_release_io_buf(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_ncmd, + lpfc_ncmd->cur_iocbq.wqe_cmpl = NULL; + lpfc_ncmd->cur_iocbq.iocb_cmpl = NULL; + ++ if (phba->cfg_xpsgl && !phba->nvmet_support && ++ !list_empty(&lpfc_ncmd->dma_sgl_xtra_list)) ++ lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd); ++ ++ if (!list_empty(&lpfc_ncmd->dma_cmd_rsp_list)) ++ lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd); ++ + if (phba->cfg_xri_rebalancing) { + if (lpfc_ncmd->expedite) { + /* Return to expedite pool */ +@@ -20172,13 +20179,6 @@ void lpfc_release_io_buf(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_ncmd, + spin_unlock_irqrestore(&qp->io_buf_list_put_lock, + iflag); + } +- +- if (phba->cfg_xpsgl && !phba->nvmet_support && +- !list_empty(&lpfc_ncmd->dma_sgl_xtra_list)) +- lpfc_put_sgl_per_hdwq(phba, lpfc_ncmd); +- +- if (!list_empty(&lpfc_ncmd->dma_cmd_rsp_list)) +- lpfc_put_cmd_rsp_buf_per_hdwq(phba, lpfc_ncmd); + } + + /** +@@ -20414,8 +20414,9 @@ lpfc_get_sgl_per_hdwq(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_buf) + struct sli4_hybrid_sgl *allocated_sgl = NULL; + struct lpfc_sli4_hdw_queue *hdwq = lpfc_buf->hdwq; + struct list_head *buf_list = &hdwq->sgl_list; ++ unsigned long iflags; + +- spin_lock_irq(&hdwq->hdwq_lock); ++ spin_lock_irqsave(&hdwq->hdwq_lock, iflags); + + if (likely(!list_empty(buf_list))) { + /* break off 1 chunk from the sgl_list */ +@@ -20427,9 +20428,9 @@ lpfc_get_sgl_per_hdwq(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_buf) + } + } else { + /* allocate more */ +- spin_unlock_irq(&hdwq->hdwq_lock); ++ spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags); + tmp = kmalloc_node(sizeof(*tmp), GFP_ATOMIC, +- cpu_to_node(smp_processor_id())); ++ cpu_to_node(hdwq->io_wq->chann)); + if (!tmp) { + lpfc_printf_log(phba, KERN_INFO, LOG_SLI, + "8353 error kmalloc memory for HDWQ " +@@ -20449,7 +20450,7 @@ lpfc_get_sgl_per_hdwq(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_buf) + return NULL; + } + +- spin_lock_irq(&hdwq->hdwq_lock); ++ spin_lock_irqsave(&hdwq->hdwq_lock, iflags); + list_add_tail(&tmp->list_node, &lpfc_buf->dma_sgl_xtra_list); + } + +@@ -20457,7 +20458,7 @@ lpfc_get_sgl_per_hdwq(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_buf) + struct sli4_hybrid_sgl, + list_node); + +- spin_unlock_irq(&hdwq->hdwq_lock); ++ spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags); + + return allocated_sgl; + } +@@ -20481,8 +20482,9 @@ lpfc_put_sgl_per_hdwq(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_buf) + struct sli4_hybrid_sgl *tmp = NULL; + struct lpfc_sli4_hdw_queue *hdwq = lpfc_buf->hdwq; + struct list_head *buf_list = &hdwq->sgl_list; ++ unsigned long iflags; + +- spin_lock_irq(&hdwq->hdwq_lock); ++ spin_lock_irqsave(&hdwq->hdwq_lock, iflags); + + if (likely(!list_empty(&lpfc_buf->dma_sgl_xtra_list))) { + list_for_each_entry_safe(list_entry, tmp, +@@ -20495,7 +20497,7 @@ lpfc_put_sgl_per_hdwq(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_buf) + rc = -EINVAL; + } + +- spin_unlock_irq(&hdwq->hdwq_lock); ++ spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags); + return rc; + } + +@@ -20516,8 +20518,9 @@ lpfc_free_sgl_per_hdwq(struct lpfc_hba *phba, + struct list_head *buf_list = &hdwq->sgl_list; + struct sli4_hybrid_sgl *list_entry = NULL; + struct sli4_hybrid_sgl *tmp = NULL; ++ unsigned long iflags; + +- spin_lock_irq(&hdwq->hdwq_lock); ++ spin_lock_irqsave(&hdwq->hdwq_lock, iflags); + + /* Free sgl pool */ + list_for_each_entry_safe(list_entry, tmp, +@@ -20529,7 +20532,7 @@ lpfc_free_sgl_per_hdwq(struct lpfc_hba *phba, + kfree(list_entry); + } + +- spin_unlock_irq(&hdwq->hdwq_lock); ++ spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags); + } + + /** +@@ -20553,8 +20556,9 @@ lpfc_get_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba, + struct fcp_cmd_rsp_buf *allocated_buf = NULL; + struct lpfc_sli4_hdw_queue *hdwq = lpfc_buf->hdwq; + struct list_head *buf_list = &hdwq->cmd_rsp_buf_list; ++ unsigned long iflags; + +- spin_lock_irq(&hdwq->hdwq_lock); ++ spin_lock_irqsave(&hdwq->hdwq_lock, iflags); + + if (likely(!list_empty(buf_list))) { + /* break off 1 chunk from the list */ +@@ -20567,9 +20571,9 @@ lpfc_get_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba, + } + } else { + /* allocate more */ +- spin_unlock_irq(&hdwq->hdwq_lock); ++ spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags); + tmp = kmalloc_node(sizeof(*tmp), GFP_ATOMIC, +- cpu_to_node(smp_processor_id())); ++ cpu_to_node(hdwq->io_wq->chann)); + if (!tmp) { + lpfc_printf_log(phba, KERN_INFO, LOG_SLI, + "8355 error kmalloc memory for HDWQ " +@@ -20594,7 +20598,7 @@ lpfc_get_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba, + tmp->fcp_rsp = (struct fcp_rsp *)((uint8_t *)tmp->fcp_cmnd + + sizeof(struct fcp_cmnd)); + +- spin_lock_irq(&hdwq->hdwq_lock); ++ spin_lock_irqsave(&hdwq->hdwq_lock, iflags); + list_add_tail(&tmp->list_node, &lpfc_buf->dma_cmd_rsp_list); + } + +@@ -20602,7 +20606,7 @@ lpfc_get_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba, + struct fcp_cmd_rsp_buf, + list_node); + +- spin_unlock_irq(&hdwq->hdwq_lock); ++ spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags); + + return allocated_buf; + } +@@ -20627,8 +20631,9 @@ lpfc_put_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba, + struct fcp_cmd_rsp_buf *tmp = NULL; + struct lpfc_sli4_hdw_queue *hdwq = lpfc_buf->hdwq; + struct list_head *buf_list = &hdwq->cmd_rsp_buf_list; ++ unsigned long iflags; + +- spin_lock_irq(&hdwq->hdwq_lock); ++ spin_lock_irqsave(&hdwq->hdwq_lock, iflags); + + if (likely(!list_empty(&lpfc_buf->dma_cmd_rsp_list))) { + list_for_each_entry_safe(list_entry, tmp, +@@ -20641,7 +20646,7 @@ lpfc_put_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba, + rc = -EINVAL; + } + +- spin_unlock_irq(&hdwq->hdwq_lock); ++ spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags); + return rc; + } + +@@ -20662,8 +20667,9 @@ lpfc_free_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba, + struct list_head *buf_list = &hdwq->cmd_rsp_buf_list; + struct fcp_cmd_rsp_buf *list_entry = NULL; + struct fcp_cmd_rsp_buf *tmp = NULL; ++ unsigned long iflags; + +- spin_lock_irq(&hdwq->hdwq_lock); ++ spin_lock_irqsave(&hdwq->hdwq_lock, iflags); + + /* Free cmd_rsp buf pool */ + list_for_each_entry_safe(list_entry, tmp, +@@ -20676,5 +20682,5 @@ lpfc_free_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba, + kfree(list_entry); + } + +- spin_unlock_irq(&hdwq->hdwq_lock); ++ spin_unlock_irqrestore(&hdwq->hdwq_lock, iflags); + } +diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c +index 80f276d67c14..9ffaa920fc8f 100644 +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -5891,8 +5891,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha) + if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) + break; + +- if ((fcport->flags & FCF_FABRIC_DEVICE) == 0 || +- (fcport->flags & FCF_LOGIN_NEEDED) == 0) ++ if ((fcport->flags & FCF_FABRIC_DEVICE) == 0) + continue; + + if (fcport->scan_state == QLA_FCPORT_SCAN) { +@@ -5915,7 +5914,8 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha) + } + } + +- if (fcport->scan_state == QLA_FCPORT_FOUND) ++ if (fcport->scan_state == QLA_FCPORT_FOUND && ++ (fcport->flags & FCF_LOGIN_NEEDED) != 0) + qla24xx_fcport_handle_login(vha, fcport); + } + return (rval); +diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c +index b3766b1879e3..7c5f2736ebee 100644 +--- a/drivers/scsi/qla2xxx/qla_isr.c ++++ b/drivers/scsi/qla2xxx/qla_isr.c +@@ -3625,7 +3625,7 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp) + skip_msix: + + ql_log(ql_log_info, vha, 0x0037, +- "Falling back-to MSI mode -%d.\n", ret); ++ "Falling back-to MSI mode -- ret=%d.\n", ret); + + if (!IS_QLA24XX(ha) && !IS_QLA2532(ha) && !IS_QLA8432(ha) && + !IS_QLA8001(ha) && !IS_P3P_TYPE(ha) && !IS_QLAFX00(ha) && +@@ -3633,13 +3633,13 @@ skip_msix: + goto skip_msi; + + ret = pci_alloc_irq_vectors(ha->pdev, 1, 1, PCI_IRQ_MSI); +- if (!ret) { ++ if (ret > 0) { + ql_dbg(ql_dbg_init, vha, 0x0038, + "MSI: Enabled.\n"); + ha->flags.msi_enabled = 1; + } else + ql_log(ql_log_warn, vha, 0x0039, +- "Falling back-to INTa mode -- %d.\n", ret); ++ "Falling back-to INTa mode -- ret=%d.\n", ret); + skip_msi: + + /* Skip INTx on ISP82xx. */ +diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c +index dac9a7013208..02636b4785c5 100644 +--- a/drivers/scsi/qla4xxx/ql4_mbx.c ++++ b/drivers/scsi/qla4xxx/ql4_mbx.c +@@ -640,9 +640,6 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha) + + if (qla4xxx_get_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma) != + QLA_SUCCESS) { +- dma_free_coherent(&ha->pdev->dev, +- sizeof(struct addr_ctrl_blk), +- init_fw_cb, init_fw_cb_dma); + goto exit_init_fw_cb; + } + +diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c +index 07a2425ffa2c..ac35c301c792 100644 +--- a/drivers/scsi/scsi_trace.c ++++ b/drivers/scsi/scsi_trace.c +@@ -9,7 +9,7 @@ + #include + + #define SERVICE_ACTION16(cdb) (cdb[1] & 0x1f) +-#define SERVICE_ACTION32(cdb) ((cdb[8] << 8) | cdb[9]) ++#define SERVICE_ACTION32(cdb) (get_unaligned_be16(&cdb[8])) + + static const char * + scsi_trace_misc(struct trace_seq *, unsigned char *, int); +@@ -39,17 +39,12 @@ static const char * + scsi_trace_rw10(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- sector_t lba = 0, txlen = 0; ++ u32 lba, txlen; + +- lba |= (cdb[2] << 24); +- lba |= (cdb[3] << 16); +- lba |= (cdb[4] << 8); +- lba |= cdb[5]; +- txlen |= (cdb[7] << 8); +- txlen |= cdb[8]; ++ lba = get_unaligned_be32(&cdb[2]); ++ txlen = get_unaligned_be16(&cdb[7]); + +- trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u", +- (unsigned long long)lba, (unsigned long long)txlen, ++ trace_seq_printf(p, "lba=%u txlen=%u protect=%u", lba, txlen, + cdb[1] >> 5); + + if (cdb[0] == WRITE_SAME) +@@ -64,19 +59,12 @@ static const char * + scsi_trace_rw12(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- sector_t lba = 0, txlen = 0; +- +- lba |= (cdb[2] << 24); +- lba |= (cdb[3] << 16); +- lba |= (cdb[4] << 8); +- lba |= cdb[5]; +- txlen |= (cdb[6] << 24); +- txlen |= (cdb[7] << 16); +- txlen |= (cdb[8] << 8); +- txlen |= cdb[9]; +- +- trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u", +- (unsigned long long)lba, (unsigned long long)txlen, ++ u32 lba, txlen; ++ ++ lba = get_unaligned_be32(&cdb[2]); ++ txlen = get_unaligned_be32(&cdb[6]); ++ ++ trace_seq_printf(p, "lba=%u txlen=%u protect=%u", lba, txlen, + cdb[1] >> 5); + trace_seq_putc(p, 0); + +@@ -87,23 +75,13 @@ static const char * + scsi_trace_rw16(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- sector_t lba = 0, txlen = 0; +- +- lba |= ((u64)cdb[2] << 56); +- lba |= ((u64)cdb[3] << 48); +- lba |= ((u64)cdb[4] << 40); +- lba |= ((u64)cdb[5] << 32); +- lba |= (cdb[6] << 24); +- lba |= (cdb[7] << 16); +- lba |= (cdb[8] << 8); +- lba |= cdb[9]; +- txlen |= (cdb[10] << 24); +- txlen |= (cdb[11] << 16); +- txlen |= (cdb[12] << 8); +- txlen |= cdb[13]; +- +- trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u", +- (unsigned long long)lba, (unsigned long long)txlen, ++ u64 lba; ++ u32 txlen; ++ ++ lba = get_unaligned_be64(&cdb[2]); ++ txlen = get_unaligned_be32(&cdb[10]); ++ ++ trace_seq_printf(p, "lba=%llu txlen=%u protect=%u", lba, txlen, + cdb[1] >> 5); + + if (cdb[0] == WRITE_SAME_16) +@@ -118,8 +96,8 @@ static const char * + scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p), *cmd; +- sector_t lba = 0, txlen = 0; +- u32 ei_lbrt = 0; ++ u64 lba; ++ u32 ei_lbrt, txlen; + + switch (SERVICE_ACTION32(cdb)) { + case READ_32: +@@ -139,26 +117,12 @@ scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len) + goto out; + } + +- lba |= ((u64)cdb[12] << 56); +- lba |= ((u64)cdb[13] << 48); +- lba |= ((u64)cdb[14] << 40); +- lba |= ((u64)cdb[15] << 32); +- lba |= (cdb[16] << 24); +- lba |= (cdb[17] << 16); +- lba |= (cdb[18] << 8); +- lba |= cdb[19]; +- ei_lbrt |= (cdb[20] << 24); +- ei_lbrt |= (cdb[21] << 16); +- ei_lbrt |= (cdb[22] << 8); +- ei_lbrt |= cdb[23]; +- txlen |= (cdb[28] << 24); +- txlen |= (cdb[29] << 16); +- txlen |= (cdb[30] << 8); +- txlen |= cdb[31]; +- +- trace_seq_printf(p, "%s_32 lba=%llu txlen=%llu protect=%u ei_lbrt=%u", +- cmd, (unsigned long long)lba, +- (unsigned long long)txlen, cdb[10] >> 5, ei_lbrt); ++ lba = get_unaligned_be64(&cdb[12]); ++ ei_lbrt = get_unaligned_be32(&cdb[20]); ++ txlen = get_unaligned_be32(&cdb[28]); ++ ++ trace_seq_printf(p, "%s_32 lba=%llu txlen=%u protect=%u ei_lbrt=%u", ++ cmd, lba, txlen, cdb[10] >> 5, ei_lbrt); + + if (SERVICE_ACTION32(cdb) == WRITE_SAME_32) + trace_seq_printf(p, " unmap=%u", cdb[10] >> 3 & 1); +@@ -173,7 +137,7 @@ static const char * + scsi_trace_unmap(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- unsigned int regions = cdb[7] << 8 | cdb[8]; ++ unsigned int regions = get_unaligned_be16(&cdb[7]); + + trace_seq_printf(p, "regions=%u", (regions - 8) / 16); + trace_seq_putc(p, 0); +@@ -185,8 +149,8 @@ static const char * + scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p), *cmd; +- sector_t lba = 0; +- u32 alloc_len = 0; ++ u64 lba; ++ u32 alloc_len; + + switch (SERVICE_ACTION16(cdb)) { + case SAI_READ_CAPACITY_16: +@@ -200,21 +164,10 @@ scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len) + goto out; + } + +- lba |= ((u64)cdb[2] << 56); +- lba |= ((u64)cdb[3] << 48); +- lba |= ((u64)cdb[4] << 40); +- lba |= ((u64)cdb[5] << 32); +- lba |= (cdb[6] << 24); +- lba |= (cdb[7] << 16); +- lba |= (cdb[8] << 8); +- lba |= cdb[9]; +- alloc_len |= (cdb[10] << 24); +- alloc_len |= (cdb[11] << 16); +- alloc_len |= (cdb[12] << 8); +- alloc_len |= cdb[13]; +- +- trace_seq_printf(p, "%s lba=%llu alloc_len=%u", cmd, +- (unsigned long long)lba, alloc_len); ++ lba = get_unaligned_be64(&cdb[2]); ++ alloc_len = get_unaligned_be32(&cdb[10]); ++ ++ trace_seq_printf(p, "%s lba=%llu alloc_len=%u", cmd, lba, alloc_len); + + out: + trace_seq_putc(p, 0); +diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c +index ef138c57e2a6..182fd25c7c43 100644 +--- a/drivers/scsi/scsi_transport_sas.c ++++ b/drivers/scsi/scsi_transport_sas.c +@@ -1391,9 +1391,6 @@ static void sas_expander_release(struct device *dev) + struct sas_rphy *rphy = dev_to_rphy(dev); + struct sas_expander_device *edev = rphy_to_expander_device(rphy); + +- if (rphy->q) +- blk_cleanup_queue(rphy->q); +- + put_device(dev->parent); + kfree(edev); + } +@@ -1403,9 +1400,6 @@ static void sas_end_device_release(struct device *dev) + struct sas_rphy *rphy = dev_to_rphy(dev); + struct sas_end_device *edev = rphy_to_end_device(rphy); + +- if (rphy->q) +- blk_cleanup_queue(rphy->q); +- + put_device(dev->parent); + kfree(edev); + } +@@ -1634,8 +1628,7 @@ sas_rphy_remove(struct sas_rphy *rphy) + } + + sas_rphy_unlink(rphy); +- if (rphy->q) +- bsg_unregister_queue(rphy->q); ++ bsg_remove_queue(rphy->q); + transport_remove_device(dev); + device_del(dev); + } +diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c +index 542d2bac2922..5087ed6afbdc 100644 +--- a/drivers/scsi/storvsc_drv.c ++++ b/drivers/scsi/storvsc_drv.c +@@ -1835,9 +1835,11 @@ static int storvsc_probe(struct hv_device *device, + */ + host->sg_tablesize = (stor_device->max_transfer_bytes >> PAGE_SHIFT); + /* ++ * For non-IDE disks, the host supports multiple channels. + * Set the number of HW queues we are supporting. + */ +- host->nr_hw_queues = num_present_cpus(); ++ if (!dev_is_ide) ++ host->nr_hw_queues = num_present_cpus(); + + /* + * Set the error handler work queue. +diff --git a/drivers/soc/amlogic/meson-ee-pwrc.c b/drivers/soc/amlogic/meson-ee-pwrc.c +index 5823f5b67d16..3f0261d53ad9 100644 +--- a/drivers/soc/amlogic/meson-ee-pwrc.c ++++ b/drivers/soc/amlogic/meson-ee-pwrc.c +@@ -323,6 +323,8 @@ static int meson_ee_pwrc_init_domain(struct platform_device *pdev, + struct meson_ee_pwrc *pwrc, + struct meson_ee_pwrc_domain *dom) + { ++ int ret; ++ + dom->pwrc = pwrc; + dom->num_rstc = dom->desc.reset_names_count; + dom->num_clks = dom->desc.clk_names_count; +@@ -368,15 +370,21 @@ static int meson_ee_pwrc_init_domain(struct platform_device *pdev, + * prepare/enable counters won't be in sync. + */ + if (dom->num_clks && dom->desc.get_power && !dom->desc.get_power(dom)) { +- int ret = clk_bulk_prepare_enable(dom->num_clks, dom->clks); ++ ret = clk_bulk_prepare_enable(dom->num_clks, dom->clks); + if (ret) + return ret; + +- pm_genpd_init(&dom->base, &pm_domain_always_on_gov, false); +- } else +- pm_genpd_init(&dom->base, NULL, +- (dom->desc.get_power ? +- dom->desc.get_power(dom) : true)); ++ ret = pm_genpd_init(&dom->base, &pm_domain_always_on_gov, ++ false); ++ if (ret) ++ return ret; ++ } else { ++ ret = pm_genpd_init(&dom->base, NULL, ++ (dom->desc.get_power ? ++ dom->desc.get_power(dom) : true)); ++ if (ret) ++ return ret; ++ } + + return 0; + } +@@ -441,9 +449,7 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev) + pwrc->xlate.domains[i] = &dom->base; + } + +- of_genpd_add_provider_onecell(pdev->dev.of_node, &pwrc->xlate); +- +- return 0; ++ return of_genpd_add_provider_onecell(pdev->dev.of_node, &pwrc->xlate); + } + + static void meson_ee_pwrc_shutdown(struct platform_device *pdev) +diff --git a/drivers/staging/comedi/drivers/ni_routes.c b/drivers/staging/comedi/drivers/ni_routes.c +index eb61494dc2bd..88beb0d6c42b 100644 +--- a/drivers/staging/comedi/drivers/ni_routes.c ++++ b/drivers/staging/comedi/drivers/ni_routes.c +@@ -74,9 +74,6 @@ static int ni_find_device_routes(const char *device_family, + } + } + +- if (!rv) +- return -ENODATA; +- + /* Second, find the set of routes valid for this device. */ + for (i = 0; ni_device_routes_list[i]; ++i) { + if (memcmp(ni_device_routes_list[i]->device, board_name, +@@ -86,12 +83,12 @@ static int ni_find_device_routes(const char *device_family, + } + } + +- if (!dr) +- return -ENODATA; +- + tables->route_values = rv; + tables->valid_routes = dr; + ++ if (!rv || !dr) ++ return -ENODATA; ++ + return 0; + } + +@@ -489,6 +486,9 @@ int ni_find_route_source(const u8 src_sel_reg_value, int dest, + { + int src; + ++ if (!tables->route_values) ++ return -EINVAL; ++ + dest = B(dest); /* subtract NI names offset */ + /* ensure we are not going to under/over run the route value table */ + if (dest < 0 || dest >= NI_NUM_NAMES) +diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c +index 3c79411c4cd0..6b4b354c88aa 100644 +--- a/drivers/target/target_core_fabric_lib.c ++++ b/drivers/target/target_core_fabric_lib.c +@@ -118,7 +118,7 @@ static int srp_get_pr_transport_id( + memset(buf + 8, 0, leading_zero_bytes); + rc = hex2bin(buf + 8 + leading_zero_bytes, p, count); + if (rc < 0) { +- pr_debug("hex2bin failed for %s: %d\n", __func__, rc); ++ pr_debug("hex2bin failed for %s: %d\n", p, rc); + return rc; + } + +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index 8b23162e4239..4ac74b354801 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -1191,6 +1191,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) + * PORT_OVER_CURRENT is not. So check for any of them. + */ + if (udev || (portstatus & USB_PORT_STAT_CONNECTION) || ++ (portchange & USB_PORT_STAT_C_CONNECTION) || + (portstatus & USB_PORT_STAT_OVERCURRENT) || + (portchange & USB_PORT_STAT_C_OVERCURRENT)) + set_bit(port1, hub->change_bits); +diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c +index 3bb1fff02bed..955ab97b9b22 100644 +--- a/drivers/usb/serial/ch341.c ++++ b/drivers/usb/serial/ch341.c +@@ -589,9 +589,13 @@ static int ch341_tiocmget(struct tty_struct *tty) + static int ch341_reset_resume(struct usb_serial *serial) + { + struct usb_serial_port *port = serial->port[0]; +- struct ch341_private *priv = usb_get_serial_port_data(port); ++ struct ch341_private *priv; + int ret; + ++ priv = usb_get_serial_port_data(port); ++ if (!priv) ++ return 0; ++ + /* reconfigure ch341 serial port after bus-reset */ + ch341_configure(serial->dev, priv); + +diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c +index 9690a5f4b9d6..5737add6a2a4 100644 +--- a/drivers/usb/serial/io_edgeport.c ++++ b/drivers/usb/serial/io_edgeport.c +@@ -716,7 +716,7 @@ static void edge_interrupt_callback(struct urb *urb) + if (txCredits) { + port = edge_serial->serial->port[portNumber]; + edge_port = usb_get_serial_port_data(port); +- if (edge_port->open) { ++ if (edge_port && edge_port->open) { + spin_lock_irqsave(&edge_port->ep_lock, + flags); + edge_port->txCredits += txCredits; +@@ -1725,7 +1725,8 @@ static void edge_break(struct tty_struct *tty, int break_state) + static void process_rcvd_data(struct edgeport_serial *edge_serial, + unsigned char *buffer, __u16 bufferLength) + { +- struct device *dev = &edge_serial->serial->dev->dev; ++ struct usb_serial *serial = edge_serial->serial; ++ struct device *dev = &serial->dev->dev; + struct usb_serial_port *port; + struct edgeport_port *edge_port; + __u16 lastBufferLength; +@@ -1821,11 +1822,10 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial, + + /* spit this data back into the tty driver if this + port is open */ +- if (rxLen) { +- port = edge_serial->serial->port[ +- edge_serial->rxPort]; ++ if (rxLen && edge_serial->rxPort < serial->num_ports) { ++ port = serial->port[edge_serial->rxPort]; + edge_port = usb_get_serial_port_data(port); +- if (edge_port->open) { ++ if (edge_port && edge_port->open) { + dev_dbg(dev, "%s - Sending %d bytes to TTY for port %d\n", + __func__, rxLen, + edge_serial->rxPort); +@@ -1833,8 +1833,8 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial, + rxLen); + edge_port->port->icount.rx += rxLen; + } +- buffer += rxLen; + } ++ buffer += rxLen; + break; + + case EXPECT_HDR3: /* Expect 3rd byte of status header */ +@@ -1869,6 +1869,8 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial, + __u8 code = edge_serial->rxStatusCode; + + /* switch the port pointer to the one being currently talked about */ ++ if (edge_serial->rxPort >= edge_serial->serial->num_ports) ++ return; + port = edge_serial->serial->port[edge_serial->rxPort]; + edge_port = usb_get_serial_port_data(port); + if (edge_port == NULL) { +diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c +index e66a59ef43a1..aa3dbce22cfb 100644 +--- a/drivers/usb/serial/keyspan.c ++++ b/drivers/usb/serial/keyspan.c +@@ -1058,6 +1058,8 @@ static void usa49_glocont_callback(struct urb *urb) + for (i = 0; i < serial->num_ports; ++i) { + port = serial->port[i]; + p_priv = usb_get_serial_port_data(port); ++ if (!p_priv) ++ continue; + + if (p_priv->resend_cont) { + dev_dbg(&port->dev, "%s - sending setup\n", __func__); +@@ -1459,6 +1461,8 @@ static void usa67_glocont_callback(struct urb *urb) + for (i = 0; i < serial->num_ports; ++i) { + port = serial->port[i]; + p_priv = usb_get_serial_port_data(port); ++ if (!p_priv) ++ continue; + + if (p_priv->resend_cont) { + dev_dbg(&port->dev, "%s - sending setup\n", __func__); +diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c +index cb7aac9cd9e7..ed2b4e6dca38 100644 +--- a/drivers/usb/serial/opticon.c ++++ b/drivers/usb/serial/opticon.c +@@ -113,7 +113,7 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype, + retval = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), + requesttype, + USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, +- 0, 0, buffer, 1, 0); ++ 0, 0, buffer, 1, USB_CTRL_SET_TIMEOUT); + kfree(buffer); + + if (retval < 0) +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c +index 2d919d0e6e45..084cc2fff3ae 100644 +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -248,6 +248,7 @@ static void option_instat_callback(struct urb *urb); + #define QUECTEL_PRODUCT_BG96 0x0296 + #define QUECTEL_PRODUCT_EP06 0x0306 + #define QUECTEL_PRODUCT_EM12 0x0512 ++#define QUECTEL_PRODUCT_RM500Q 0x0800 + + #define CMOTECH_VENDOR_ID 0x16d8 + #define CMOTECH_PRODUCT_6001 0x6001 +@@ -1104,6 +1105,11 @@ static const struct usb_device_id option_ids[] = { + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0xff, 0xff), + .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0, 0) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x30) }, ++ { 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(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003), +diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c +index a62981ca7a73..f93b81a297d6 100644 +--- a/drivers/usb/serial/quatech2.c ++++ b/drivers/usb/serial/quatech2.c +@@ -841,7 +841,10 @@ static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch) + u8 newMSR = (u8) *ch; + unsigned long flags; + ++ /* May be called from qt2_process_read_urb() for an unbound port. */ + port_priv = usb_get_serial_port_data(port); ++ if (!port_priv) ++ return; + + spin_lock_irqsave(&port_priv->lock, flags); + port_priv->shadowMSR = newMSR; +@@ -869,7 +872,10 @@ static void qt2_update_lsr(struct usb_serial_port *port, unsigned char *ch) + unsigned long flags; + u8 newLSR = (u8) *ch; + ++ /* May be called from qt2_process_read_urb() for an unbound port. */ + port_priv = usb_get_serial_port_data(port); ++ if (!port_priv) ++ return; + + if (newLSR & UART_LSR_BI) + newLSR &= (u8) (UART_LSR_OE | UART_LSR_BI); +diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c +index edbbb13d6de6..bd23a7cb1be2 100644 +--- a/drivers/usb/serial/usb-serial-simple.c ++++ b/drivers/usb/serial/usb-serial-simple.c +@@ -86,6 +86,8 @@ DEVICE(moto_modem, MOTO_IDS); + #define MOTOROLA_TETRA_IDS() \ + { USB_DEVICE(0x0cad, 0x9011) }, /* Motorola Solutions TETRA PEI */ \ + { USB_DEVICE(0x0cad, 0x9012) }, /* MTP6550 */ \ ++ { USB_DEVICE(0x0cad, 0x9013) }, /* MTP3xxx */ \ ++ { USB_DEVICE(0x0cad, 0x9015) }, /* MTP85xx */ \ + { USB_DEVICE(0x0cad, 0x9016) } /* TPG2200 */ + DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS); + +diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c +index 8f066bb55d7d..dc7a65b9ec98 100644 +--- a/drivers/usb/serial/usb-serial.c ++++ b/drivers/usb/serial/usb-serial.c +@@ -1317,6 +1317,9 @@ static int usb_serial_register(struct usb_serial_driver *driver) + return -EINVAL; + } + ++ /* Prevent individual ports from being unbound. */ ++ driver->driver.suppress_bind_attrs = true; ++ + usb_serial_operations_init(driver); + + /* Add this device to our list of devices */ +diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c +index 0b2758961b1c..6f0568fb5899 100644 +--- a/fs/btrfs/inode.c ++++ b/fs/btrfs/inode.c +@@ -4215,18 +4215,30 @@ out: + } + + static int btrfs_unlink_subvol(struct btrfs_trans_handle *trans, +- struct inode *dir, u64 objectid, +- const char *name, int name_len) ++ struct inode *dir, struct dentry *dentry) + { + struct btrfs_root *root = BTRFS_I(dir)->root; ++ struct btrfs_inode *inode = BTRFS_I(d_inode(dentry)); + struct btrfs_path *path; + struct extent_buffer *leaf; + struct btrfs_dir_item *di; + struct btrfs_key key; ++ const char *name = dentry->d_name.name; ++ int name_len = dentry->d_name.len; + u64 index; + int ret; ++ u64 objectid; + u64 dir_ino = btrfs_ino(BTRFS_I(dir)); + ++ if (btrfs_ino(inode) == BTRFS_FIRST_FREE_OBJECTID) { ++ objectid = inode->root->root_key.objectid; ++ } else if (btrfs_ino(inode) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID) { ++ objectid = inode->location.objectid; ++ } else { ++ WARN_ON(1); ++ return -EINVAL; ++ } ++ + path = btrfs_alloc_path(); + if (!path) + return -ENOMEM; +@@ -4248,13 +4260,16 @@ static int btrfs_unlink_subvol(struct btrfs_trans_handle *trans, + } + btrfs_release_path(path); + +- ret = btrfs_del_root_ref(trans, objectid, root->root_key.objectid, +- dir_ino, &index, name, name_len); +- if (ret < 0) { +- if (ret != -ENOENT) { +- btrfs_abort_transaction(trans, ret); +- goto out; +- } ++ /* ++ * This is a placeholder inode for a subvolume we didn't have a ++ * reference to at the time of the snapshot creation. In the meantime ++ * we could have renamed the real subvol link into our snapshot, so ++ * depending on btrfs_del_root_ref to return -ENOENT here is incorret. ++ * Instead simply lookup the dir_index_item for this entry so we can ++ * remove it. Otherwise we know we have a ref to the root and we can ++ * call btrfs_del_root_ref, and it _shouldn't_ fail. ++ */ ++ if (btrfs_ino(inode) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID) { + di = btrfs_search_dir_index_item(root, path, dir_ino, + name, name_len); + if (IS_ERR_OR_NULL(di)) { +@@ -4269,8 +4284,16 @@ static int btrfs_unlink_subvol(struct btrfs_trans_handle *trans, + leaf = path->nodes[0]; + btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); + index = key.offset; ++ btrfs_release_path(path); ++ } else { ++ ret = btrfs_del_root_ref(trans, objectid, ++ root->root_key.objectid, dir_ino, ++ &index, name, name_len); ++ if (ret) { ++ btrfs_abort_transaction(trans, ret); ++ goto out; ++ } + } +- btrfs_release_path(path); + + ret = btrfs_delete_delayed_dir_index(trans, BTRFS_I(dir), index); + if (ret) { +@@ -4464,8 +4487,7 @@ int btrfs_delete_subvolume(struct inode *dir, struct dentry *dentry) + + btrfs_record_snapshot_destroy(trans, BTRFS_I(dir)); + +- ret = btrfs_unlink_subvol(trans, dir, dest->root_key.objectid, +- dentry->d_name.name, dentry->d_name.len); ++ ret = btrfs_unlink_subvol(trans, dir, dentry); + if (ret) { + err = ret; + btrfs_abort_transaction(trans, ret); +@@ -4560,10 +4582,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) + return PTR_ERR(trans); + + if (unlikely(btrfs_ino(BTRFS_I(inode)) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) { +- err = btrfs_unlink_subvol(trans, dir, +- BTRFS_I(inode)->location.objectid, +- dentry->d_name.name, +- dentry->d_name.len); ++ err = btrfs_unlink_subvol(trans, dir, dentry); + goto out; + } + +@@ -9519,7 +9538,6 @@ static int btrfs_rename_exchange(struct inode *old_dir, + u64 new_ino = btrfs_ino(BTRFS_I(new_inode)); + u64 old_idx = 0; + u64 new_idx = 0; +- u64 root_objectid; + int ret; + bool root_log_pinned = false; + bool dest_log_pinned = false; +@@ -9625,10 +9643,7 @@ static int btrfs_rename_exchange(struct inode *old_dir, + + /* src is a subvolume */ + if (old_ino == BTRFS_FIRST_FREE_OBJECTID) { +- root_objectid = BTRFS_I(old_inode)->root->root_key.objectid; +- ret = btrfs_unlink_subvol(trans, old_dir, root_objectid, +- old_dentry->d_name.name, +- old_dentry->d_name.len); ++ ret = btrfs_unlink_subvol(trans, old_dir, old_dentry); + } else { /* src is an inode */ + ret = __btrfs_unlink_inode(trans, root, BTRFS_I(old_dir), + BTRFS_I(old_dentry->d_inode), +@@ -9644,10 +9659,7 @@ static int btrfs_rename_exchange(struct inode *old_dir, + + /* dest is a subvolume */ + if (new_ino == BTRFS_FIRST_FREE_OBJECTID) { +- root_objectid = BTRFS_I(new_inode)->root->root_key.objectid; +- ret = btrfs_unlink_subvol(trans, new_dir, root_objectid, +- new_dentry->d_name.name, +- new_dentry->d_name.len); ++ ret = btrfs_unlink_subvol(trans, new_dir, new_dentry); + } else { /* dest is an inode */ + ret = __btrfs_unlink_inode(trans, dest, BTRFS_I(new_dir), + BTRFS_I(new_dentry->d_inode), +@@ -9845,7 +9857,6 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, + struct inode *new_inode = d_inode(new_dentry); + struct inode *old_inode = d_inode(old_dentry); + u64 index = 0; +- u64 root_objectid; + int ret; + u64 old_ino = btrfs_ino(BTRFS_I(old_inode)); + bool log_pinned = false; +@@ -9953,10 +9964,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, + BTRFS_I(old_inode), 1); + + if (unlikely(old_ino == BTRFS_FIRST_FREE_OBJECTID)) { +- root_objectid = BTRFS_I(old_inode)->root->root_key.objectid; +- ret = btrfs_unlink_subvol(trans, old_dir, root_objectid, +- old_dentry->d_name.name, +- old_dentry->d_name.len); ++ ret = btrfs_unlink_subvol(trans, old_dir, old_dentry); + } else { + ret = __btrfs_unlink_inode(trans, root, BTRFS_I(old_dir), + BTRFS_I(d_inode(old_dentry)), +@@ -9975,10 +9983,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, + new_inode->i_ctime = current_time(new_inode); + if (unlikely(btrfs_ino(BTRFS_I(new_inode)) == + BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) { +- root_objectid = BTRFS_I(new_inode)->location.objectid; +- ret = btrfs_unlink_subvol(trans, new_dir, root_objectid, +- new_dentry->d_name.name, +- new_dentry->d_name.len); ++ ret = btrfs_unlink_subvol(trans, new_dir, new_dentry); + BUG_ON(new_inode->i_nlink == 0); + } else { + ret = btrfs_unlink_inode(trans, dest, BTRFS_I(new_dir), +diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c +index 5720e450a46f..8e86b2d700c4 100644 +--- a/fs/btrfs/ioctl.c ++++ b/fs/btrfs/ioctl.c +@@ -4254,7 +4254,19 @@ static long btrfs_ioctl_scrub(struct file *file, void __user *arg) + &sa->progress, sa->flags & BTRFS_SCRUB_READONLY, + 0); + +- if (ret == 0 && copy_to_user(arg, sa, sizeof(*sa))) ++ /* ++ * Copy scrub args to user space even if btrfs_scrub_dev() returned an ++ * error. This is important as it allows user space to know how much ++ * progress scrub has done. For example, if scrub is canceled we get ++ * -ECANCELED from btrfs_scrub_dev() and return that error back to user ++ * space. Later user space can inspect the progress from the structure ++ * btrfs_ioctl_scrub_args and resume scrub from where it left off ++ * previously (btrfs-progs does this). ++ * If we fail to copy the btrfs_ioctl_scrub_args structure to user space ++ * then return -EFAULT to signal the structure was not copied or it may ++ * be corrupt and unreliable due to a partial copy. ++ */ ++ if (copy_to_user(arg, sa, sizeof(*sa))) + ret = -EFAULT; + + if (!(sa->flags & BTRFS_SCRUB_READONLY)) +diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c +index aeb5f2f3cdd7..50517221638a 100644 +--- a/fs/btrfs/qgroup.c ++++ b/fs/btrfs/qgroup.c +@@ -2423,8 +2423,12 @@ int btrfs_qgroup_account_extent(struct btrfs_trans_handle *trans, u64 bytenr, + u64 nr_old_roots = 0; + int ret = 0; + ++ /* ++ * If quotas get disabled meanwhile, the resouces need to be freed and ++ * we can't just exit here. ++ */ + if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) +- return 0; ++ goto out_free; + + if (new_roots) { + if (!maybe_fs_roots(new_roots)) +diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c +index fd0f4c1696c8..bc1d7f144ace 100644 +--- a/fs/btrfs/relocation.c ++++ b/fs/btrfs/relocation.c +@@ -517,6 +517,34 @@ static int update_backref_cache(struct btrfs_trans_handle *trans, + return 1; + } + ++static bool reloc_root_is_dead(struct btrfs_root *root) ++{ ++ /* ++ * Pair with set_bit/clear_bit in clean_dirty_subvols and ++ * btrfs_update_reloc_root. We need to see the updated bit before ++ * trying to access reloc_root ++ */ ++ smp_rmb(); ++ if (test_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state)) ++ return true; ++ return false; ++} ++ ++/* ++ * Check if this subvolume tree has valid reloc tree. ++ * ++ * Reloc tree after swap is considered dead, thus not considered as valid. ++ * This is enough for most callers, as they don't distinguish dead reloc root ++ * from no reloc root. But should_ignore_root() below is a special case. ++ */ ++static bool have_reloc_root(struct btrfs_root *root) ++{ ++ if (reloc_root_is_dead(root)) ++ return false; ++ if (!root->reloc_root) ++ return false; ++ return true; ++} + + static int should_ignore_root(struct btrfs_root *root) + { +@@ -525,6 +553,10 @@ static int should_ignore_root(struct btrfs_root *root) + if (!test_bit(BTRFS_ROOT_REF_COWS, &root->state)) + return 0; + ++ /* This root has been merged with its reloc tree, we can ignore it */ ++ if (reloc_root_is_dead(root)) ++ return 1; ++ + reloc_root = root->reloc_root; + if (!reloc_root) + return 0; +@@ -1439,7 +1471,7 @@ int btrfs_init_reloc_root(struct btrfs_trans_handle *trans, + * The subvolume has reloc tree but the swap is finished, no need to + * create/update the dead reloc tree + */ +- if (test_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state)) ++ if (reloc_root_is_dead(root)) + return 0; + + if (root->reloc_root) { +@@ -1478,8 +1510,7 @@ int btrfs_update_reloc_root(struct btrfs_trans_handle *trans, + struct btrfs_root_item *root_item; + int ret; + +- if (test_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state) || +- !root->reloc_root) ++ if (!have_reloc_root(root)) + goto out; + + reloc_root = root->reloc_root; +@@ -1489,6 +1520,11 @@ int btrfs_update_reloc_root(struct btrfs_trans_handle *trans, + if (fs_info->reloc_ctl->merge_reloc_tree && + btrfs_root_refs(root_item) == 0) { + set_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state); ++ /* ++ * Mark the tree as dead before we change reloc_root so ++ * have_reloc_root will not touch it from now on. ++ */ ++ smp_wmb(); + __del_reloc_root(reloc_root); + } + +@@ -2202,6 +2238,11 @@ static int clean_dirty_subvols(struct reloc_control *rc) + if (ret2 < 0 && !ret) + ret = ret2; + } ++ /* ++ * Need barrier to ensure clear_bit() only happens after ++ * root->reloc_root = NULL. Pairs with have_reloc_root. ++ */ ++ smp_wmb(); + clear_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state); + btrfs_put_fs_root(root); + } else { +@@ -4721,7 +4762,7 @@ void btrfs_reloc_pre_snapshot(struct btrfs_pending_snapshot *pending, + struct btrfs_root *root = pending->root; + struct reloc_control *rc = root->fs_info->reloc_ctl; + +- if (!root->reloc_root || !rc) ++ if (!rc || !have_reloc_root(root)) + return; + + if (!rc->merge_reloc_tree) +@@ -4755,7 +4796,7 @@ int btrfs_reloc_post_snapshot(struct btrfs_trans_handle *trans, + struct reloc_control *rc = root->fs_info->reloc_ctl; + int ret; + +- if (!root->reloc_root || !rc) ++ if (!rc || !have_reloc_root(root)) + return 0; + + rc = root->fs_info->reloc_ctl; +diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c +index 3b17b647d002..612411c74550 100644 +--- a/fs/btrfs/root-tree.c ++++ b/fs/btrfs/root-tree.c +@@ -376,11 +376,13 @@ again: + leaf = path->nodes[0]; + ref = btrfs_item_ptr(leaf, path->slots[0], + struct btrfs_root_ref); +- +- WARN_ON(btrfs_root_ref_dirid(leaf, ref) != dirid); +- WARN_ON(btrfs_root_ref_name_len(leaf, ref) != name_len); + ptr = (unsigned long)(ref + 1); +- WARN_ON(memcmp_extent_buffer(leaf, name, ptr, name_len)); ++ if ((btrfs_root_ref_dirid(leaf, ref) != dirid) || ++ (btrfs_root_ref_name_len(leaf, ref) != name_len) || ++ memcmp_extent_buffer(leaf, name, ptr, name_len)) { ++ err = -ENOENT; ++ goto out; ++ } + *sequence = btrfs_root_ref_sequence(leaf, ref); + + ret = btrfs_del_item(trans, tree_root, path); +diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c +index d8d7b1ee83ca..97f1ba7c18b2 100644 +--- a/fs/btrfs/volumes.c ++++ b/fs/btrfs/volumes.c +@@ -4066,7 +4066,11 @@ int btrfs_balance(struct btrfs_fs_info *fs_info, + } + } + +- num_devices = btrfs_num_devices(fs_info); ++ /* ++ * rw_devices will not change at the moment, device add/delete/replace ++ * are excluded by EXCL_OP ++ */ ++ num_devices = fs_info->fs_devices->rw_devices; + + /* + * SINGLE profile on-disk has no profile bit, but in-memory we have a +diff --git a/fs/fuse/file.c b/fs/fuse/file.c +index a63d779eac10..ce715380143c 100644 +--- a/fs/fuse/file.c ++++ b/fs/fuse/file.c +@@ -882,6 +882,7 @@ static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file) + struct fuse_args_pages *ap = &ia->ap; + loff_t pos = page_offset(ap->pages[0]); + size_t count = ap->num_pages << PAGE_SHIFT; ++ ssize_t res; + int err; + + ap->args.out_pages = true; +@@ -896,7 +897,8 @@ static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file) + if (!err) + return; + } else { +- err = fuse_simple_request(fc, &ap->args); ++ res = fuse_simple_request(fc, &ap->args); ++ err = res < 0 ? res : 0; + } + fuse_readpages_end(fc, &ap->args, err); + } +diff --git a/fs/io_uring.c b/fs/io_uring.c +index 709671faaed6..b1c9ad1fb9e1 100644 +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -3716,6 +3716,12 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, + wake_up(&ctx->sqo_wait); + submitted = to_submit; + } else if (to_submit) { ++ if (current->mm != ctx->sqo_mm || ++ current_cred() != ctx->creds) { ++ ret = -EPERM; ++ goto out; ++ } ++ + to_submit = min(to_submit, ctx->sq_entries); + + mutex_lock(&ctx->uring_lock); +diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c +index 62b40df36c98..28b241cd6987 100644 +--- a/fs/reiserfs/xattr.c ++++ b/fs/reiserfs/xattr.c +@@ -319,8 +319,12 @@ static int reiserfs_for_each_xattr(struct inode *inode, + out_dir: + dput(dir); + out: +- /* -ENODATA isn't an error */ +- if (err == -ENODATA) ++ /* ++ * -ENODATA: this object doesn't have any xattrs ++ * -EOPNOTSUPP: this file system doesn't have xattrs enabled on disk. ++ * Neither are errors ++ */ ++ if (err == -ENODATA || err == -EOPNOTSUPP) + err = 0; + return err; + } +diff --git a/include/dt-bindings/reset/amlogic,meson8b-reset.h b/include/dt-bindings/reset/amlogic,meson8b-reset.h +index c614438bcbdb..fbc524a900da 100644 +--- a/include/dt-bindings/reset/amlogic,meson8b-reset.h ++++ b/include/dt-bindings/reset/amlogic,meson8b-reset.h +@@ -46,9 +46,9 @@ + #define RESET_VD_RMEM 64 + #define RESET_AUDIN 65 + #define RESET_DBLK 66 +-#define RESET_PIC_DC 66 +-#define RESET_PSC 66 +-#define RESET_NAND 66 ++#define RESET_PIC_DC 67 ++#define RESET_PSC 68 ++#define RESET_NAND 69 + #define RESET_GE2D 70 + #define RESET_PARSER_REG 71 + #define RESET_PARSER_FETCH 72 +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h +index f3ea78b0c91c..51ccb4b8770a 100644 +--- a/include/linux/blkdev.h ++++ b/include/linux/blkdev.h +@@ -328,6 +328,7 @@ struct queue_limits { + unsigned int max_sectors; + unsigned int max_segment_size; + unsigned int physical_block_size; ++ unsigned int logical_block_size; + unsigned int alignment_offset; + unsigned int io_min; + unsigned int io_opt; +@@ -338,7 +339,6 @@ struct queue_limits { + unsigned int discard_granularity; + unsigned int discard_alignment; + +- unsigned short logical_block_size; + unsigned short max_segments; + unsigned short max_integrity_segments; + unsigned short max_discard_segments; +@@ -1080,7 +1080,7 @@ extern void blk_queue_max_write_same_sectors(struct request_queue *q, + unsigned int max_write_same_sectors); + extern void blk_queue_max_write_zeroes_sectors(struct request_queue *q, + unsigned int max_write_same_sectors); +-extern void blk_queue_logical_block_size(struct request_queue *, unsigned short); ++extern void blk_queue_logical_block_size(struct request_queue *, unsigned int); + extern void blk_queue_physical_block_size(struct request_queue *, unsigned int); + extern void blk_queue_alignment_offset(struct request_queue *q, + unsigned int alignment); +@@ -1294,7 +1294,7 @@ static inline unsigned int queue_max_segment_size(const struct request_queue *q) + return q->limits.max_segment_size; + } + +-static inline unsigned short queue_logical_block_size(const struct request_queue *q) ++static inline unsigned queue_logical_block_size(const struct request_queue *q) + { + int retval = 512; + +@@ -1304,7 +1304,7 @@ static inline unsigned short queue_logical_block_size(const struct request_queue + return retval; + } + +-static inline unsigned short bdev_logical_block_size(struct block_device *bdev) ++static inline unsigned int bdev_logical_block_size(struct block_device *bdev) + { + return queue_logical_block_size(bdev_get_queue(bdev)); + } +diff --git a/include/linux/mm.h b/include/linux/mm.h +index a2adf95b3f9c..b249d2e033aa 100644 +--- a/include/linux/mm.h ++++ b/include/linux/mm.h +@@ -2666,13 +2666,25 @@ static inline bool want_init_on_free(void) + !page_poisoning_enabled(); + } + +-#ifdef CONFIG_DEBUG_PAGEALLOC_ENABLE_DEFAULT +-DECLARE_STATIC_KEY_TRUE(_debug_pagealloc_enabled); ++#ifdef CONFIG_DEBUG_PAGEALLOC ++extern void init_debug_pagealloc(void); + #else +-DECLARE_STATIC_KEY_FALSE(_debug_pagealloc_enabled); ++static inline void init_debug_pagealloc(void) {} + #endif ++extern bool _debug_pagealloc_enabled_early; ++DECLARE_STATIC_KEY_FALSE(_debug_pagealloc_enabled); + + static inline bool debug_pagealloc_enabled(void) ++{ ++ return IS_ENABLED(CONFIG_DEBUG_PAGEALLOC) && ++ _debug_pagealloc_enabled_early; ++} ++ ++/* ++ * For use in fast paths after init_debug_pagealloc() has run, or when a ++ * false negative result is not harmful when called too early. ++ */ ++static inline bool debug_pagealloc_enabled_static(void) + { + if (!IS_ENABLED(CONFIG_DEBUG_PAGEALLOC)) + return false; +diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h +index bda20282746b..8b5f758942a2 100644 +--- a/include/linux/mmzone.h ++++ b/include/linux/mmzone.h +@@ -215,9 +215,8 @@ enum node_stat_item { + NR_INACTIVE_FILE, /* " " " " " */ + NR_ACTIVE_FILE, /* " " " " " */ + NR_UNEVICTABLE, /* " " " " " */ +- NR_SLAB_RECLAIMABLE, /* Please do not reorder this item */ +- NR_SLAB_UNRECLAIMABLE, /* and this one without looking at +- * memcg_flush_percpu_vmstats() first. */ ++ NR_SLAB_RECLAIMABLE, ++ NR_SLAB_UNRECLAIMABLE, + NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */ + NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */ + WORKINGSET_NODES, +diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h +index 76d952aeb0fc..13f09706033a 100644 +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -1761,7 +1761,7 @@ enum netdev_priv_flags { + * for hardware timestamping + * @sfp_bus: attached &struct sfp_bus structure. + * @qdisc_tx_busylock_key: lockdep class annotating Qdisc->busylock +- spinlock ++ * spinlock + * @qdisc_running_key: lockdep class annotating Qdisc->running seqcount + * @qdisc_xmit_lock_key: lockdep class annotating + * netdev_queue->_xmit_lock spinlock +diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h +index 505e94a6e3e8..3ab1ddf151a2 100644 +--- a/include/linux/regulator/ab8500.h ++++ b/include/linux/regulator/ab8500.h +@@ -42,8 +42,6 @@ enum ab8505_regulator_id { + AB8505_LDO_ANAMIC2, + AB8505_LDO_AUX8, + AB8505_LDO_ANA, +- AB8505_SYSCLKREQ_2, +- AB8505_SYSCLKREQ_4, + AB8505_NUM_REGULATORS, + }; + +diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h +index da4caff7efa4..7eb6a8754f19 100644 +--- a/include/linux/skmsg.h ++++ b/include/linux/skmsg.h +@@ -354,17 +354,22 @@ static inline void sk_psock_update_proto(struct sock *sk, + static inline void sk_psock_restore_proto(struct sock *sk, + struct sk_psock *psock) + { +- sk->sk_write_space = psock->saved_write_space; ++ sk->sk_prot->unhash = psock->saved_unhash; + + if (psock->sk_proto) { + struct inet_connection_sock *icsk = inet_csk(sk); + bool has_ulp = !!icsk->icsk_ulp_data; + +- if (has_ulp) +- tcp_update_ulp(sk, psock->sk_proto); +- else ++ if (has_ulp) { ++ tcp_update_ulp(sk, psock->sk_proto, ++ psock->saved_write_space); ++ } else { + sk->sk_prot = psock->sk_proto; ++ sk->sk_write_space = psock->saved_write_space; ++ } + psock->sk_proto = NULL; ++ } else { ++ sk->sk_write_space = psock->saved_write_space; + } + } + +diff --git a/include/linux/tnum.h b/include/linux/tnum.h +index c17af77f3fae..ea627d1ab7e3 100644 +--- a/include/linux/tnum.h ++++ b/include/linux/tnum.h +@@ -30,7 +30,7 @@ struct tnum tnum_lshift(struct tnum a, u8 shift); + /* Shift (rsh) a tnum right (by a fixed shift) */ + struct tnum tnum_rshift(struct tnum a, u8 shift); + /* Shift (arsh) a tnum right (by a fixed min_shift) */ +-struct tnum tnum_arshift(struct tnum a, u8 min_shift); ++struct tnum tnum_arshift(struct tnum a, u8 min_shift, u8 insn_bitness); + /* Add two tnums, return @a + @b */ + struct tnum tnum_add(struct tnum a, struct tnum b); + /* Subtract two tnums, return @a - @b */ +diff --git a/include/net/tcp.h b/include/net/tcp.h +index b2367cfe0bda..830c89db1245 100644 +--- a/include/net/tcp.h ++++ b/include/net/tcp.h +@@ -2132,7 +2132,8 @@ struct tcp_ulp_ops { + /* initialize ulp */ + int (*init)(struct sock *sk); + /* update ulp */ +- void (*update)(struct sock *sk, struct proto *p); ++ void (*update)(struct sock *sk, struct proto *p, ++ void (*write_space)(struct sock *sk)); + /* cleanup ulp */ + void (*release)(struct sock *sk); + /* diagnostic */ +@@ -2147,7 +2148,8 @@ void tcp_unregister_ulp(struct tcp_ulp_ops *type); + int tcp_set_ulp(struct sock *sk, const char *name); + void tcp_get_available_ulp(char *buf, size_t len); + void tcp_cleanup_ulp(struct sock *sk); +-void tcp_update_ulp(struct sock *sk, struct proto *p); ++void tcp_update_ulp(struct sock *sk, struct proto *p, ++ void (*write_space)(struct sock *sk)); + + #define MODULE_ALIAS_TCP_ULP(name) \ + __MODULE_INFO(alias, alias_userspace, name); \ +diff --git a/include/trace/events/huge_memory.h b/include/trace/events/huge_memory.h +index dd4db334bd63..d82a0f4e824d 100644 +--- a/include/trace/events/huge_memory.h ++++ b/include/trace/events/huge_memory.h +@@ -31,7 +31,8 @@ + EM( SCAN_ALLOC_HUGE_PAGE_FAIL, "alloc_huge_page_failed") \ + EM( SCAN_CGROUP_CHARGE_FAIL, "ccgroup_charge_failed") \ + EM( SCAN_EXCEED_SWAP_PTE, "exceed_swap_pte") \ +- EMe(SCAN_TRUNCATED, "truncated") \ ++ EM( SCAN_TRUNCATED, "truncated") \ ++ EMe(SCAN_PAGE_HAS_PRIVATE, "page_has_private") \ + + #undef EM + #undef EMe +diff --git a/init/main.c b/init/main.c +index 91f6ebb30ef0..c0206c507eba 100644 +--- a/init/main.c ++++ b/init/main.c +@@ -553,6 +553,7 @@ static void __init mm_init(void) + * bigger than MAX_ORDER unless SPARSEMEM. + */ + page_ext_init_flatmem(); ++ init_debug_pagealloc(); + report_meminit(); + mem_init(); + kmem_cache_init(); +diff --git a/kernel/bpf/tnum.c b/kernel/bpf/tnum.c +index ca52b9642943..d4f335a9a899 100644 +--- a/kernel/bpf/tnum.c ++++ b/kernel/bpf/tnum.c +@@ -44,14 +44,19 @@ struct tnum tnum_rshift(struct tnum a, u8 shift) + return TNUM(a.value >> shift, a.mask >> shift); + } + +-struct tnum tnum_arshift(struct tnum a, u8 min_shift) ++struct tnum tnum_arshift(struct tnum a, u8 min_shift, u8 insn_bitness) + { + /* if a.value is negative, arithmetic shifting by minimum shift + * will have larger negative offset compared to more shifting. + * If a.value is nonnegative, arithmetic shifting by minimum shift + * will have larger positive offset compare to more shifting. + */ +- return TNUM((s64)a.value >> min_shift, (s64)a.mask >> min_shift); ++ if (insn_bitness == 32) ++ return TNUM((u32)(((s32)a.value) >> min_shift), ++ (u32)(((s32)a.mask) >> min_shift)); ++ else ++ return TNUM((s64)a.value >> min_shift, ++ (s64)a.mask >> min_shift); + } + + struct tnum tnum_add(struct tnum a, struct tnum b) +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c +index 9c74c98f6501..b2817d0929b3 100644 +--- a/kernel/bpf/verifier.c ++++ b/kernel/bpf/verifier.c +@@ -4824,9 +4824,16 @@ static int adjust_scalar_min_max_vals(struct bpf_verifier_env *env, + /* Upon reaching here, src_known is true and + * umax_val is equal to umin_val. + */ +- dst_reg->smin_value >>= umin_val; +- dst_reg->smax_value >>= umin_val; +- dst_reg->var_off = tnum_arshift(dst_reg->var_off, umin_val); ++ if (insn_bitness == 32) { ++ dst_reg->smin_value = (u32)(((s32)dst_reg->smin_value) >> umin_val); ++ dst_reg->smax_value = (u32)(((s32)dst_reg->smax_value) >> umin_val); ++ } else { ++ dst_reg->smin_value >>= umin_val; ++ dst_reg->smax_value >>= umin_val; ++ } ++ ++ dst_reg->var_off = tnum_arshift(dst_reg->var_off, umin_val, ++ insn_bitness); + + /* blow away the dst_reg umin_value/umax_value and rely on + * dst_reg var_off to refine the result. +diff --git a/kernel/cpu.c b/kernel/cpu.c +index e2cad3ee2ead..116825437cd6 100644 +--- a/kernel/cpu.c ++++ b/kernel/cpu.c +@@ -1909,6 +1909,78 @@ void __cpuhp_remove_state(enum cpuhp_state state, bool invoke) + } + EXPORT_SYMBOL(__cpuhp_remove_state); + ++#ifdef CONFIG_HOTPLUG_SMT ++static void cpuhp_offline_cpu_device(unsigned int cpu) ++{ ++ struct device *dev = get_cpu_device(cpu); ++ ++ dev->offline = true; ++ /* Tell user space about the state change */ ++ kobject_uevent(&dev->kobj, KOBJ_OFFLINE); ++} ++ ++static void cpuhp_online_cpu_device(unsigned int cpu) ++{ ++ struct device *dev = get_cpu_device(cpu); ++ ++ dev->offline = false; ++ /* Tell user space about the state change */ ++ kobject_uevent(&dev->kobj, KOBJ_ONLINE); ++} ++ ++int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) ++{ ++ int cpu, ret = 0; ++ ++ cpu_maps_update_begin(); ++ for_each_online_cpu(cpu) { ++ if (topology_is_primary_thread(cpu)) ++ continue; ++ ret = cpu_down_maps_locked(cpu, CPUHP_OFFLINE); ++ if (ret) ++ break; ++ /* ++ * As this needs to hold the cpu maps lock it's impossible ++ * to call device_offline() because that ends up calling ++ * cpu_down() which takes cpu maps lock. cpu maps lock ++ * needs to be held as this might race against in kernel ++ * abusers of the hotplug machinery (thermal management). ++ * ++ * So nothing would update device:offline state. That would ++ * leave the sysfs entry stale and prevent onlining after ++ * smt control has been changed to 'off' again. This is ++ * called under the sysfs hotplug lock, so it is properly ++ * serialized against the regular offline usage. ++ */ ++ cpuhp_offline_cpu_device(cpu); ++ } ++ if (!ret) ++ cpu_smt_control = ctrlval; ++ cpu_maps_update_done(); ++ return ret; ++} ++ ++int cpuhp_smt_enable(void) ++{ ++ int cpu, ret = 0; ++ ++ cpu_maps_update_begin(); ++ cpu_smt_control = CPU_SMT_ENABLED; ++ for_each_present_cpu(cpu) { ++ /* Skip online CPUs and CPUs on offline nodes */ ++ if (cpu_online(cpu) || !node_online(cpu_to_node(cpu))) ++ continue; ++ ret = _cpu_up(cpu, 0, CPUHP_ONLINE); ++ if (ret) ++ break; ++ /* See comment in cpuhp_smt_disable() */ ++ cpuhp_online_cpu_device(cpu); ++ } ++ cpu_maps_update_done(); ++ return ret; ++} ++#endif ++ + #if defined(CONFIG_SYSFS) && defined(CONFIG_HOTPLUG_CPU) + static ssize_t show_cpuhp_state(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -2063,77 +2135,6 @@ static const struct attribute_group cpuhp_cpu_root_attr_group = { + + #ifdef CONFIG_HOTPLUG_SMT + +-static void cpuhp_offline_cpu_device(unsigned int cpu) +-{ +- struct device *dev = get_cpu_device(cpu); +- +- dev->offline = true; +- /* Tell user space about the state change */ +- kobject_uevent(&dev->kobj, KOBJ_OFFLINE); +-} +- +-static void cpuhp_online_cpu_device(unsigned int cpu) +-{ +- struct device *dev = get_cpu_device(cpu); +- +- dev->offline = false; +- /* Tell user space about the state change */ +- kobject_uevent(&dev->kobj, KOBJ_ONLINE); +-} +- +-int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) +-{ +- int cpu, ret = 0; +- +- cpu_maps_update_begin(); +- for_each_online_cpu(cpu) { +- if (topology_is_primary_thread(cpu)) +- continue; +- ret = cpu_down_maps_locked(cpu, CPUHP_OFFLINE); +- if (ret) +- break; +- /* +- * As this needs to hold the cpu maps lock it's impossible +- * to call device_offline() because that ends up calling +- * cpu_down() which takes cpu maps lock. cpu maps lock +- * needs to be held as this might race against in kernel +- * abusers of the hotplug machinery (thermal management). +- * +- * So nothing would update device:offline state. That would +- * leave the sysfs entry stale and prevent onlining after +- * smt control has been changed to 'off' again. This is +- * called under the sysfs hotplug lock, so it is properly +- * serialized against the regular offline usage. +- */ +- cpuhp_offline_cpu_device(cpu); +- } +- if (!ret) +- cpu_smt_control = ctrlval; +- cpu_maps_update_done(); +- return ret; +-} +- +-int cpuhp_smt_enable(void) +-{ +- int cpu, ret = 0; +- +- cpu_maps_update_begin(); +- cpu_smt_control = CPU_SMT_ENABLED; +- for_each_present_cpu(cpu) { +- /* Skip online CPUs and CPUs on offline nodes */ +- if (cpu_online(cpu) || !node_online(cpu_to_node(cpu))) +- continue; +- ret = _cpu_up(cpu, 0, CPUHP_ONLINE); +- if (ret) +- break; +- /* See comment in cpuhp_smt_disable() */ +- cpuhp_online_cpu_device(cpu); +- } +- cpu_maps_update_done(); +- return ret; +-} +- +- + static ssize_t + __store_smt_control(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +diff --git a/kernel/events/core.c b/kernel/events/core.c +index 8f66a4833ded..6c829e22bad3 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -11182,8 +11182,10 @@ SYSCALL_DEFINE5(perf_event_open, + } + } + +- if (event->attr.aux_output && !perf_get_aux_event(event, group_leader)) ++ if (event->attr.aux_output && !perf_get_aux_event(event, group_leader)) { ++ err = -EINVAL; + goto err_locked; ++ } + + /* + * Must be under the same ctx::mutex as perf_install_in_context(), +diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c +index 233459c03b5a..35d3b6925b1e 100644 +--- a/kernel/locking/lockdep.c ++++ b/kernel/locking/lockdep.c +@@ -482,7 +482,7 @@ static struct lock_trace *save_trace(void) + struct lock_trace *trace, *t2; + struct hlist_head *hash_head; + u32 hash; +- unsigned int max_entries; ++ int max_entries; + + BUILD_BUG_ON_NOT_POWER_OF_2(STACK_TRACE_HASH_SIZE); + BUILD_BUG_ON(LOCK_TRACE_SIZE_IN_LONGS >= MAX_STACK_TRACE_ENTRIES); +@@ -490,10 +490,8 @@ static struct lock_trace *save_trace(void) + trace = (struct lock_trace *)(stack_trace + nr_stack_trace_entries); + max_entries = MAX_STACK_TRACE_ENTRIES - nr_stack_trace_entries - + LOCK_TRACE_SIZE_IN_LONGS; +- trace->nr_entries = stack_trace_save(trace->entries, max_entries, 3); + +- if (nr_stack_trace_entries >= MAX_STACK_TRACE_ENTRIES - +- LOCK_TRACE_SIZE_IN_LONGS - 1) { ++ if (max_entries <= 0) { + if (!debug_locks_off_graph_unlock()) + return NULL; + +@@ -502,6 +500,7 @@ static struct lock_trace *save_trace(void) + + return NULL; + } ++ trace->nr_entries = stack_trace_save(trace->entries, max_entries, 3); + + hash = jhash(trace->entries, trace->nr_entries * + sizeof(trace->entries[0]), 0); +diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c +index eef04551eae7..baafa1dd9fcc 100644 +--- a/kernel/locking/rwsem.c ++++ b/kernel/locking/rwsem.c +@@ -1226,8 +1226,8 @@ wait: + * In this case, we attempt to acquire the lock again + * without sleeping. + */ +- if ((wstate == WRITER_HANDOFF) && +- (rwsem_spin_on_owner(sem, 0) == OWNER_NULL)) ++ if (wstate == WRITER_HANDOFF && ++ rwsem_spin_on_owner(sem, RWSEM_NONSPINNABLE) == OWNER_NULL) + goto trylock_again; + + /* Block until there are no active lockers. */ +diff --git a/kernel/ptrace.c b/kernel/ptrace.c +index cb9ddcc08119..43d6179508d6 100644 +--- a/kernel/ptrace.c ++++ b/kernel/ptrace.c +@@ -264,12 +264,17 @@ static int ptrace_check_attach(struct task_struct *child, bool ignore_state) + return ret; + } + +-static int ptrace_has_cap(struct user_namespace *ns, unsigned int mode) ++static bool ptrace_has_cap(const struct cred *cred, struct user_namespace *ns, ++ unsigned int mode) + { ++ int ret; ++ + if (mode & PTRACE_MODE_NOAUDIT) +- return has_ns_capability_noaudit(current, ns, CAP_SYS_PTRACE); ++ ret = security_capable(cred, ns, CAP_SYS_PTRACE, CAP_OPT_NOAUDIT); + else +- return has_ns_capability(current, ns, CAP_SYS_PTRACE); ++ ret = security_capable(cred, ns, CAP_SYS_PTRACE, CAP_OPT_NONE); ++ ++ return ret == 0; + } + + /* Returns 0 on success, -errno on denial. */ +@@ -321,7 +326,7 @@ static int __ptrace_may_access(struct task_struct *task, unsigned int mode) + gid_eq(caller_gid, tcred->sgid) && + gid_eq(caller_gid, tcred->gid)) + goto ok; +- if (ptrace_has_cap(tcred->user_ns, mode)) ++ if (ptrace_has_cap(cred, tcred->user_ns, mode)) + goto ok; + rcu_read_unlock(); + return -EPERM; +@@ -340,7 +345,7 @@ ok: + mm = task->mm; + if (mm && + ((get_dumpable(mm) != SUID_DUMP_USER) && +- !ptrace_has_cap(mm->user_ns, mode))) ++ !ptrace_has_cap(cred, mm->user_ns, mode))) + return -EPERM; + + return security_ptrace_access_check(task, mode); +diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c +index 955851748dc3..5c9fcc72460d 100644 +--- a/kernel/time/tick-sched.c ++++ b/kernel/time/tick-sched.c +@@ -58,8 +58,9 @@ static void tick_do_update_jiffies64(ktime_t now) + + /* + * Do a quick check without holding jiffies_lock: ++ * The READ_ONCE() pairs with two updates done later in this function. + */ +- delta = ktime_sub(now, last_jiffies_update); ++ delta = ktime_sub(now, READ_ONCE(last_jiffies_update)); + if (delta < tick_period) + return; + +@@ -70,8 +71,9 @@ static void tick_do_update_jiffies64(ktime_t now) + if (delta >= tick_period) { + + delta = ktime_sub(delta, tick_period); +- last_jiffies_update = ktime_add(last_jiffies_update, +- tick_period); ++ /* Pairs with the lockless read in this function. */ ++ WRITE_ONCE(last_jiffies_update, ++ ktime_add(last_jiffies_update, tick_period)); + + /* Slow path for long timeouts */ + if (unlikely(delta >= tick_period)) { +@@ -79,8 +81,10 @@ static void tick_do_update_jiffies64(ktime_t now) + + ticks = ktime_divns(delta, incr); + +- last_jiffies_update = ktime_add_ns(last_jiffies_update, +- incr * ticks); ++ /* Pairs with the lockless read in this function. */ ++ WRITE_ONCE(last_jiffies_update, ++ ktime_add_ns(last_jiffies_update, ++ incr * ticks)); + } + do_timer(++ticks); + +diff --git a/mm/huge_memory.c b/mm/huge_memory.c +index 13cc93785006..1de7f53621a0 100644 +--- a/mm/huge_memory.c ++++ b/mm/huge_memory.c +@@ -527,13 +527,13 @@ void prep_transhuge_page(struct page *page) + set_compound_page_dtor(page, TRANSHUGE_PAGE_DTOR); + } + +-static unsigned long __thp_get_unmapped_area(struct file *filp, unsigned long len, ++static unsigned long __thp_get_unmapped_area(struct file *filp, ++ unsigned long addr, unsigned long len, + loff_t off, unsigned long flags, unsigned long size) + { +- unsigned long addr; + loff_t off_end = off + len; + loff_t off_align = round_up(off, size); +- unsigned long len_pad; ++ unsigned long len_pad, ret; + + if (off_end <= off_align || (off_end - off_align) < size) + return 0; +@@ -542,30 +542,40 @@ static unsigned long __thp_get_unmapped_area(struct file *filp, unsigned long le + if (len_pad < len || (off + len_pad) < off) + return 0; + +- addr = current->mm->get_unmapped_area(filp, 0, len_pad, ++ ret = current->mm->get_unmapped_area(filp, addr, len_pad, + off >> PAGE_SHIFT, flags); +- if (IS_ERR_VALUE(addr)) ++ ++ /* ++ * The failure might be due to length padding. The caller will retry ++ * without the padding. ++ */ ++ if (IS_ERR_VALUE(ret)) + return 0; + +- addr += (off - addr) & (size - 1); +- return addr; ++ /* ++ * Do not try to align to THP boundary if allocation at the address ++ * hint succeeds. ++ */ ++ if (ret == addr) ++ return addr; ++ ++ ret += (off - ret) & (size - 1); ++ return ret; + } + + unsigned long thp_get_unmapped_area(struct file *filp, unsigned long addr, + unsigned long len, unsigned long pgoff, unsigned long flags) + { ++ unsigned long ret; + loff_t off = (loff_t)pgoff << PAGE_SHIFT; + +- if (addr) +- goto out; + if (!IS_DAX(filp->f_mapping->host) || !IS_ENABLED(CONFIG_FS_DAX_PMD)) + goto out; + +- addr = __thp_get_unmapped_area(filp, len, off, flags, PMD_SIZE); +- if (addr) +- return addr; +- +- out: ++ ret = __thp_get_unmapped_area(filp, addr, len, off, flags, PMD_SIZE); ++ if (ret) ++ return ret; ++out: + return current->mm->get_unmapped_area(filp, addr, len, pgoff, flags); + } + EXPORT_SYMBOL_GPL(thp_get_unmapped_area); +diff --git a/mm/memcontrol.c b/mm/memcontrol.c +index 46ad252e6d6a..ef4e9eb572a4 100644 +--- a/mm/memcontrol.c ++++ b/mm/memcontrol.c +@@ -3404,49 +3404,34 @@ static u64 mem_cgroup_read_u64(struct cgroup_subsys_state *css, + } + } + +-static void memcg_flush_percpu_vmstats(struct mem_cgroup *memcg, bool slab_only) ++static void memcg_flush_percpu_vmstats(struct mem_cgroup *memcg) + { +- unsigned long stat[MEMCG_NR_STAT]; ++ unsigned long stat[MEMCG_NR_STAT] = {0}; + struct mem_cgroup *mi; + int node, cpu, i; +- int min_idx, max_idx; +- +- if (slab_only) { +- min_idx = NR_SLAB_RECLAIMABLE; +- max_idx = NR_SLAB_UNRECLAIMABLE; +- } else { +- min_idx = 0; +- max_idx = MEMCG_NR_STAT; +- } +- +- for (i = min_idx; i < max_idx; i++) +- stat[i] = 0; + + for_each_online_cpu(cpu) +- for (i = min_idx; i < max_idx; i++) ++ for (i = 0; i < MEMCG_NR_STAT; i++) + stat[i] += per_cpu(memcg->vmstats_percpu->stat[i], cpu); + + for (mi = memcg; mi; mi = parent_mem_cgroup(mi)) +- for (i = min_idx; i < max_idx; i++) ++ for (i = 0; i < MEMCG_NR_STAT; i++) + atomic_long_add(stat[i], &mi->vmstats[i]); + +- if (!slab_only) +- max_idx = NR_VM_NODE_STAT_ITEMS; +- + for_each_node(node) { + struct mem_cgroup_per_node *pn = memcg->nodeinfo[node]; + struct mem_cgroup_per_node *pi; + +- for (i = min_idx; i < max_idx; i++) ++ for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++) + stat[i] = 0; + + for_each_online_cpu(cpu) +- for (i = min_idx; i < max_idx; i++) ++ for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++) + stat[i] += per_cpu( + pn->lruvec_stat_cpu->count[i], cpu); + + for (pi = pn; pi; pi = parent_nodeinfo(pi, node)) +- for (i = min_idx; i < max_idx; i++) ++ for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++) + atomic_long_add(stat[i], &pi->lruvec_stat[i]); + } + } +@@ -3520,13 +3505,9 @@ static void memcg_offline_kmem(struct mem_cgroup *memcg) + parent = root_mem_cgroup; + + /* +- * Deactivate and reparent kmem_caches. Then flush percpu +- * slab statistics to have precise values at the parent and +- * all ancestor levels. It's required to keep slab stats +- * accurate after the reparenting of kmem_caches. ++ * Deactivate and reparent kmem_caches. + */ + memcg_deactivate_kmem_caches(memcg, parent); +- memcg_flush_percpu_vmstats(memcg, true); + + kmemcg_id = memcg->kmemcg_id; + BUG_ON(kmemcg_id < 0); +@@ -5037,7 +5018,7 @@ static void mem_cgroup_free(struct mem_cgroup *memcg) + * Flush percpu vmstats and vmevents to guarantee the value correctness + * on parent's and all ancestor levels. + */ +- memcg_flush_percpu_vmstats(memcg, false); ++ memcg_flush_percpu_vmstats(memcg); + memcg_flush_percpu_vmevents(memcg); + __mem_cgroup_free(memcg); + } +diff --git a/mm/page-writeback.c b/mm/page-writeback.c +index 50055d2e4ea8..2d658b208319 100644 +--- a/mm/page-writeback.c ++++ b/mm/page-writeback.c +@@ -201,11 +201,11 @@ static void wb_min_max_ratio(struct bdi_writeback *wb, + if (this_bw < tot_bw) { + if (min) { + min *= this_bw; +- do_div(min, tot_bw); ++ min = div64_ul(min, tot_bw); + } + if (max < 100) { + max *= this_bw; +- do_div(max, tot_bw); ++ max = div64_ul(max, tot_bw); + } + } + +diff --git a/mm/page_alloc.c b/mm/page_alloc.c +index f391c0c4ed1d..45e39131a716 100644 +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -694,34 +694,27 @@ void prep_compound_page(struct page *page, unsigned int order) + #ifdef CONFIG_DEBUG_PAGEALLOC + unsigned int _debug_guardpage_minorder; + +-#ifdef CONFIG_DEBUG_PAGEALLOC_ENABLE_DEFAULT +-DEFINE_STATIC_KEY_TRUE(_debug_pagealloc_enabled); +-#else ++bool _debug_pagealloc_enabled_early __read_mostly ++ = IS_ENABLED(CONFIG_DEBUG_PAGEALLOC_ENABLE_DEFAULT); ++EXPORT_SYMBOL(_debug_pagealloc_enabled_early); + DEFINE_STATIC_KEY_FALSE(_debug_pagealloc_enabled); +-#endif + EXPORT_SYMBOL(_debug_pagealloc_enabled); + + DEFINE_STATIC_KEY_FALSE(_debug_guardpage_enabled); + + static int __init early_debug_pagealloc(char *buf) + { +- bool enable = false; +- +- if (kstrtobool(buf, &enable)) +- return -EINVAL; +- +- if (enable) +- static_branch_enable(&_debug_pagealloc_enabled); +- +- return 0; ++ return kstrtobool(buf, &_debug_pagealloc_enabled_early); + } + early_param("debug_pagealloc", early_debug_pagealloc); + +-static void init_debug_guardpage(void) ++void init_debug_pagealloc(void) + { + if (!debug_pagealloc_enabled()) + return; + ++ static_branch_enable(&_debug_pagealloc_enabled); ++ + if (!debug_guardpage_minorder()) + return; + +@@ -1186,7 +1179,7 @@ static __always_inline bool free_pages_prepare(struct page *page, + */ + arch_free_page(page, order); + +- if (debug_pagealloc_enabled()) ++ if (debug_pagealloc_enabled_static()) + kernel_map_pages(page, 1 << order, 0); + + kasan_free_nondeferred_pages(page, order); +@@ -1207,7 +1200,7 @@ static bool free_pcp_prepare(struct page *page) + + static bool bulkfree_pcp_prepare(struct page *page) + { +- if (debug_pagealloc_enabled()) ++ if (debug_pagealloc_enabled_static()) + return free_pages_check(page); + else + return false; +@@ -1221,7 +1214,7 @@ static bool bulkfree_pcp_prepare(struct page *page) + */ + static bool free_pcp_prepare(struct page *page) + { +- if (debug_pagealloc_enabled()) ++ if (debug_pagealloc_enabled_static()) + return free_pages_prepare(page, 0, true); + else + return free_pages_prepare(page, 0, false); +@@ -1973,10 +1966,6 @@ void __init page_alloc_init_late(void) + + for_each_populated_zone(zone) + set_zone_contiguous(zone); +- +-#ifdef CONFIG_DEBUG_PAGEALLOC +- init_debug_guardpage(); +-#endif + } + + #ifdef CONFIG_CMA +@@ -2106,7 +2095,7 @@ static inline bool free_pages_prezeroed(void) + */ + static inline bool check_pcp_refill(struct page *page) + { +- if (debug_pagealloc_enabled()) ++ if (debug_pagealloc_enabled_static()) + return check_new_page(page); + else + return false; +@@ -2128,7 +2117,7 @@ static inline bool check_pcp_refill(struct page *page) + } + static inline bool check_new_pcp(struct page *page) + { +- if (debug_pagealloc_enabled()) ++ if (debug_pagealloc_enabled_static()) + return check_new_page(page); + else + return false; +@@ -2155,7 +2144,7 @@ inline void post_alloc_hook(struct page *page, unsigned int order, + set_page_refcounted(page); + + arch_alloc_page(page, order); +- if (debug_pagealloc_enabled()) ++ if (debug_pagealloc_enabled_static()) + kernel_map_pages(page, 1 << order, 1); + kasan_alloc_pages(page, order); + kernel_poison_pages(page, 1 << order, 1); +diff --git a/mm/shmem.c b/mm/shmem.c +index 6074714fdbd4..312e31196720 100644 +--- a/mm/shmem.c ++++ b/mm/shmem.c +@@ -2106,9 +2106,10 @@ unsigned long shmem_get_unmapped_area(struct file *file, + /* + * Our priority is to support MAP_SHARED mapped hugely; + * and support MAP_PRIVATE mapped hugely too, until it is COWed. +- * But if caller specified an address hint, respect that as before. ++ * But if caller specified an address hint and we allocated area there ++ * successfully, respect that as before. + */ +- if (uaddr) ++ if (uaddr == addr) + return addr; + + if (shmem_huge != SHMEM_HUGE_FORCE) { +@@ -2142,7 +2143,7 @@ unsigned long shmem_get_unmapped_area(struct file *file, + if (inflated_len < len) + return addr; + +- inflated_addr = get_area(NULL, 0, inflated_len, 0, flags); ++ inflated_addr = get_area(NULL, uaddr, inflated_len, 0, flags); + if (IS_ERR_VALUE(inflated_addr)) + return addr; + if (inflated_addr & ~PAGE_MASK) +diff --git a/mm/slab.c b/mm/slab.c +index 66e5d8032bae..d1d7624cec4a 100644 +--- a/mm/slab.c ++++ b/mm/slab.c +@@ -1415,7 +1415,7 @@ static void kmem_rcu_free(struct rcu_head *head) + #if DEBUG + static bool is_debug_pagealloc_cache(struct kmem_cache *cachep) + { +- if (debug_pagealloc_enabled() && OFF_SLAB(cachep) && ++ if (debug_pagealloc_enabled_static() && OFF_SLAB(cachep) && + (cachep->size % PAGE_SIZE) == 0) + return true; + +@@ -2007,7 +2007,7 @@ int __kmem_cache_create(struct kmem_cache *cachep, slab_flags_t flags) + * to check size >= 256. It guarantees that all necessary small + * sized slab is initialized in current slab initialization sequence. + */ +- if (debug_pagealloc_enabled() && (flags & SLAB_POISON) && ++ if (debug_pagealloc_enabled_static() && (flags & SLAB_POISON) && + size >= 256 && cachep->object_size > cache_line_size()) { + if (size < PAGE_SIZE || size % PAGE_SIZE == 0) { + size_t tmp_size = ALIGN(size, PAGE_SIZE); +diff --git a/mm/slab_common.c b/mm/slab_common.c +index 78402b362df9..ade6c257d4b4 100644 +--- a/mm/slab_common.c ++++ b/mm/slab_common.c +@@ -903,7 +903,8 @@ static void flush_memcg_workqueue(struct kmem_cache *s) + * deactivates the memcg kmem_caches through workqueue. Make sure all + * previous workitems on workqueue are processed. + */ +- flush_workqueue(memcg_kmem_cache_wq); ++ if (likely(memcg_kmem_cache_wq)) ++ flush_workqueue(memcg_kmem_cache_wq); + + /* + * If we're racing with children kmem_cache deactivation, it might +diff --git a/mm/slub.c b/mm/slub.c +index e72e802fc569..20d72cb20515 100644 +--- a/mm/slub.c ++++ b/mm/slub.c +@@ -290,7 +290,7 @@ static inline void *get_freepointer_safe(struct kmem_cache *s, void *object) + unsigned long freepointer_addr; + void *p; + +- if (!debug_pagealloc_enabled()) ++ if (!debug_pagealloc_enabled_static()) + return get_freepointer(s, object); + + freepointer_addr = (unsigned long)object + s->offset; +diff --git a/mm/sparse.c b/mm/sparse.c +index c2c01b6330af..1100fdb9649c 100644 +--- a/mm/sparse.c ++++ b/mm/sparse.c +@@ -775,7 +775,14 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages, + if (bitmap_empty(subsection_map, SUBSECTIONS_PER_SECTION)) { + unsigned long section_nr = pfn_to_section_nr(pfn); + +- if (!section_is_early) { ++ /* ++ * When removing an early section, the usage map is kept (as the ++ * usage maps of other sections fall into the same page). It ++ * will be re-used when re-adding the section - which is then no ++ * longer an early section. If the usage map is PageReserved, it ++ * was allocated during boot. ++ */ ++ if (!PageReserved(virt_to_page(ms->usage))) { + kfree(ms->usage); + ms->usage = NULL; + } +diff --git a/mm/vmalloc.c b/mm/vmalloc.c +index a3c70e275f4e..61bdbaf20cde 100644 +--- a/mm/vmalloc.c ++++ b/mm/vmalloc.c +@@ -1349,7 +1349,7 @@ static void free_unmap_vmap_area(struct vmap_area *va) + { + flush_cache_vunmap(va->va_start, va->va_end); + unmap_vmap_area(va); +- if (debug_pagealloc_enabled()) ++ if (debug_pagealloc_enabled_static()) + flush_tlb_kernel_range(va->va_start, va->va_end); + + free_vmap_area_noflush(va); +@@ -1647,7 +1647,7 @@ static void vb_free(const void *addr, unsigned long size) + + vunmap_page_range((unsigned long)addr, (unsigned long)addr + size); + +- if (debug_pagealloc_enabled()) ++ if (debug_pagealloc_enabled_static()) + flush_tlb_kernel_range((unsigned long)addr, + (unsigned long)addr + size); + +diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c +index b0af3a11d406..ec7bf5a4a9fc 100644 +--- a/net/batman-adv/distributed-arp-table.c ++++ b/net/batman-adv/distributed-arp-table.c +@@ -285,6 +285,7 @@ static u32 batadv_hash_dat(const void *data, u32 size) + u32 hash = 0; + const struct batadv_dat_entry *dat = data; + const unsigned char *key; ++ __be16 vid; + u32 i; + + key = (const unsigned char *)&dat->ip; +@@ -294,7 +295,8 @@ static u32 batadv_hash_dat(const void *data, u32 size) + hash ^= (hash >> 6); + } + +- key = (const unsigned char *)&dat->vid; ++ vid = htons(dat->vid); ++ key = (__force const unsigned char *)&vid; + for (i = 0; i < sizeof(dat->vid); i++) { + hash += key[i]; + hash += (hash << 10); +diff --git a/net/core/dev.c b/net/core/dev.c +index 3e11c6bb4dd6..3098c90d60e2 100644 +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -8953,22 +8953,10 @@ static void netdev_unregister_lockdep_key(struct net_device *dev) + + void netdev_update_lockdep_key(struct net_device *dev) + { +- struct netdev_queue *queue; +- int i; +- +- lockdep_unregister_key(&dev->qdisc_xmit_lock_key); + lockdep_unregister_key(&dev->addr_list_lock_key); +- +- lockdep_register_key(&dev->qdisc_xmit_lock_key); + lockdep_register_key(&dev->addr_list_lock_key); + + lockdep_set_class(&dev->addr_list_lock, &dev->addr_list_lock_key); +- for (i = 0; i < dev->num_tx_queues; i++) { +- queue = netdev_get_tx_queue(dev, i); +- +- lockdep_set_class(&queue->_xmit_lock, +- &dev->qdisc_xmit_lock_key); +- } + } + EXPORT_SYMBOL(netdev_update_lockdep_key); + +diff --git a/net/core/devlink.c b/net/core/devlink.c +index 93905dc7c179..ae614965c8c2 100644 +--- a/net/core/devlink.c ++++ b/net/core/devlink.c +@@ -6280,7 +6280,7 @@ static bool devlink_port_type_should_warn(struct devlink_port *devlink_port) + devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_DSA; + } + +-#define DEVLINK_PORT_TYPE_WARN_TIMEOUT (HZ * 30) ++#define DEVLINK_PORT_TYPE_WARN_TIMEOUT (HZ * 3600) + + static void devlink_port_type_warn_schedule(struct devlink_port *devlink_port) + { +diff --git a/net/core/filter.c b/net/core/filter.c +index 2f76461c120d..1a78d64096bb 100644 +--- a/net/core/filter.c ++++ b/net/core/filter.c +@@ -2231,10 +2231,10 @@ BPF_CALL_4(bpf_msg_pull_data, struct sk_msg *, msg, u32, start, + /* First find the starting scatterlist element */ + i = msg->sg.start; + do { ++ offset += len; + len = sk_msg_elem(msg, i)->length; + if (start < offset + len) + break; +- offset += len; + sk_msg_iter_var_next(i); + } while (i != msg->sg.end); + +@@ -2346,7 +2346,7 @@ BPF_CALL_4(bpf_msg_push_data, struct sk_msg *, msg, u32, start, + u32, len, u64, flags) + { + struct scatterlist sge, nsge, nnsge, rsge = {0}, *psge; +- u32 new, i = 0, l, space, copy = 0, offset = 0; ++ u32 new, i = 0, l = 0, space, copy = 0, offset = 0; + u8 *raw, *to, *from; + struct page *page; + +@@ -2356,11 +2356,11 @@ BPF_CALL_4(bpf_msg_push_data, struct sk_msg *, msg, u32, start, + /* First find the starting scatterlist element */ + i = msg->sg.start; + do { ++ offset += l; + l = sk_msg_elem(msg, i)->length; + + if (start < offset + l) + break; +- offset += l; + sk_msg_iter_var_next(i); + } while (i != msg->sg.end); + +@@ -2415,6 +2415,7 @@ BPF_CALL_4(bpf_msg_push_data, struct sk_msg *, msg, u32, start, + + sk_msg_iter_var_next(i); + sg_unmark_end(psge); ++ sg_unmark_end(&rsge); + sk_msg_iter_next(msg, end); + } + +@@ -2506,7 +2507,7 @@ static void sk_msg_shift_right(struct sk_msg *msg, int i) + BPF_CALL_4(bpf_msg_pop_data, struct sk_msg *, msg, u32, start, + u32, len, u64, flags) + { +- u32 i = 0, l, space, offset = 0; ++ u32 i = 0, l = 0, space, offset = 0; + u64 last = start + len; + int pop; + +@@ -2516,11 +2517,11 @@ BPF_CALL_4(bpf_msg_pop_data, struct sk_msg *, msg, u32, start, + /* First find the starting scatterlist element */ + i = msg->sg.start; + do { ++ offset += l; + l = sk_msg_elem(msg, i)->length; + + if (start < offset + l) + break; +- offset += l; + sk_msg_iter_var_next(i); + } while (i != msg->sg.end); + +@@ -5305,8 +5306,7 @@ __bpf_sk_lookup(struct sk_buff *skb, struct bpf_sock_tuple *tuple, u32 len, + if (sk) { + sk = sk_to_full_sk(sk); + if (!sk_fullsock(sk)) { +- if (!sock_flag(sk, SOCK_RCU_FREE)) +- sock_gen_put(sk); ++ sock_gen_put(sk); + return NULL; + } + } +@@ -5343,8 +5343,7 @@ bpf_sk_lookup(struct sk_buff *skb, struct bpf_sock_tuple *tuple, u32 len, + if (sk) { + sk = sk_to_full_sk(sk); + if (!sk_fullsock(sk)) { +- if (!sock_flag(sk, SOCK_RCU_FREE)) +- sock_gen_put(sk); ++ sock_gen_put(sk); + return NULL; + } + } +@@ -5411,7 +5410,8 @@ static const struct bpf_func_proto bpf_sk_lookup_udp_proto = { + + BPF_CALL_1(bpf_sk_release, struct sock *, sk) + { +- if (!sock_flag(sk, SOCK_RCU_FREE)) ++ /* Only full sockets have sk->sk_flags. */ ++ if (!sk_fullsock(sk) || !sock_flag(sk, SOCK_RCU_FREE)) + sock_gen_put(sk); + return 0; + } +diff --git a/net/core/skmsg.c b/net/core/skmsg.c +index ded2d5227678..3866d7e20c07 100644 +--- a/net/core/skmsg.c ++++ b/net/core/skmsg.c +@@ -594,6 +594,8 @@ EXPORT_SYMBOL_GPL(sk_psock_destroy); + + void sk_psock_drop(struct sock *sk, struct sk_psock *psock) + { ++ sock_owned_by_me(sk); ++ + sk_psock_cork_free(psock); + sk_psock_zap_ingress(psock); + +diff --git a/net/core/sock_map.c b/net/core/sock_map.c +index eb114ee419b6..8998e356f423 100644 +--- a/net/core/sock_map.c ++++ b/net/core/sock_map.c +@@ -241,8 +241,11 @@ static void sock_map_free(struct bpf_map *map) + struct sock *sk; + + sk = xchg(psk, NULL); +- if (sk) ++ if (sk) { ++ lock_sock(sk); + sock_map_unref(sk, psk); ++ release_sock(sk); ++ } + } + raw_spin_unlock_bh(&stab->lock); + rcu_read_unlock(); +@@ -862,7 +865,9 @@ static void sock_hash_free(struct bpf_map *map) + raw_spin_lock_bh(&bucket->lock); + hlist_for_each_entry_safe(elem, node, &bucket->head, node) { + hlist_del_rcu(&elem->node); ++ lock_sock(elem->sk); + sock_map_unref(elem->sk, elem); ++ release_sock(elem->sk); + } + raw_spin_unlock_bh(&bucket->lock); + } +diff --git a/net/dsa/tag_gswip.c b/net/dsa/tag_gswip.c +index b678160bbd66..408d4af390a0 100644 +--- a/net/dsa/tag_gswip.c ++++ b/net/dsa/tag_gswip.c +@@ -104,7 +104,7 @@ static struct sk_buff *gswip_tag_rcv(struct sk_buff *skb, + } + + static const struct dsa_device_ops gswip_netdev_ops = { +- .name = "gwsip", ++ .name = "gswip", + .proto = DSA_TAG_PROTO_GSWIP, + .xmit = gswip_tag_xmit, + .rcv = gswip_tag_rcv, +diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c +index c95885215525..c8a128c9e5e0 100644 +--- a/net/dsa/tag_qca.c ++++ b/net/dsa/tag_qca.c +@@ -33,9 +33,6 @@ static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev) + struct dsa_port *dp = dsa_slave_to_port(dev); + u16 *phdr, hdr; + +- dev->stats.tx_packets++; +- dev->stats.tx_bytes += skb->len; +- + if (skb_cow_head(skb, 0) < 0) + return NULL; + +diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c +index 069f72edb264..f1f78a742b36 100644 +--- a/net/ipv4/netfilter/arp_tables.c ++++ b/net/ipv4/netfilter/arp_tables.c +@@ -496,12 +496,13 @@ static inline int check_entry_size_and_hooks(struct arpt_entry *e, + return 0; + } + +-static inline void cleanup_entry(struct arpt_entry *e) ++static void cleanup_entry(struct arpt_entry *e, struct net *net) + { + struct xt_tgdtor_param par; + struct xt_entry_target *t; + + t = arpt_get_target(e); ++ par.net = net; + par.target = t->u.kernel.target; + par.targinfo = t->data; + par.family = NFPROTO_ARP; +@@ -584,7 +585,7 @@ static int translate_table(struct net *net, + xt_entry_foreach(iter, entry0, newinfo->size) { + if (i-- == 0) + break; +- cleanup_entry(iter); ++ cleanup_entry(iter, net); + } + return ret; + } +@@ -927,7 +928,7 @@ static int __do_replace(struct net *net, const char *name, + /* Decrease module usage counts and free resource */ + loc_cpu_old_entry = oldinfo->entries; + xt_entry_foreach(iter, loc_cpu_old_entry, oldinfo->size) +- cleanup_entry(iter); ++ cleanup_entry(iter, net); + + xt_free_table_info(oldinfo); + if (copy_to_user(counters_ptr, counters, +@@ -990,7 +991,7 @@ static int do_replace(struct net *net, const void __user *user, + + free_newinfo_untrans: + xt_entry_foreach(iter, loc_cpu_entry, newinfo->size) +- cleanup_entry(iter); ++ cleanup_entry(iter, net); + free_newinfo: + xt_free_table_info(newinfo); + return ret; +@@ -1287,7 +1288,7 @@ static int compat_do_replace(struct net *net, void __user *user, + + free_newinfo_untrans: + xt_entry_foreach(iter, loc_cpu_entry, newinfo->size) +- cleanup_entry(iter); ++ cleanup_entry(iter, net); + free_newinfo: + xt_free_table_info(newinfo); + return ret; +@@ -1514,7 +1515,7 @@ static int do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len + return ret; + } + +-static void __arpt_unregister_table(struct xt_table *table) ++static void __arpt_unregister_table(struct net *net, struct xt_table *table) + { + struct xt_table_info *private; + void *loc_cpu_entry; +@@ -1526,7 +1527,7 @@ static void __arpt_unregister_table(struct xt_table *table) + /* Decrease module usage counts and free resources */ + loc_cpu_entry = private->entries; + xt_entry_foreach(iter, loc_cpu_entry, private->size) +- cleanup_entry(iter); ++ cleanup_entry(iter, net); + if (private->number > private->initial_entries) + module_put(table_owner); + xt_free_table_info(private); +@@ -1566,7 +1567,7 @@ int arpt_register_table(struct net *net, + + ret = nf_register_net_hooks(net, ops, hweight32(table->valid_hooks)); + if (ret != 0) { +- __arpt_unregister_table(new_table); ++ __arpt_unregister_table(net, new_table); + *res = NULL; + } + +@@ -1581,7 +1582,7 @@ void arpt_unregister_table(struct net *net, struct xt_table *table, + const struct nf_hook_ops *ops) + { + nf_unregister_net_hooks(net, ops, hweight32(table->valid_hooks)); +- __arpt_unregister_table(table); ++ __arpt_unregister_table(net, table); + } + + /* The built-in targets: standard (NULL) and error. */ +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c +index e537a4b6531b..84115577d3dc 100644 +--- a/net/ipv4/tcp.c ++++ b/net/ipv4/tcp.c +@@ -1087,8 +1087,7 @@ do_error: + goto out; + out_err: + /* make sure we wake any epoll edge trigger waiter */ +- if (unlikely(skb_queue_len(&sk->sk_write_queue) == 0 && +- err == -EAGAIN)) { ++ if (unlikely(tcp_rtx_and_write_queues_empty(sk) && err == -EAGAIN)) { + sk->sk_write_space(sk); + tcp_chrono_stop(sk, TCP_CHRONO_SNDBUF_LIMITED); + } +@@ -1419,8 +1418,7 @@ out_err: + sock_zerocopy_put_abort(uarg, true); + err = sk_stream_error(sk, flags, err); + /* make sure we wake any epoll edge trigger waiter */ +- if (unlikely(skb_queue_len(&sk->sk_write_queue) == 0 && +- err == -EAGAIN)) { ++ if (unlikely(tcp_rtx_and_write_queues_empty(sk) && err == -EAGAIN)) { + sk->sk_write_space(sk); + tcp_chrono_stop(sk, TCP_CHRONO_SNDBUF_LIMITED); + } +diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c +index e38705165ac9..8a01428f80c1 100644 +--- a/net/ipv4/tcp_bpf.c ++++ b/net/ipv4/tcp_bpf.c +@@ -121,14 +121,14 @@ int tcp_bpf_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, + struct sk_psock *psock; + int copied, ret; + +- if (unlikely(flags & MSG_ERRQUEUE)) +- return inet_recv_error(sk, msg, len, addr_len); +- if (!skb_queue_empty(&sk->sk_receive_queue)) +- return tcp_recvmsg(sk, msg, len, nonblock, flags, addr_len); +- + psock = sk_psock_get(sk); + if (unlikely(!psock)) + return tcp_recvmsg(sk, msg, len, nonblock, flags, addr_len); ++ if (unlikely(flags & MSG_ERRQUEUE)) ++ return inet_recv_error(sk, msg, len, addr_len); ++ if (!skb_queue_empty(&sk->sk_receive_queue) && ++ sk_psock_queue_empty(psock)) ++ return tcp_recvmsg(sk, msg, len, nonblock, flags, addr_len); + lock_sock(sk); + msg_bytes_ready: + copied = __tcp_bpf_recvmsg(sk, psock, msg, len, flags); +@@ -139,7 +139,7 @@ msg_bytes_ready: + timeo = sock_rcvtimeo(sk, nonblock); + data = tcp_bpf_wait_data(sk, psock, flags, timeo, &err); + if (data) { +- if (skb_queue_empty(&sk->sk_receive_queue)) ++ if (!sk_psock_queue_empty(psock)) + goto msg_bytes_ready; + release_sock(sk); + sk_psock_put(sk, psock); +@@ -315,10 +315,7 @@ more_data: + */ + delta = msg->sg.size; + psock->eval = sk_psock_msg_verdict(sk, psock, msg); +- if (msg->sg.size < delta) +- delta -= msg->sg.size; +- else +- delta = 0; ++ delta -= msg->sg.size; + } + + if (msg->cork_bytes && +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c +index 67e44e6717b0..59b78ce2ce2e 100644 +--- a/net/ipv4/tcp_input.c ++++ b/net/ipv4/tcp_input.c +@@ -915,9 +915,10 @@ static void tcp_check_sack_reordering(struct sock *sk, const u32 low_seq, + /* This must be called before lost_out is incremented */ + static void tcp_verify_retransmit_hint(struct tcp_sock *tp, struct sk_buff *skb) + { +- if (!tp->retransmit_skb_hint || +- before(TCP_SKB_CB(skb)->seq, +- TCP_SKB_CB(tp->retransmit_skb_hint)->seq)) ++ if ((!tp->retransmit_skb_hint && tp->retrans_out >= tp->lost_out) || ++ (tp->retransmit_skb_hint && ++ before(TCP_SKB_CB(skb)->seq, ++ TCP_SKB_CB(tp->retransmit_skb_hint)->seq))) + tp->retransmit_skb_hint = skb; + } + +diff --git a/net/ipv4/tcp_ulp.c b/net/ipv4/tcp_ulp.c +index 4849edb62d52..9168645b760e 100644 +--- a/net/ipv4/tcp_ulp.c ++++ b/net/ipv4/tcp_ulp.c +@@ -96,17 +96,19 @@ void tcp_get_available_ulp(char *buf, size_t maxlen) + rcu_read_unlock(); + } + +-void tcp_update_ulp(struct sock *sk, struct proto *proto) ++void tcp_update_ulp(struct sock *sk, struct proto *proto, ++ void (*write_space)(struct sock *sk)) + { + struct inet_connection_sock *icsk = inet_csk(sk); + + if (!icsk->icsk_ulp_ops) { ++ sk->sk_write_space = write_space; + sk->sk_prot = proto; + return; + } + + if (icsk->icsk_ulp_ops->update) +- icsk->icsk_ulp_ops->update(sk, proto); ++ icsk->icsk_ulp_ops->update(sk, proto, write_space); + } + + void tcp_cleanup_ulp(struct sock *sk) +diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h b/net/netfilter/ipset/ip_set_bitmap_gen.h +index 063df74b4647..e1f271a1b2c1 100644 +--- a/net/netfilter/ipset/ip_set_bitmap_gen.h ++++ b/net/netfilter/ipset/ip_set_bitmap_gen.h +@@ -60,9 +60,9 @@ mtype_destroy(struct ip_set *set) + if (SET_WITH_TIMEOUT(set)) + del_timer_sync(&map->gc); + +- ip_set_free(map->members); + if (set->dsize && set->extensions & IPSET_EXT_DESTROY) + mtype_ext_cleanup(set); ++ ip_set_free(map->members); + ip_set_free(map); + + set->data = NULL; +diff --git a/net/netfilter/nf_nat_proto.c b/net/netfilter/nf_nat_proto.c +index 0a59c14b5177..64eedc17037a 100644 +--- a/net/netfilter/nf_nat_proto.c ++++ b/net/netfilter/nf_nat_proto.c +@@ -233,6 +233,19 @@ icmp_manip_pkt(struct sk_buff *skb, + return false; + + hdr = (struct icmphdr *)(skb->data + hdroff); ++ switch (hdr->type) { ++ case ICMP_ECHO: ++ case ICMP_ECHOREPLY: ++ case ICMP_TIMESTAMP: ++ case ICMP_TIMESTAMPREPLY: ++ case ICMP_INFO_REQUEST: ++ case ICMP_INFO_REPLY: ++ case ICMP_ADDRESS: ++ case ICMP_ADDRESSREPLY: ++ break; ++ default: ++ return true; ++ } + inet_proto_csum_replace2(&hdr->checksum, skb, + hdr->un.echo.id, tuple->src.u.icmp.id, false); + hdr->un.echo.id = tuple->src.u.icmp.id; +diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c +index 67ca47c7ce54..9fefd0150091 100644 +--- a/net/netfilter/nf_tables_api.c ++++ b/net/netfilter/nf_tables_api.c +@@ -22,6 +22,8 @@ + #include + #include + ++#define NFT_MODULE_AUTOLOAD_LIMIT (MODULE_NAME_LEN - sizeof("nft-expr-255-")) ++ + static LIST_HEAD(nf_tables_expressions); + static LIST_HEAD(nf_tables_objects); + static LIST_HEAD(nf_tables_flowtables); +@@ -500,33 +502,34 @@ __nf_tables_chain_type_lookup(const struct nlattr *nla, u8 family) + } + + /* +- * Loading a module requires dropping mutex that guards the +- * transaction. +- * We first need to abort any pending transactions as once +- * mutex is unlocked a different client could start a new +- * transaction. It must not see any 'future generation' +- * changes * as these changes will never happen. ++ * Loading a module requires dropping mutex that guards the transaction. ++ * A different client might race to start a new transaction meanwhile. Zap the ++ * list of pending transaction and then restore it once the mutex is grabbed ++ * again. Users of this function return EAGAIN which implicitly triggers the ++ * transaction abort path to clean up the list of pending transactions. + */ + #ifdef CONFIG_MODULES +-static int __nf_tables_abort(struct net *net); +- + static void nft_request_module(struct net *net, const char *fmt, ...) + { + char module_name[MODULE_NAME_LEN]; ++ LIST_HEAD(commit_list); + va_list args; + int ret; + +- __nf_tables_abort(net); ++ list_splice_init(&net->nft.commit_list, &commit_list); + + va_start(args, fmt); + ret = vsnprintf(module_name, MODULE_NAME_LEN, fmt, args); + va_end(args); +- if (WARN(ret >= MODULE_NAME_LEN, "truncated: '%s' (len %d)", module_name, ret)) ++ if (ret >= MODULE_NAME_LEN) + return; + + mutex_unlock(&net->nft.commit_mutex); + request_module("%s", module_name); + mutex_lock(&net->nft.commit_mutex); ++ ++ WARN_ON_ONCE(!list_empty(&net->nft.commit_list)); ++ list_splice(&commit_list, &net->nft.commit_list); + } + #endif + +@@ -978,12 +981,18 @@ static int nft_flush_table(struct nft_ctx *ctx) + } + + list_for_each_entry_safe(flowtable, nft, &ctx->table->flowtables, list) { ++ if (!nft_is_active_next(ctx->net, flowtable)) ++ continue; ++ + err = nft_delflowtable(ctx, flowtable); + if (err < 0) + goto out; + } + + list_for_each_entry_safe(obj, ne, &ctx->table->objects, list) { ++ if (!nft_is_active_next(ctx->net, obj)) ++ continue; ++ + err = nft_delobj(ctx, obj); + if (err < 0) + goto out; +@@ -1174,7 +1183,8 @@ static const struct nla_policy nft_chain_policy[NFTA_CHAIN_MAX + 1] = { + .len = NFT_CHAIN_MAXNAMELEN - 1 }, + [NFTA_CHAIN_HOOK] = { .type = NLA_NESTED }, + [NFTA_CHAIN_POLICY] = { .type = NLA_U32 }, +- [NFTA_CHAIN_TYPE] = { .type = NLA_STRING }, ++ [NFTA_CHAIN_TYPE] = { .type = NLA_STRING, ++ .len = NFT_MODULE_AUTOLOAD_LIMIT }, + [NFTA_CHAIN_COUNTERS] = { .type = NLA_NESTED }, + [NFTA_CHAIN_FLAGS] = { .type = NLA_U32 }, + }; +@@ -2088,7 +2098,8 @@ static const struct nft_expr_type *nft_expr_type_get(struct net *net, + } + + static const struct nla_policy nft_expr_policy[NFTA_EXPR_MAX + 1] = { +- [NFTA_EXPR_NAME] = { .type = NLA_STRING }, ++ [NFTA_EXPR_NAME] = { .type = NLA_STRING, ++ .len = NFT_MODULE_AUTOLOAD_LIMIT }, + [NFTA_EXPR_DATA] = { .type = NLA_NESTED }, + }; + +@@ -3931,7 +3942,8 @@ static const struct nla_policy nft_set_elem_policy[NFTA_SET_ELEM_MAX + 1] = { + [NFTA_SET_ELEM_USERDATA] = { .type = NLA_BINARY, + .len = NFT_USERDATA_MAXLEN }, + [NFTA_SET_ELEM_EXPR] = { .type = NLA_NESTED }, +- [NFTA_SET_ELEM_OBJREF] = { .type = NLA_STRING }, ++ [NFTA_SET_ELEM_OBJREF] = { .type = NLA_STRING, ++ .len = NFT_OBJ_MAXNAMELEN - 1 }, + }; + + static const struct nla_policy nft_set_elem_list_policy[NFTA_SET_ELEM_LIST_MAX + 1] = { +diff --git a/net/netfilter/nft_tunnel.c b/net/netfilter/nft_tunnel.c +index 3d4c2ae605a8..5284fcf16be7 100644 +--- a/net/netfilter/nft_tunnel.c ++++ b/net/netfilter/nft_tunnel.c +@@ -76,7 +76,7 @@ static int nft_tunnel_get_init(const struct nft_ctx *ctx, + struct nft_tunnel *priv = nft_expr_priv(expr); + u32 len; + +- if (!tb[NFTA_TUNNEL_KEY] && ++ if (!tb[NFTA_TUNNEL_KEY] || + !tb[NFTA_TUNNEL_DREG]) + return -EINVAL; + +@@ -266,6 +266,9 @@ static int nft_tunnel_obj_erspan_init(const struct nlattr *attr, + if (err < 0) + return err; + ++ if (!tb[NFTA_TUNNEL_KEY_ERSPAN_VERSION]) ++ return -EINVAL; ++ + version = ntohl(nla_get_be32(tb[NFTA_TUNNEL_KEY_ERSPAN_VERSION])); + switch (version) { + case ERSPAN_VERSION: +diff --git a/net/sched/act_ctinfo.c b/net/sched/act_ctinfo.c +index 0dbcfd1dca7b..f45995a6237a 100644 +--- a/net/sched/act_ctinfo.c ++++ b/net/sched/act_ctinfo.c +@@ -360,6 +360,16 @@ static int tcf_ctinfo_search(struct net *net, struct tc_action **a, u32 index) + return tcf_idr_search(tn, a, index); + } + ++static void tcf_ctinfo_cleanup(struct tc_action *a) ++{ ++ struct tcf_ctinfo *ci = to_ctinfo(a); ++ struct tcf_ctinfo_params *cp; ++ ++ cp = rcu_dereference_protected(ci->params, 1); ++ if (cp) ++ kfree_rcu(cp, rcu); ++} ++ + static struct tc_action_ops act_ctinfo_ops = { + .kind = "ctinfo", + .id = TCA_ID_CTINFO, +@@ -367,6 +377,7 @@ static struct tc_action_ops act_ctinfo_ops = { + .act = tcf_ctinfo_act, + .dump = tcf_ctinfo_dump, + .init = tcf_ctinfo_init, ++ .cleanup= tcf_ctinfo_cleanup, + .walk = tcf_ctinfo_walker, + .lookup = tcf_ctinfo_search, + .size = sizeof(struct tcf_ctinfo), +diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c +index 3a31e241c647..a0cfb4793c93 100644 +--- a/net/sched/act_ife.c ++++ b/net/sched/act_ife.c +@@ -536,6 +536,9 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla, + } + + ife = to_ife(*a); ++ if (ret == ACT_P_CREATED) ++ INIT_LIST_HEAD(&ife->metalist); ++ + err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack); + if (err < 0) + goto release_idr; +@@ -565,10 +568,6 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla, + p->eth_type = ife_type; + } + +- +- if (ret == ACT_P_CREATED) +- INIT_LIST_HEAD(&ife->metalist); +- + if (tb[TCA_IFE_METALST]) { + err = nla_parse_nested_deprecated(tb2, IFE_META_MAX, + tb[TCA_IFE_METALST], NULL, +diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c +index 6ef1abdd525f..885ecf6ea65a 100644 +--- a/net/tipc/bcast.c ++++ b/net/tipc/bcast.c +@@ -305,17 +305,17 @@ static int tipc_rcast_xmit(struct net *net, struct sk_buff_head *pkts, + * @skb: socket buffer to copy + * @method: send method to be used + * @dests: destination nodes for message. +- * @cong_link_cnt: returns number of encountered congested destination links + * Returns 0 if success, otherwise errno + */ + static int tipc_mcast_send_sync(struct net *net, struct sk_buff *skb, + struct tipc_mc_method *method, +- struct tipc_nlist *dests, +- u16 *cong_link_cnt) ++ struct tipc_nlist *dests) + { + struct tipc_msg *hdr, *_hdr; + struct sk_buff_head tmpq; + struct sk_buff *_skb; ++ u16 cong_link_cnt; ++ int rc = 0; + + /* Is a cluster supporting with new capabilities ? */ + if (!(tipc_net(net)->capabilities & TIPC_MCAST_RBCTL)) +@@ -343,18 +343,19 @@ static int tipc_mcast_send_sync(struct net *net, struct sk_buff *skb, + _hdr = buf_msg(_skb); + msg_set_size(_hdr, MCAST_H_SIZE); + msg_set_is_rcast(_hdr, !msg_is_rcast(hdr)); ++ msg_set_errcode(_hdr, TIPC_ERR_NO_PORT); + + __skb_queue_head_init(&tmpq); + __skb_queue_tail(&tmpq, _skb); + if (method->rcast) +- tipc_bcast_xmit(net, &tmpq, cong_link_cnt); ++ rc = tipc_bcast_xmit(net, &tmpq, &cong_link_cnt); + else +- tipc_rcast_xmit(net, &tmpq, dests, cong_link_cnt); ++ rc = tipc_rcast_xmit(net, &tmpq, dests, &cong_link_cnt); + + /* This queue should normally be empty by now */ + __skb_queue_purge(&tmpq); + +- return 0; ++ return rc; + } + + /* tipc_mcast_xmit - deliver message to indicated destination nodes +@@ -396,9 +397,14 @@ int tipc_mcast_xmit(struct net *net, struct sk_buff_head *pkts, + msg_set_is_rcast(hdr, method->rcast); + + /* Switch method ? */ +- if (rcast != method->rcast) +- tipc_mcast_send_sync(net, skb, method, +- dests, cong_link_cnt); ++ if (rcast != method->rcast) { ++ rc = tipc_mcast_send_sync(net, skb, method, dests); ++ if (unlikely(rc)) { ++ pr_err("Unable to send SYN: method %d, rc %d\n", ++ rcast, rc); ++ goto exit; ++ } ++ } + + if (method->rcast) + rc = tipc_rcast_xmit(net, pkts, dests, cong_link_cnt); +diff --git a/net/tipc/socket.c b/net/tipc/socket.c +index 4b92b196cfa6..79d06c21ebe3 100644 +--- a/net/tipc/socket.c ++++ b/net/tipc/socket.c +@@ -1306,8 +1306,8 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen) + struct tipc_msg *hdr = &tsk->phdr; + struct tipc_name_seq *seq; + struct sk_buff_head pkts; +- u32 dport, dnode = 0; +- u32 type, inst; ++ u32 dport = 0, dnode = 0; ++ u32 type = 0, inst = 0; + int mtu, rc; + + if (unlikely(dlen > TIPC_MAX_USER_MSG_SIZE)) +@@ -1360,23 +1360,11 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen) + type = dest->addr.name.name.type; + inst = dest->addr.name.name.instance; + dnode = dest->addr.name.domain; +- msg_set_type(hdr, TIPC_NAMED_MSG); +- msg_set_hdr_sz(hdr, NAMED_H_SIZE); +- msg_set_nametype(hdr, type); +- msg_set_nameinst(hdr, inst); +- msg_set_lookup_scope(hdr, tipc_node2scope(dnode)); + dport = tipc_nametbl_translate(net, type, inst, &dnode); +- msg_set_destnode(hdr, dnode); +- msg_set_destport(hdr, dport); + if (unlikely(!dport && !dnode)) + return -EHOSTUNREACH; + } else if (dest->addrtype == TIPC_ADDR_ID) { + dnode = dest->addr.id.node; +- msg_set_type(hdr, TIPC_DIRECT_MSG); +- msg_set_lookup_scope(hdr, 0); +- msg_set_destnode(hdr, dnode); +- msg_set_destport(hdr, dest->addr.id.ref); +- msg_set_hdr_sz(hdr, BASIC_H_SIZE); + } else { + return -EINVAL; + } +@@ -1387,6 +1375,22 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen) + if (unlikely(rc)) + return rc; + ++ if (dest->addrtype == TIPC_ADDR_NAME) { ++ msg_set_type(hdr, TIPC_NAMED_MSG); ++ msg_set_hdr_sz(hdr, NAMED_H_SIZE); ++ msg_set_nametype(hdr, type); ++ msg_set_nameinst(hdr, inst); ++ msg_set_lookup_scope(hdr, tipc_node2scope(dnode)); ++ msg_set_destnode(hdr, dnode); ++ msg_set_destport(hdr, dport); ++ } else { /* TIPC_ADDR_ID */ ++ msg_set_type(hdr, TIPC_DIRECT_MSG); ++ msg_set_lookup_scope(hdr, 0); ++ msg_set_destnode(hdr, dnode); ++ msg_set_destport(hdr, dest->addr.id.ref); ++ msg_set_hdr_sz(hdr, BASIC_H_SIZE); ++ } ++ + __skb_queue_head_init(&pkts); + mtu = tipc_node_get_mtu(net, dnode, tsk->portid); + rc = tipc_msg_build(hdr, m, 0, dlen, mtu, &pkts); +diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c +index 82d0beed8f07..7aba4ee77aba 100644 +--- a/net/tls/tls_main.c ++++ b/net/tls/tls_main.c +@@ -798,15 +798,19 @@ out: + return rc; + } + +-static void tls_update(struct sock *sk, struct proto *p) ++static void tls_update(struct sock *sk, struct proto *p, ++ void (*write_space)(struct sock *sk)) + { + struct tls_context *ctx; + + ctx = tls_get_ctx(sk); +- if (likely(ctx)) ++ if (likely(ctx)) { ++ ctx->sk_write_space = write_space; + ctx->sk_proto = p; +- else ++ } else { + sk->sk_prot = p; ++ sk->sk_write_space = write_space; ++ } + } + + static int tls_get_info(const struct sock *sk, struct sk_buff *skb) +diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c +index c70cf30c5492..a80920f261ca 100644 +--- a/net/tls/tls_sw.c ++++ b/net/tls/tls_sw.c +@@ -677,12 +677,32 @@ static int tls_push_record(struct sock *sk, int flags, + + split_point = msg_pl->apply_bytes; + split = split_point && split_point < msg_pl->sg.size; ++ if (unlikely((!split && ++ msg_pl->sg.size + ++ prot->overhead_size > msg_en->sg.size) || ++ (split && ++ split_point + ++ prot->overhead_size > msg_en->sg.size))) { ++ split = true; ++ split_point = msg_en->sg.size; ++ } + if (split) { + rc = tls_split_open_record(sk, rec, &tmp, msg_pl, msg_en, + split_point, prot->overhead_size, + &orig_end); + if (rc < 0) + return rc; ++ /* This can happen if above tls_split_open_record allocates ++ * a single large encryption buffer instead of two smaller ++ * ones. In this case adjust pointers and continue without ++ * split. ++ */ ++ if (!msg_pl->sg.size) { ++ tls_merge_open_record(sk, rec, tmp, orig_end); ++ msg_pl = &rec->msg_plaintext; ++ msg_en = &rec->msg_encrypted; ++ split = false; ++ } + sk_msg_trim(sk, msg_en, msg_pl->sg.size + + prot->overhead_size); + } +@@ -704,6 +724,12 @@ static int tls_push_record(struct sock *sk, int flags, + sg_mark_end(sk_msg_elem(msg_pl, i)); + } + ++ if (msg_pl->sg.end < msg_pl->sg.start) { ++ sg_chain(&msg_pl->sg.data[msg_pl->sg.start], ++ MAX_SKB_FRAGS - msg_pl->sg.start + 1, ++ msg_pl->sg.data); ++ } ++ + i = msg_pl->sg.start; + sg_chain(rec->sg_aead_in, 2, &msg_pl->sg.data[i]); + +@@ -778,10 +804,7 @@ more_data: + if (psock->eval == __SK_NONE) { + delta = msg->sg.size; + psock->eval = sk_psock_msg_verdict(sk, psock, msg); +- if (delta < msg->sg.size) +- delta -= msg->sg.size; +- else +- delta = 0; ++ delta -= msg->sg.size; + } + if (msg->cork_bytes && msg->cork_bytes > msg->sg.size && + !enospc && !full_record) { +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c +index 7b72286922f7..c74646b7a751 100644 +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -10834,6 +10834,7 @@ static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev, + if (err) + return err; + ++ cfg80211_sinfo_release_content(&sinfo); + if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_BEACON_SIGNAL_AVG)) + wdev->cqm_config->last_rssi_event_value = + (s8) sinfo.rx_beacon_signal_avg; +@@ -13787,6 +13788,8 @@ static int nl80211_probe_mesh_link(struct sk_buff *skb, struct genl_info *info) + if (err) + return err; + ++ cfg80211_sinfo_release_content(&sinfo); ++ + return rdev_probe_mesh_link(rdev, dev, dest, buf, len); + } + +diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h +index e853a4fe6f97..3dd9515c836b 100644 +--- a/net/wireless/rdev-ops.h ++++ b/net/wireless/rdev-ops.h +@@ -538,6 +538,10 @@ static inline int + rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed) + { + int ret; ++ ++ if (!rdev->ops->set_wiphy_params) ++ return -EOPNOTSUPP; ++ + trace_rdev_set_wiphy_params(&rdev->wiphy, changed); + ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed); + trace_rdev_return_int(&rdev->wiphy, ret); +diff --git a/net/wireless/sme.c b/net/wireless/sme.c +index 7a6c38ddc65a..d32a2ec4d96a 100644 +--- a/net/wireless/sme.c ++++ b/net/wireless/sme.c +@@ -1307,14 +1307,14 @@ void cfg80211_autodisconnect_wk(struct work_struct *work) + if (wdev->conn_owner_nlportid) { + switch (wdev->iftype) { + case NL80211_IFTYPE_ADHOC: +- cfg80211_leave_ibss(rdev, wdev->netdev, false); ++ __cfg80211_leave_ibss(rdev, wdev->netdev, false); + break; + case NL80211_IFTYPE_AP: + case NL80211_IFTYPE_P2P_GO: +- cfg80211_stop_ap(rdev, wdev->netdev, false); ++ __cfg80211_stop_ap(rdev, wdev->netdev, false); + break; + case NL80211_IFTYPE_MESH_POINT: +- cfg80211_leave_mesh(rdev, wdev->netdev); ++ __cfg80211_leave_mesh(rdev, wdev->netdev); + break; + case NL80211_IFTYPE_STATION: + case NL80211_IFTYPE_P2P_CLIENT: +diff --git a/net/wireless/util.c b/net/wireless/util.c +index 5b4ed5bbc542..8481e9ac33da 100644 +--- a/net/wireless/util.c ++++ b/net/wireless/util.c +@@ -564,7 +564,7 @@ __frame_add_frag(struct sk_buff *skb, struct page *page, + struct skb_shared_info *sh = skb_shinfo(skb); + int page_offset; + +- page_ref_inc(page); ++ get_page(page); + page_offset = ptr - page_address(page); + skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size); + } +diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c +index 161f3170bd7e..3bc6095df44d 100644 +--- a/sound/core/seq/seq_timer.c ++++ b/sound/core/seq/seq_timer.c +@@ -465,15 +465,19 @@ void snd_seq_info_timer_read(struct snd_info_entry *entry, + q = queueptr(idx); + if (q == NULL) + continue; +- if ((tmr = q->timer) == NULL || +- (ti = tmr->timeri) == NULL) { +- queuefree(q); +- continue; +- } ++ mutex_lock(&q->timer_mutex); ++ tmr = q->timer; ++ if (!tmr) ++ goto unlock; ++ ti = tmr->timeri; ++ if (!ti) ++ goto unlock; + snd_iprintf(buffer, "Timer for queue %i : %s\n", q->queue, ti->timer->name); + resolution = snd_timer_resolution(ti) * tmr->ticks; + snd_iprintf(buffer, " Period time : %lu.%09lu\n", resolution / 1000000000, resolution % 1000000000); + snd_iprintf(buffer, " Skew : %u / %u\n", tmr->skew, tmr->skew_base); ++unlock: ++ mutex_unlock(&q->timer_mutex); + queuefree(q); + } + } +diff --git a/sound/firewire/dice/dice-extension.c b/sound/firewire/dice/dice-extension.c +index a63fcbc875ad..02f4a8318e38 100644 +--- a/sound/firewire/dice/dice-extension.c ++++ b/sound/firewire/dice/dice-extension.c +@@ -159,8 +159,11 @@ int snd_dice_detect_extension_formats(struct snd_dice *dice) + int j; + + for (j = i + 1; j < 9; ++j) { +- if (pointers[i * 2] == pointers[j * 2]) ++ if (pointers[i * 2] == pointers[j * 2]) { ++ // Fallback to limited functionality. ++ err = -ENXIO; + goto end; ++ } + } + } + +diff --git a/sound/firewire/tascam/amdtp-tascam.c b/sound/firewire/tascam/amdtp-tascam.c +index e80bb84c43f6..f823a2ab3544 100644 +--- a/sound/firewire/tascam/amdtp-tascam.c ++++ b/sound/firewire/tascam/amdtp-tascam.c +@@ -157,14 +157,15 @@ static void read_status_messages(struct amdtp_stream *s, + if ((before ^ after) & mask) { + struct snd_firewire_tascam_change *entry = + &tscm->queue[tscm->push_pos]; ++ unsigned long flag; + +- spin_lock_irq(&tscm->lock); ++ spin_lock_irqsave(&tscm->lock, flag); + entry->index = index; + entry->before = before; + entry->after = after; + if (++tscm->push_pos >= SND_TSCM_QUEUE_COUNT) + tscm->push_pos = 0; +- spin_unlock_irq(&tscm->lock); ++ spin_unlock_irqrestore(&tscm->lock, flag); + + wake_up(&tscm->hwdep_wait); + } +diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c +index e3d311fb510e..84289ebeae87 100644 +--- a/sound/soc/codecs/msm8916-wcd-analog.c ++++ b/sound/soc/codecs/msm8916-wcd-analog.c +@@ -391,9 +391,6 @@ static int pm8916_wcd_analog_enable_micbias_int(struct snd_soc_component + + switch (event) { + case SND_SOC_DAPM_PRE_PMU: +- snd_soc_component_update_bits(component, CDC_A_MICB_1_INT_RBIAS, +- MICB_1_INT_TX2_INT_RBIAS_EN_MASK, +- MICB_1_INT_TX2_INT_RBIAS_EN_ENABLE); + snd_soc_component_update_bits(component, reg, MICB_1_EN_PULL_DOWN_EN_MASK, 0); + snd_soc_component_update_bits(component, CDC_A_MICB_1_EN, + MICB_1_EN_OPA_STG2_TAIL_CURR_MASK, +@@ -443,6 +440,14 @@ static int pm8916_wcd_analog_enable_micbias_int1(struct + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); + struct pm8916_wcd_analog_priv *wcd = snd_soc_component_get_drvdata(component); + ++ switch (event) { ++ case SND_SOC_DAPM_PRE_PMU: ++ snd_soc_component_update_bits(component, CDC_A_MICB_1_INT_RBIAS, ++ MICB_1_INT_TX1_INT_RBIAS_EN_MASK, ++ MICB_1_INT_TX1_INT_RBIAS_EN_ENABLE); ++ break; ++ } ++ + return pm8916_wcd_analog_enable_micbias_int(component, event, w->reg, + wcd->micbias1_cap_mode); + } +@@ -553,6 +558,11 @@ static int pm8916_wcd_analog_enable_micbias_int2(struct + struct pm8916_wcd_analog_priv *wcd = snd_soc_component_get_drvdata(component); + + switch (event) { ++ case SND_SOC_DAPM_PRE_PMU: ++ snd_soc_component_update_bits(component, CDC_A_MICB_1_INT_RBIAS, ++ MICB_1_INT_TX2_INT_RBIAS_EN_MASK, ++ MICB_1_INT_TX2_INT_RBIAS_EN_ENABLE); ++ break; + case SND_SOC_DAPM_POST_PMU: + pm8916_mbhc_configure_bias(wcd, true); + break; +@@ -888,10 +898,10 @@ static const struct snd_soc_dapm_widget pm8916_wcd_analog_dapm_widgets[] = { + + SND_SOC_DAPM_SUPPLY("MIC BIAS External1", CDC_A_MICB_1_EN, 7, 0, + pm8916_wcd_analog_enable_micbias_ext1, +- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), ++ SND_SOC_DAPM_POST_PMU), + SND_SOC_DAPM_SUPPLY("MIC BIAS External2", CDC_A_MICB_2_EN, 7, 0, + pm8916_wcd_analog_enable_micbias_ext2, +- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), ++ SND_SOC_DAPM_POST_PMU), + + SND_SOC_DAPM_ADC_E("ADC1", NULL, CDC_A_TX_1_EN, 7, 0, + pm8916_wcd_analog_enable_adc, +diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c +index 58b2468fb2a7..09fccacadd6b 100644 +--- a/sound/soc/codecs/msm8916-wcd-digital.c ++++ b/sound/soc/codecs/msm8916-wcd-digital.c +@@ -586,6 +586,12 @@ static int msm8916_wcd_digital_enable_interpolator( + snd_soc_component_write(component, rx_gain_reg[w->shift], + snd_soc_component_read32(component, rx_gain_reg[w->shift])); + break; ++ case SND_SOC_DAPM_POST_PMD: ++ snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL, ++ 1 << w->shift, 1 << w->shift); ++ snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL, ++ 1 << w->shift, 0x0); ++ break; + } + return 0; + } +diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c +index 46612331f5ea..54e97455d7f6 100644 +--- a/sound/soc/intel/boards/bytcht_es8316.c ++++ b/sound/soc/intel/boards/bytcht_es8316.c +@@ -442,7 +442,8 @@ static const struct dmi_system_id byt_cht_es8316_quirk_table[] = { + DMI_MATCH(DMI_SYS_VENDOR, "IRBIS"), + DMI_MATCH(DMI_PRODUCT_NAME, "NB41"), + }, +- .driver_data = (void *)(BYT_CHT_ES8316_INTMIC_IN2_MAP ++ .driver_data = (void *)(BYT_CHT_ES8316_SSP0 ++ | BYT_CHT_ES8316_INTMIC_IN2_MAP + | BYT_CHT_ES8316_JD_INVERTED), + }, + { /* Teclast X98 Plus II */ +diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c +index 3c9a9deec9af..4ecea4913f42 100644 +--- a/sound/soc/stm/stm32_adfsdm.c ++++ b/sound/soc/stm/stm32_adfsdm.c +@@ -153,13 +153,13 @@ static const struct snd_soc_component_driver stm32_adfsdm_dai_component = { + .name = "stm32_dfsdm_audio", + }; + +-static void memcpy_32to16(void *dest, const void *src, size_t n) ++static void stm32_memcpy_32to16(void *dest, const void *src, size_t n) + { + unsigned int i = 0; + u16 *d = (u16 *)dest, *s = (u16 *)src; + + s++; +- for (i = n; i > 0; i--) { ++ for (i = n >> 1; i > 0; i--) { + *d++ = *s++; + s++; + } +@@ -186,8 +186,8 @@ static int stm32_afsdm_pcm_cb(const void *data, size_t size, void *private) + + if ((priv->pos + src_size) > buff_size) { + if (format == SNDRV_PCM_FORMAT_S16_LE) +- memcpy_32to16(&pcm_buff[priv->pos], src_buff, +- buff_size - priv->pos); ++ stm32_memcpy_32to16(&pcm_buff[priv->pos], src_buff, ++ buff_size - priv->pos); + else + memcpy(&pcm_buff[priv->pos], src_buff, + buff_size - priv->pos); +@@ -196,8 +196,8 @@ static int stm32_afsdm_pcm_cb(const void *data, size_t size, void *private) + } + + if (format == SNDRV_PCM_FORMAT_S16_LE) +- memcpy_32to16(&pcm_buff[priv->pos], +- &src_buff[src_size - cur_size], cur_size); ++ stm32_memcpy_32to16(&pcm_buff[priv->pos], ++ &src_buff[src_size - cur_size], cur_size); + else + memcpy(&pcm_buff[priv->pos], &src_buff[src_size - cur_size], + cur_size); +diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c +index 48e629ac2d88..30bcd5d3a32a 100644 +--- a/sound/soc/stm/stm32_sai_sub.c ++++ b/sound/soc/stm/stm32_sai_sub.c +@@ -184,6 +184,56 @@ static bool stm32_sai_sub_writeable_reg(struct device *dev, unsigned int reg) + } + } + ++static int stm32_sai_sub_reg_up(struct stm32_sai_sub_data *sai, ++ unsigned int reg, unsigned int mask, ++ unsigned int val) ++{ ++ int ret; ++ ++ ret = clk_enable(sai->pdata->pclk); ++ if (ret < 0) ++ return ret; ++ ++ ret = regmap_update_bits(sai->regmap, reg, mask, val); ++ ++ clk_disable(sai->pdata->pclk); ++ ++ return ret; ++} ++ ++static int stm32_sai_sub_reg_wr(struct stm32_sai_sub_data *sai, ++ unsigned int reg, unsigned int mask, ++ unsigned int val) ++{ ++ int ret; ++ ++ ret = clk_enable(sai->pdata->pclk); ++ if (ret < 0) ++ return ret; ++ ++ ret = regmap_write_bits(sai->regmap, reg, mask, val); ++ ++ clk_disable(sai->pdata->pclk); ++ ++ return ret; ++} ++ ++static int stm32_sai_sub_reg_rd(struct stm32_sai_sub_data *sai, ++ unsigned int reg, unsigned int *val) ++{ ++ int ret; ++ ++ ret = clk_enable(sai->pdata->pclk); ++ if (ret < 0) ++ return ret; ++ ++ ret = regmap_read(sai->regmap, reg, val); ++ ++ clk_disable(sai->pdata->pclk); ++ ++ return ret; ++} ++ + static const struct regmap_config stm32_sai_sub_regmap_config_f4 = { + .reg_bits = 32, + .reg_stride = 4, +@@ -295,7 +345,7 @@ static int stm32_sai_set_clk_div(struct stm32_sai_sub_data *sai, + + mask = SAI_XCR1_MCKDIV_MASK(SAI_XCR1_MCKDIV_WIDTH(version)); + cr1 = SAI_XCR1_MCKDIV_SET(div); +- ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, mask, cr1); ++ ret = stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX, mask, cr1); + if (ret < 0) + dev_err(&sai->pdev->dev, "Failed to update CR1 register\n"); + +@@ -372,8 +422,8 @@ static int stm32_sai_mclk_enable(struct clk_hw *hw) + + dev_dbg(&sai->pdev->dev, "Enable master clock\n"); + +- return regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, +- SAI_XCR1_MCKEN, SAI_XCR1_MCKEN); ++ return stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX, ++ SAI_XCR1_MCKEN, SAI_XCR1_MCKEN); + } + + static void stm32_sai_mclk_disable(struct clk_hw *hw) +@@ -383,7 +433,7 @@ static void stm32_sai_mclk_disable(struct clk_hw *hw) + + dev_dbg(&sai->pdev->dev, "Disable master clock\n"); + +- regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, SAI_XCR1_MCKEN, 0); ++ stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX, SAI_XCR1_MCKEN, 0); + } + + static const struct clk_ops mclk_ops = { +@@ -446,15 +496,15 @@ static irqreturn_t stm32_sai_isr(int irq, void *devid) + unsigned int sr, imr, flags; + snd_pcm_state_t status = SNDRV_PCM_STATE_RUNNING; + +- regmap_read(sai->regmap, STM_SAI_IMR_REGX, &imr); +- regmap_read(sai->regmap, STM_SAI_SR_REGX, &sr); ++ stm32_sai_sub_reg_rd(sai, STM_SAI_IMR_REGX, &imr); ++ stm32_sai_sub_reg_rd(sai, STM_SAI_SR_REGX, &sr); + + flags = sr & imr; + if (!flags) + return IRQ_NONE; + +- regmap_write_bits(sai->regmap, STM_SAI_CLRFR_REGX, SAI_XCLRFR_MASK, +- SAI_XCLRFR_MASK); ++ stm32_sai_sub_reg_wr(sai, STM_SAI_CLRFR_REGX, SAI_XCLRFR_MASK, ++ SAI_XCLRFR_MASK); + + if (!sai->substream) { + dev_err(&pdev->dev, "Device stopped. Spurious IRQ 0x%x\n", sr); +@@ -503,8 +553,8 @@ static int stm32_sai_set_sysclk(struct snd_soc_dai *cpu_dai, + int ret; + + if (dir == SND_SOC_CLOCK_OUT && sai->sai_mclk) { +- ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, +- SAI_XCR1_NODIV, ++ ret = stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX, ++ SAI_XCR1_NODIV, + freq ? 0 : SAI_XCR1_NODIV); + if (ret < 0) + return ret; +@@ -583,7 +633,7 @@ static int stm32_sai_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, u32 tx_mask, + + slotr_mask |= SAI_XSLOTR_SLOTEN_MASK; + +- regmap_update_bits(sai->regmap, STM_SAI_SLOTR_REGX, slotr_mask, slotr); ++ stm32_sai_sub_reg_up(sai, STM_SAI_SLOTR_REGX, slotr_mask, slotr); + + sai->slot_width = slot_width; + sai->slots = slots; +@@ -665,7 +715,7 @@ static int stm32_sai_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) + cr1_mask |= SAI_XCR1_CKSTR; + frcr_mask |= SAI_XFRCR_FSPOL; + +- regmap_update_bits(sai->regmap, STM_SAI_FRCR_REGX, frcr_mask, frcr); ++ stm32_sai_sub_reg_up(sai, STM_SAI_FRCR_REGX, frcr_mask, frcr); + + /* DAI clock master masks */ + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { +@@ -693,7 +743,7 @@ static int stm32_sai_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) + cr1_mask |= SAI_XCR1_SLAVE; + + conf_update: +- ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, cr1_mask, cr1); ++ ret = stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX, cr1_mask, cr1); + if (ret < 0) { + dev_err(cpu_dai->dev, "Failed to update CR1 register\n"); + return ret; +@@ -730,12 +780,12 @@ static int stm32_sai_startup(struct snd_pcm_substream *substream, + } + + /* Enable ITs */ +- regmap_write_bits(sai->regmap, STM_SAI_CLRFR_REGX, +- SAI_XCLRFR_MASK, SAI_XCLRFR_MASK); ++ stm32_sai_sub_reg_wr(sai, STM_SAI_CLRFR_REGX, ++ SAI_XCLRFR_MASK, SAI_XCLRFR_MASK); + + imr = SAI_XIMR_OVRUDRIE; + if (STM_SAI_IS_CAPTURE(sai)) { +- regmap_read(sai->regmap, STM_SAI_CR2_REGX, &cr2); ++ stm32_sai_sub_reg_rd(sai, STM_SAI_CR2_REGX, &cr2); + if (cr2 & SAI_XCR2_MUTECNT_MASK) + imr |= SAI_XIMR_MUTEDETIE; + } +@@ -745,8 +795,8 @@ static int stm32_sai_startup(struct snd_pcm_substream *substream, + else + imr |= SAI_XIMR_AFSDETIE | SAI_XIMR_LFSDETIE; + +- regmap_update_bits(sai->regmap, STM_SAI_IMR_REGX, +- SAI_XIMR_MASK, imr); ++ stm32_sai_sub_reg_up(sai, STM_SAI_IMR_REGX, ++ SAI_XIMR_MASK, imr); + + return 0; + } +@@ -763,10 +813,10 @@ static int stm32_sai_set_config(struct snd_soc_dai *cpu_dai, + * SAI fifo threshold is set to half fifo, to keep enough space + * for DMA incoming bursts. + */ +- regmap_write_bits(sai->regmap, STM_SAI_CR2_REGX, +- SAI_XCR2_FFLUSH | SAI_XCR2_FTH_MASK, +- SAI_XCR2_FFLUSH | +- SAI_XCR2_FTH_SET(STM_SAI_FIFO_TH_HALF)); ++ stm32_sai_sub_reg_wr(sai, STM_SAI_CR2_REGX, ++ SAI_XCR2_FFLUSH | SAI_XCR2_FTH_MASK, ++ SAI_XCR2_FFLUSH | ++ SAI_XCR2_FTH_SET(STM_SAI_FIFO_TH_HALF)); + + /* DS bits in CR1 not set for SPDIF (size forced to 24 bits).*/ + if (STM_SAI_PROTOCOL_IS_SPDIF(sai)) { +@@ -795,7 +845,7 @@ static int stm32_sai_set_config(struct snd_soc_dai *cpu_dai, + if ((sai->slots == 2) && (params_channels(params) == 1)) + cr1 |= SAI_XCR1_MONO; + +- ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, cr1_mask, cr1); ++ ret = stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX, cr1_mask, cr1); + if (ret < 0) { + dev_err(cpu_dai->dev, "Failed to update CR1 register\n"); + return ret; +@@ -809,7 +859,7 @@ static int stm32_sai_set_slots(struct snd_soc_dai *cpu_dai) + struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai); + int slotr, slot_sz; + +- regmap_read(sai->regmap, STM_SAI_SLOTR_REGX, &slotr); ++ stm32_sai_sub_reg_rd(sai, STM_SAI_SLOTR_REGX, &slotr); + + /* + * If SLOTSZ is set to auto in SLOTR, align slot width on data size +@@ -831,16 +881,16 @@ static int stm32_sai_set_slots(struct snd_soc_dai *cpu_dai) + sai->slots = 2; + + /* The number of slots in the audio frame is equal to NBSLOT[3:0] + 1*/ +- regmap_update_bits(sai->regmap, STM_SAI_SLOTR_REGX, +- SAI_XSLOTR_NBSLOT_MASK, +- SAI_XSLOTR_NBSLOT_SET((sai->slots - 1))); ++ stm32_sai_sub_reg_up(sai, STM_SAI_SLOTR_REGX, ++ SAI_XSLOTR_NBSLOT_MASK, ++ SAI_XSLOTR_NBSLOT_SET((sai->slots - 1))); + + /* Set default slots mask if not already set from DT */ + if (!(slotr & SAI_XSLOTR_SLOTEN_MASK)) { + sai->slot_mask = (1 << sai->slots) - 1; +- regmap_update_bits(sai->regmap, +- STM_SAI_SLOTR_REGX, SAI_XSLOTR_SLOTEN_MASK, +- SAI_XSLOTR_SLOTEN_SET(sai->slot_mask)); ++ stm32_sai_sub_reg_up(sai, ++ STM_SAI_SLOTR_REGX, SAI_XSLOTR_SLOTEN_MASK, ++ SAI_XSLOTR_SLOTEN_SET(sai->slot_mask)); + } + + dev_dbg(cpu_dai->dev, "Slots %d, slot width %d\n", +@@ -870,14 +920,14 @@ static void stm32_sai_set_frame(struct snd_soc_dai *cpu_dai) + dev_dbg(cpu_dai->dev, "Frame length %d, frame active %d\n", + sai->fs_length, fs_active); + +- regmap_update_bits(sai->regmap, STM_SAI_FRCR_REGX, frcr_mask, frcr); ++ stm32_sai_sub_reg_up(sai, STM_SAI_FRCR_REGX, frcr_mask, frcr); + + if ((sai->fmt & SND_SOC_DAIFMT_FORMAT_MASK) == SND_SOC_DAIFMT_LSB) { + offset = sai->slot_width - sai->data_size; + +- regmap_update_bits(sai->regmap, STM_SAI_SLOTR_REGX, +- SAI_XSLOTR_FBOFF_MASK, +- SAI_XSLOTR_FBOFF_SET(offset)); ++ stm32_sai_sub_reg_up(sai, STM_SAI_SLOTR_REGX, ++ SAI_XSLOTR_FBOFF_MASK, ++ SAI_XSLOTR_FBOFF_SET(offset)); + } + } + +@@ -994,9 +1044,9 @@ static int stm32_sai_configure_clock(struct snd_soc_dai *cpu_dai, + return -EINVAL; + } + +- regmap_update_bits(sai->regmap, +- STM_SAI_CR1_REGX, +- SAI_XCR1_OSR, cr1); ++ stm32_sai_sub_reg_up(sai, ++ STM_SAI_CR1_REGX, ++ SAI_XCR1_OSR, cr1); + + div = stm32_sai_get_clk_div(sai, sai_clk_rate, + sai->mclk_rate); +@@ -1058,12 +1108,12 @@ static int stm32_sai_trigger(struct snd_pcm_substream *substream, int cmd, + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: + dev_dbg(cpu_dai->dev, "Enable DMA and SAI\n"); + +- regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, +- SAI_XCR1_DMAEN, SAI_XCR1_DMAEN); ++ stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX, ++ SAI_XCR1_DMAEN, SAI_XCR1_DMAEN); + + /* Enable SAI */ +- ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, +- SAI_XCR1_SAIEN, SAI_XCR1_SAIEN); ++ ret = stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX, ++ SAI_XCR1_SAIEN, SAI_XCR1_SAIEN); + if (ret < 0) + dev_err(cpu_dai->dev, "Failed to update CR1 register\n"); + break; +@@ -1072,16 +1122,16 @@ static int stm32_sai_trigger(struct snd_pcm_substream *substream, int cmd, + case SNDRV_PCM_TRIGGER_STOP: + dev_dbg(cpu_dai->dev, "Disable DMA and SAI\n"); + +- regmap_update_bits(sai->regmap, STM_SAI_IMR_REGX, +- SAI_XIMR_MASK, 0); ++ stm32_sai_sub_reg_up(sai, STM_SAI_IMR_REGX, ++ SAI_XIMR_MASK, 0); + +- regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, +- SAI_XCR1_SAIEN, +- (unsigned int)~SAI_XCR1_SAIEN); ++ stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX, ++ SAI_XCR1_SAIEN, ++ (unsigned int)~SAI_XCR1_SAIEN); + +- ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, +- SAI_XCR1_DMAEN, +- (unsigned int)~SAI_XCR1_DMAEN); ++ ret = stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX, ++ SAI_XCR1_DMAEN, ++ (unsigned int)~SAI_XCR1_DMAEN); + if (ret < 0) + dev_err(cpu_dai->dev, "Failed to update CR1 register\n"); + +@@ -1101,7 +1151,7 @@ static void stm32_sai_shutdown(struct snd_pcm_substream *substream, + struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai); + unsigned long flags; + +- regmap_update_bits(sai->regmap, STM_SAI_IMR_REGX, SAI_XIMR_MASK, 0); ++ stm32_sai_sub_reg_up(sai, STM_SAI_IMR_REGX, SAI_XIMR_MASK, 0); + + clk_disable_unprepare(sai->sai_ck); + +@@ -1169,7 +1219,7 @@ static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai) + cr1_mask |= SAI_XCR1_SYNCEN_MASK; + cr1 |= SAI_XCR1_SYNCEN_SET(sai->sync); + +- return regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, cr1_mask, cr1); ++ return stm32_sai_sub_reg_up(sai, STM_SAI_CR1_REGX, cr1_mask, cr1); + } + + static const struct snd_soc_dai_ops stm32_sai_pcm_dai_ops = { +@@ -1322,8 +1372,13 @@ static int stm32_sai_sub_parse_of(struct platform_device *pdev, + if (STM_SAI_HAS_PDM(sai) && STM_SAI_IS_SUB_A(sai)) + sai->regmap_config = &stm32_sai_sub_regmap_config_h7; + +- sai->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "sai_ck", +- base, sai->regmap_config); ++ /* ++ * Do not manage peripheral clock through regmap framework as this ++ * can lead to circular locking issue with sai master clock provider. ++ * Manage peripheral clock directly in driver instead. ++ */ ++ sai->regmap = devm_regmap_init_mmio(&pdev->dev, base, ++ sai->regmap_config); + if (IS_ERR(sai->regmap)) { + dev_err(&pdev->dev, "Failed to initialize MMIO\n"); + return PTR_ERR(sai->regmap); +@@ -1420,6 +1475,10 @@ static int stm32_sai_sub_parse_of(struct platform_device *pdev, + return PTR_ERR(sai->sai_ck); + } + ++ ret = clk_prepare(sai->pdata->pclk); ++ if (ret < 0) ++ return ret; ++ + if (STM_SAI_IS_F4(sai->pdata)) + return 0; + +@@ -1501,22 +1560,48 @@ static int stm32_sai_sub_probe(struct platform_device *pdev) + return 0; + } + ++static int stm32_sai_sub_remove(struct platform_device *pdev) ++{ ++ struct stm32_sai_sub_data *sai = dev_get_drvdata(&pdev->dev); ++ ++ clk_unprepare(sai->pdata->pclk); ++ ++ return 0; ++} ++ + #ifdef CONFIG_PM_SLEEP + static int stm32_sai_sub_suspend(struct device *dev) + { + struct stm32_sai_sub_data *sai = dev_get_drvdata(dev); ++ int ret; ++ ++ ret = clk_enable(sai->pdata->pclk); ++ if (ret < 0) ++ return ret; + + regcache_cache_only(sai->regmap, true); + regcache_mark_dirty(sai->regmap); ++ ++ clk_disable(sai->pdata->pclk); ++ + return 0; + } + + static int stm32_sai_sub_resume(struct device *dev) + { + struct stm32_sai_sub_data *sai = dev_get_drvdata(dev); ++ int ret; ++ ++ ret = clk_enable(sai->pdata->pclk); ++ if (ret < 0) ++ return ret; + + regcache_cache_only(sai->regmap, false); +- return regcache_sync(sai->regmap); ++ ret = regcache_sync(sai->regmap); ++ ++ clk_disable(sai->pdata->pclk); ++ ++ return ret; + } + #endif /* CONFIG_PM_SLEEP */ + +@@ -1531,6 +1616,7 @@ static struct platform_driver stm32_sai_sub_driver = { + .pm = &stm32_sai_sub_pm_ops, + }, + .probe = stm32_sai_sub_probe, ++ .remove = stm32_sai_sub_remove, + }; + + module_platform_driver(stm32_sai_sub_driver); +diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c +index a04c727dcd19..fa24bd491cf6 100644 +--- a/sound/usb/pcm.c ++++ b/sound/usb/pcm.c +@@ -370,7 +370,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, + add_sync_ep_from_ifnum: + iface = usb_ifnum_to_if(dev, ifnum); + +- if (!iface || iface->num_altsetting == 0) ++ if (!iface || iface->num_altsetting < 2) + return -EINVAL; + + alts = &iface->altsetting[1]; +diff --git a/tools/bpf/bpftool/btf_dumper.c b/tools/bpf/bpftool/btf_dumper.c +index d66131f69689..397e5716ab6d 100644 +--- a/tools/bpf/bpftool/btf_dumper.c ++++ b/tools/bpf/bpftool/btf_dumper.c +@@ -26,7 +26,7 @@ static void btf_dumper_ptr(const void *data, json_writer_t *jw, + bool is_plain_text) + { + if (is_plain_text) +- jsonw_printf(jw, "%p", data); ++ jsonw_printf(jw, "%p", *(void **)data); + else + jsonw_printf(jw, "%lu", *(unsigned long *)data); + } +diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c +index 7accaf8ef689..ea3f0745d7ad 100644 +--- a/tools/perf/builtin-report.c ++++ b/tools/perf/builtin-report.c +@@ -1031,6 +1031,7 @@ int cmd_report(int argc, const char **argv) + struct stat st; + bool has_br_stack = false; + int branch_mode = -1; ++ int last_key = 0; + bool branch_call_mode = false; + #define CALLCHAIN_DEFAULT_OPT "graph,0.5,caller,function,percent" + static const char report_callchain_help[] = "Display call graph (stack chain/backtrace):\n\n" +@@ -1396,7 +1397,8 @@ repeat: + sort_order = sort_tmp; + } + +- if (setup_sorting(session->evlist) < 0) { ++ if ((last_key != K_SWITCH_INPUT_DATA) && ++ (setup_sorting(session->evlist) < 0)) { + if (sort_order) + parse_options_usage(report_usage, options, "s", 1); + if (field_order) +@@ -1475,6 +1477,7 @@ repeat: + ret = __cmd_report(&report); + if (ret == K_SWITCH_INPUT_DATA) { + perf_session__delete(session); ++ last_key = K_SWITCH_INPUT_DATA; + goto repeat; + } else + ret = 0; +diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c +index 3983d6ccd14d..da016f398aa8 100644 +--- a/tools/perf/builtin-script.c ++++ b/tools/perf/builtin-script.c +@@ -3605,11 +3605,6 @@ int cmd_script(int argc, const char **argv) + } + } + +- if (script.time_str && reltime) { +- fprintf(stderr, "Don't combine --reltime with --time\n"); +- return -1; +- } +- + if (itrace_synth_opts.callchain && + itrace_synth_opts.callchain_sz > scripting_max_stack) + scripting_max_stack = itrace_synth_opts.callchain_sz; +@@ -3869,10 +3864,11 @@ int cmd_script(int argc, const char **argv) + goto out_delete; + + if (script.time_str) { +- err = perf_time__parse_for_ranges(script.time_str, session, ++ err = perf_time__parse_for_ranges_reltime(script.time_str, session, + &script.ptime_range, + &script.range_size, +- &script.range_num); ++ &script.range_num, ++ reltime); + if (err < 0) + goto out_delete; + +diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h +index 6a186b668303..479273130794 100644 +--- a/tools/perf/util/hist.h ++++ b/tools/perf/util/hist.h +@@ -339,10 +339,10 @@ static inline void perf_hpp__prepend_sort_field(struct perf_hpp_fmt *format) + list_for_each_entry_safe(format, tmp, &(_list)->sorts, sort_list) + + #define hists__for_each_format(hists, format) \ +- perf_hpp_list__for_each_format((hists)->hpp_list, fmt) ++ perf_hpp_list__for_each_format((hists)->hpp_list, format) + + #define hists__for_each_sort_list(hists, format) \ +- perf_hpp_list__for_each_sort_list((hists)->hpp_list, fmt) ++ perf_hpp_list__for_each_sort_list((hists)->hpp_list, format) + + extern struct perf_hpp_fmt perf_hpp__format[]; + +diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c +index 08cccd86447c..9ecea45da4ca 100644 +--- a/tools/perf/util/probe-finder.c ++++ b/tools/perf/util/probe-finder.c +@@ -604,38 +604,26 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwfl_Module *mod, + const char *function, + struct probe_trace_point *tp) + { +- Dwarf_Addr eaddr, highaddr; ++ Dwarf_Addr eaddr; + GElf_Sym sym; + const char *symbol; + + /* Verify the address is correct */ +- if (dwarf_entrypc(sp_die, &eaddr) != 0) { +- pr_warning("Failed to get entry address of %s\n", +- dwarf_diename(sp_die)); +- return -ENOENT; +- } +- if (dwarf_highpc(sp_die, &highaddr) != 0) { +- pr_warning("Failed to get end address of %s\n", +- dwarf_diename(sp_die)); +- return -ENOENT; +- } +- if (paddr > highaddr) { +- pr_warning("Offset specified is greater than size of %s\n", ++ if (!dwarf_haspc(sp_die, paddr)) { ++ pr_warning("Specified offset is out of %s\n", + dwarf_diename(sp_die)); + return -EINVAL; + } + +- symbol = dwarf_diename(sp_die); ++ /* Try to get actual symbol name from symtab */ ++ symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL); + if (!symbol) { +- /* Try to get the symbol name from symtab */ +- symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL); +- if (!symbol) { +- pr_warning("Failed to find symbol at 0x%lx\n", +- (unsigned long)paddr); +- return -ENOENT; +- } +- eaddr = sym.st_value; ++ pr_warning("Failed to find symbol at 0x%lx\n", ++ (unsigned long)paddr); ++ return -ENOENT; + } ++ eaddr = sym.st_value; ++ + tp->offset = (unsigned long)(paddr - eaddr); + tp->address = (unsigned long)paddr; + tp->symbol = strdup(symbol); +diff --git a/tools/perf/util/time-utils.c b/tools/perf/util/time-utils.c +index 9796a2e43f67..302443921681 100644 +--- a/tools/perf/util/time-utils.c ++++ b/tools/perf/util/time-utils.c +@@ -458,10 +458,11 @@ bool perf_time__ranges_skip_sample(struct perf_time_interval *ptime_buf, + return true; + } + +-int perf_time__parse_for_ranges(const char *time_str, ++int perf_time__parse_for_ranges_reltime(const char *time_str, + struct perf_session *session, + struct perf_time_interval **ranges, +- int *range_size, int *range_num) ++ int *range_size, int *range_num, ++ bool reltime) + { + bool has_percent = strchr(time_str, '%'); + struct perf_time_interval *ptime_range; +@@ -471,7 +472,7 @@ int perf_time__parse_for_ranges(const char *time_str, + if (!ptime_range) + return -ENOMEM; + +- if (has_percent) { ++ if (has_percent || reltime) { + if (session->evlist->first_sample_time == 0 && + session->evlist->last_sample_time == 0) { + pr_err("HINT: no first/last sample time found in perf data.\n" +@@ -479,7 +480,9 @@ int perf_time__parse_for_ranges(const char *time_str, + "(if '--buildid-all' is enabled, please set '--timestamp-boundary').\n"); + goto error; + } ++ } + ++ if (has_percent) { + num = perf_time__percent_parse_str( + ptime_range, size, + time_str, +@@ -492,6 +495,15 @@ int perf_time__parse_for_ranges(const char *time_str, + if (num < 0) + goto error_invalid; + ++ if (reltime) { ++ int i; ++ ++ for (i = 0; i < num; i++) { ++ ptime_range[i].start += session->evlist->first_sample_time; ++ ptime_range[i].end += session->evlist->first_sample_time; ++ } ++ } ++ + *range_size = size; + *range_num = num; + *ranges = ptime_range; +@@ -504,6 +516,15 @@ error: + return ret; + } + ++int perf_time__parse_for_ranges(const char *time_str, ++ struct perf_session *session, ++ struct perf_time_interval **ranges, ++ int *range_size, int *range_num) ++{ ++ return perf_time__parse_for_ranges_reltime(time_str, session, ranges, ++ range_size, range_num, false); ++} ++ + int timestamp__scnprintf_usec(u64 timestamp, char *buf, size_t sz) + { + u64 sec = timestamp / NSEC_PER_SEC; +diff --git a/tools/perf/util/time-utils.h b/tools/perf/util/time-utils.h +index 4f42988eb2f7..1142b0bddd5e 100644 +--- a/tools/perf/util/time-utils.h ++++ b/tools/perf/util/time-utils.h +@@ -26,6 +26,11 @@ bool perf_time__ranges_skip_sample(struct perf_time_interval *ptime_buf, + + struct perf_session; + ++int perf_time__parse_for_ranges_reltime(const char *str, struct perf_session *session, ++ struct perf_time_interval **ranges, ++ int *range_size, int *range_num, ++ bool reltime); ++ + int perf_time__parse_for_ranges(const char *str, struct perf_session *session, + struct perf_time_interval **ranges, + int *range_size, int *range_num); +diff --git a/tools/testing/selftests/drivers/net/mlxsw/qos_mc_aware.sh b/tools/testing/selftests/drivers/net/mlxsw/qos_mc_aware.sh +index 47315fe48d5a..24dd8ed48580 100755 +--- a/tools/testing/selftests/drivers/net/mlxsw/qos_mc_aware.sh ++++ b/tools/testing/selftests/drivers/net/mlxsw/qos_mc_aware.sh +@@ -232,7 +232,7 @@ test_mc_aware() + stop_traffic + local ucth1=${uc_rate[1]} + +- start_traffic $h1 own bc bc ++ start_traffic $h1 192.0.2.65 bc bc + + local d0=$(date +%s) + local t0=$(ethtool_stats_get $h3 rx_octets_prio_0) +@@ -254,7 +254,11 @@ test_mc_aware() + ret = 100 * ($ucth1 - $ucth2) / $ucth1 + if (ret > 0) { ret } else { 0 } + ") +- check_err $(bc <<< "$deg > 25") ++ ++ # Minimum shaper of 200Mbps on MC TCs should cause about 20% of ++ # degradation on 1Gbps link. ++ check_err $(bc <<< "$deg < 15") "Minimum shaper not in effect" ++ check_err $(bc <<< "$deg > 25") "MC traffic degrades UC performance too much" + + local interval=$((d1 - d0)) + local mc_ir=$(rate $u0 $u1 $interval) diff --git a/patch/kernel/odroidxu4-current/03-patch-5.4.14-15.patch b/patch/kernel/odroidxu4-current/03-patch-5.4.14-15.patch new file mode 100644 index 000000000..ef45a171b --- /dev/null +++ b/patch/kernel/odroidxu4-current/03-patch-5.4.14-15.patch @@ -0,0 +1,4477 @@ +diff --git a/Documentation/devicetree/bindings/rng/omap3_rom_rng.txt b/Documentation/devicetree/bindings/rng/omap3_rom_rng.txt +new file mode 100644 +index 000000000000..f315c9723bd2 +--- /dev/null ++++ b/Documentation/devicetree/bindings/rng/omap3_rom_rng.txt +@@ -0,0 +1,27 @@ ++OMAP ROM RNG driver binding ++ ++Secure SoCs may provide RNG via secure ROM calls like Nokia N900 does. The ++implementation can depend on the SoC secure ROM used. ++ ++- compatible: ++ Usage: required ++ Value type: ++ Definition: must be "nokia,n900-rom-rng" ++ ++- clocks: ++ Usage: required ++ Value type: ++ Definition: reference to the the RNG interface clock ++ ++- clock-names: ++ Usage: required ++ Value type: ++ Definition: must be "ick" ++ ++Example: ++ ++ rom_rng: rng { ++ compatible = "nokia,n900-rom-rng"; ++ clocks = <&rng_ick>; ++ clock-names = "ick"; ++ }; +diff --git a/Makefile b/Makefile +index 2b2080d08bb2..30600e309c73 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 14 ++SUBLEVEL = 15 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit-28.dts b/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit-28.dts +index 07ac99b9cda6..cdb89b3e2a9b 100644 +--- a/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit-28.dts ++++ b/arch/arm/boot/dts/logicpd-torpedo-37xx-devkit-28.dts +@@ -11,22 +11,6 @@ + #include "logicpd-torpedo-37xx-devkit.dts" + + &lcd0 { +- +- label = "28"; +- +- panel-timing { +- clock-frequency = <9000000>; +- hactive = <480>; +- vactive = <272>; +- hfront-porch = <3>; +- hback-porch = <2>; +- hsync-len = <42>; +- vback-porch = <3>; +- vfront-porch = <2>; +- vsync-len = <11>; +- hsync-active = <1>; +- vsync-active = <1>; +- de-active = <1>; +- pixelclk-active = <0>; +- }; ++ /* To make it work, set CONFIG_OMAP2_DSS_MIN_FCK_PER_PCK=4 */ ++ compatible = "logicpd,type28"; + }; +diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts +index 84a5ade1e865..63659880eeb3 100644 +--- a/arch/arm/boot/dts/omap3-n900.dts ++++ b/arch/arm/boot/dts/omap3-n900.dts +@@ -155,6 +155,12 @@ + pwms = <&pwm9 0 26316 0>; /* 38000 Hz */ + }; + ++ rom_rng: rng { ++ compatible = "nokia,n900-rom-rng"; ++ clocks = <&rng_ick>; ++ clock-names = "ick"; ++ }; ++ + /* controlled (enabled/disabled) directly by bcm2048 and wl1251 */ + vctcxo: vctcxo { + compatible = "fixed-clock"; +diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c +index 439e143cad7b..46012ca812f4 100644 +--- a/arch/arm/mach-omap2/display.c ++++ b/arch/arm/mach-omap2/display.c +@@ -265,6 +265,7 @@ static int __init omapdss_init_of(void) + r = of_platform_populate(node, NULL, NULL, &pdev->dev); + if (r) { + pr_err("Unable to populate DSS submodule devices\n"); ++ put_device(&pdev->dev); + return r; + } + +diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c +index 33688e1d9acf..247e3f8acffe 100644 +--- a/arch/arm/mach-omap2/pdata-quirks.c ++++ b/arch/arm/mach-omap2/pdata-quirks.c +@@ -268,14 +268,6 @@ static void __init am3517_evm_legacy_init(void) + am35xx_emac_reset(); + } + +-static struct platform_device omap3_rom_rng_device = { +- .name = "omap3-rom-rng", +- .id = -1, +- .dev = { +- .platform_data = rx51_secure_rng_call, +- }, +-}; +- + static void __init nokia_n900_legacy_init(void) + { + hsmmc2_internal_input_clk(); +@@ -291,9 +283,6 @@ static void __init nokia_n900_legacy_init(void) + pr_warn("RX-51: Not enabling ARM errata 430973 workaround\n"); + pr_warn("Thumb binaries may crash randomly without this workaround\n"); + } +- +- pr_info("RX-51: Registering OMAP3 HWRNG device\n"); +- platform_device_register(&omap3_rom_rng_device); + } + } + +@@ -538,6 +527,7 @@ static struct of_dev_auxdata omap_auxdata_lookup[] = { + OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL), + OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0", + &am35xx_emac_pdata), ++ OF_DEV_AUXDATA("nokia,n900-rom-rng", 0, NULL, rx51_secure_rng_call), + /* McBSP modules with sidetone core */ + #if IS_ENABLED(CONFIG_SND_SOC_OMAP_MCBSP) + OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49022000, "49022000.mcbsp", &mcbsp_pdata), +diff --git a/arch/powerpc/include/asm/archrandom.h b/arch/powerpc/include/asm/archrandom.h +index 9c63b596e6ce..a09595f00cab 100644 +--- a/arch/powerpc/include/asm/archrandom.h ++++ b/arch/powerpc/include/asm/archrandom.h +@@ -28,7 +28,7 @@ static inline int arch_get_random_seed_int(unsigned int *v) + unsigned long val; + int rc; + +- rc = arch_get_random_long(&val); ++ rc = arch_get_random_seed_long(&val); + if (rc) + *v = val; + +diff --git a/arch/powerpc/include/asm/security_features.h b/arch/powerpc/include/asm/security_features.h +index ccf44c135389..7c05e95a5c44 100644 +--- a/arch/powerpc/include/asm/security_features.h ++++ b/arch/powerpc/include/asm/security_features.h +@@ -9,7 +9,7 @@ + #define _ASM_POWERPC_SECURITY_FEATURES_H + + +-extern unsigned long powerpc_security_features; ++extern u64 powerpc_security_features; + extern bool rfi_flush; + + /* These are bit flags */ +@@ -24,17 +24,17 @@ void setup_stf_barrier(void); + void do_stf_barrier_fixups(enum stf_barrier_type types); + void setup_count_cache_flush(void); + +-static inline void security_ftr_set(unsigned long feature) ++static inline void security_ftr_set(u64 feature) + { + powerpc_security_features |= feature; + } + +-static inline void security_ftr_clear(unsigned long feature) ++static inline void security_ftr_clear(u64 feature) + { + powerpc_security_features &= ~feature; + } + +-static inline bool security_ftr_enabled(unsigned long feature) ++static inline bool security_ftr_enabled(u64 feature) + { + return !!(powerpc_security_features & feature); + } +diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S +index adf0505dbe02..519d49547e2f 100644 +--- a/arch/powerpc/kernel/head_fsl_booke.S ++++ b/arch/powerpc/kernel/head_fsl_booke.S +@@ -238,6 +238,9 @@ set_ivor: + + bl early_init + ++#ifdef CONFIG_KASAN ++ bl kasan_early_init ++#endif + #ifdef CONFIG_RELOCATABLE + mr r3,r30 + mr r4,r31 +@@ -264,9 +267,6 @@ set_ivor: + /* + * Decide what sort of machine this is and initialize the MMU. + */ +-#ifdef CONFIG_KASAN +- bl kasan_early_init +-#endif + mr r3,r30 + mr r4,r31 + bl machine_init +diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c +index 100f1b57ec2f..eba9d4ee4baf 100644 +--- a/arch/powerpc/kernel/prom_init.c ++++ b/arch/powerpc/kernel/prom_init.c +@@ -1053,7 +1053,7 @@ static const struct ibm_arch_vec ibm_architecture_vec_template __initconst = { + .reserved2 = 0, + .reserved3 = 0, + .subprocessors = 1, +- .byte22 = OV5_FEAT(OV5_DRMEM_V2), ++ .byte22 = OV5_FEAT(OV5_DRMEM_V2) | OV5_FEAT(OV5_DRC_INFO), + .intarch = 0, + .mmu = 0, + .hash_ext = 0, +diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c +index d341b464f23c..1740a66cea84 100644 +--- a/arch/powerpc/kernel/security.c ++++ b/arch/powerpc/kernel/security.c +@@ -16,7 +16,7 @@ + #include + + +-unsigned long powerpc_security_features __read_mostly = SEC_FTR_DEFAULT; ++u64 powerpc_security_features __read_mostly = SEC_FTR_DEFAULT; + + enum count_cache_flush_type { + COUNT_CACHE_FLUSH_NONE = 0x1, +@@ -109,7 +109,7 @@ device_initcall(barrier_nospec_debugfs_init); + static __init int security_feature_debugfs_init(void) + { + debugfs_create_x64("security_features", 0400, powerpc_debugfs_root, +- (u64 *)&powerpc_security_features); ++ &powerpc_security_features); + return 0; + } + device_initcall(security_feature_debugfs_init); +diff --git a/block/bio-integrity.c b/block/bio-integrity.c +index fb95dbb21dd8..bf62c25cde8f 100644 +--- a/block/bio-integrity.c ++++ b/block/bio-integrity.c +@@ -87,7 +87,7 @@ EXPORT_SYMBOL(bio_integrity_alloc); + * Description: Used to free the integrity portion of a bio. Usually + * called from bio_free(). + */ +-static void bio_integrity_free(struct bio *bio) ++void bio_integrity_free(struct bio *bio) + { + struct bio_integrity_payload *bip = bio_integrity(bio); + struct bio_set *bs = bio->bi_pool; +diff --git a/block/bio.c b/block/bio.c +index 906da3581a3e..94d697217887 100644 +--- a/block/bio.c ++++ b/block/bio.c +@@ -233,6 +233,9 @@ fallback: + void bio_uninit(struct bio *bio) + { + bio_disassociate_blkg(bio); ++ ++ if (bio_integrity(bio)) ++ bio_integrity_free(bio); + } + EXPORT_SYMBOL(bio_uninit); + +diff --git a/block/blk.h b/block/blk.h +index ffea1691470e..ee3d5664d962 100644 +--- a/block/blk.h ++++ b/block/blk.h +@@ -122,6 +122,7 @@ static inline void blk_rq_bio_prep(struct request *rq, struct bio *bio, + #ifdef CONFIG_BLK_DEV_INTEGRITY + void blk_flush_integrity(void); + bool __bio_integrity_endio(struct bio *); ++void bio_integrity_free(struct bio *bio); + static inline bool bio_integrity_endio(struct bio *bio) + { + if (bio_integrity(bio)) +@@ -167,6 +168,9 @@ static inline bool bio_integrity_endio(struct bio *bio) + { + return true; + } ++static inline void bio_integrity_free(struct bio *bio) ++{ ++} + #endif /* CONFIG_BLK_DEV_INTEGRITY */ + + unsigned long blk_rq_timeout(unsigned long timeout); +diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c +index 00ec4f2bf015..c05050f474cd 100644 +--- a/drivers/acpi/acpi_platform.c ++++ b/drivers/acpi/acpi_platform.c +@@ -31,6 +31,44 @@ static const struct acpi_device_id forbidden_id_list[] = { + {"", 0}, + }; + ++static struct platform_device *acpi_platform_device_find_by_companion(struct acpi_device *adev) ++{ ++ struct device *dev; ++ ++ dev = bus_find_device_by_acpi_dev(&platform_bus_type, adev); ++ return dev ? to_platform_device(dev) : NULL; ++} ++ ++static int acpi_platform_device_remove_notify(struct notifier_block *nb, ++ unsigned long value, void *arg) ++{ ++ struct acpi_device *adev = arg; ++ struct platform_device *pdev; ++ ++ switch (value) { ++ case ACPI_RECONFIG_DEVICE_ADD: ++ /* Nothing to do here */ ++ break; ++ case ACPI_RECONFIG_DEVICE_REMOVE: ++ if (!acpi_device_enumerated(adev)) ++ break; ++ ++ pdev = acpi_platform_device_find_by_companion(adev); ++ if (!pdev) ++ break; ++ ++ platform_device_unregister(pdev); ++ put_device(&pdev->dev); ++ break; ++ } ++ ++ return NOTIFY_OK; ++} ++ ++static struct notifier_block acpi_platform_notifier = { ++ .notifier_call = acpi_platform_device_remove_notify, ++}; ++ + static void acpi_platform_fill_resource(struct acpi_device *adev, + const struct resource *src, struct resource *dest) + { +@@ -130,3 +168,8 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev, + return pdev; + } + EXPORT_SYMBOL_GPL(acpi_create_platform_device); ++ ++void __init acpi_platform_init(void) ++{ ++ acpi_reconfig_notifier_register(&acpi_platform_notifier); ++} +diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c +index aad6be5c0af0..915650bf519f 100644 +--- a/drivers/acpi/scan.c ++++ b/drivers/acpi/scan.c +@@ -2174,6 +2174,7 @@ int __init acpi_scan_init(void) + acpi_pci_root_init(); + acpi_pci_link_init(); + acpi_processor_init(); ++ acpi_platform_init(); + acpi_lpss_init(); + acpi_apd_init(); + acpi_cmos_rtc_init(); +diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c +index a1f3f0994f9f..d5b4905e2adb 100644 +--- a/drivers/base/swnode.c ++++ b/drivers/base/swnode.c +@@ -520,7 +520,10 @@ software_node_get_parent(const struct fwnode_handle *fwnode) + { + struct swnode *swnode = to_swnode(fwnode); + +- return swnode ? (swnode->parent ? &swnode->parent->fwnode : NULL) : NULL; ++ if (!swnode || !swnode->parent) ++ return NULL; ++ ++ return fwnode_handle_get(&swnode->parent->fwnode); + } + + static struct fwnode_handle * +diff --git a/drivers/char/hw_random/omap3-rom-rng.c b/drivers/char/hw_random/omap3-rom-rng.c +index 648e39ce6bd9..8df3cad7c97a 100644 +--- a/drivers/char/hw_random/omap3-rom-rng.c ++++ b/drivers/char/hw_random/omap3-rom-rng.c +@@ -20,6 +20,8 @@ + #include + #include + #include ++#include ++#include + #include + + #define RNG_RESET 0x01 +@@ -86,14 +88,18 @@ static int omap3_rom_rng_read(struct hwrng *rng, void *data, size_t max, bool w) + + static struct hwrng omap3_rom_rng_ops = { + .name = "omap3-rom", +- .read = omap3_rom_rng_read, + }; + + static int omap3_rom_rng_probe(struct platform_device *pdev) + { + int ret = 0; + +- pr_info("initializing\n"); ++ omap3_rom_rng_ops.read = of_device_get_match_data(&pdev->dev); ++ if (!omap3_rom_rng_ops.read) { ++ dev_err(&pdev->dev, "missing rom code handler\n"); ++ ++ return -ENODEV; ++ } + + omap3_rom_rng_call = pdev->dev.platform_data; + if (!omap3_rom_rng_call) { +@@ -126,9 +132,16 @@ static int omap3_rom_rng_remove(struct platform_device *pdev) + return 0; + } + ++static const struct of_device_id omap_rom_rng_match[] = { ++ { .compatible = "nokia,n900-rom-rng", .data = omap3_rom_rng_read, }, ++ { /* sentinel */ }, ++}; ++MODULE_DEVICE_TABLE(of, omap_rom_rng_match); ++ + static struct platform_driver omap3_rom_rng_driver = { + .driver = { + .name = "omap3-rom-rng", ++ .of_match_table = omap_rom_rng_match, + }, + .probe = omap3_rom_rng_probe, + .remove = omap3_rom_rng_remove, +diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c +index 3c8a559506e8..0b6e7f8d9729 100644 +--- a/drivers/char/ipmi/ipmi_msghandler.c ++++ b/drivers/char/ipmi/ipmi_msghandler.c +@@ -3039,8 +3039,11 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf, + bmc->pdev.name = "ipmi_bmc"; + + rv = ida_simple_get(&ipmi_bmc_ida, 0, 0, GFP_KERNEL); +- if (rv < 0) ++ if (rv < 0) { ++ kfree(bmc); + goto out; ++ } ++ + bmc->pdev.dev.driver = &ipmidriver.driver; + bmc->pdev.id = rv; + bmc->pdev.dev.release = release_bmc_device; +diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig +index 8eabf7b20101..7316312935c8 100644 +--- a/drivers/crypto/Kconfig ++++ b/drivers/crypto/Kconfig +@@ -333,6 +333,7 @@ config CRYPTO_DEV_PPC4XX + depends on PPC && 4xx + select CRYPTO_HASH + select CRYPTO_AEAD ++ select CRYPTO_AES + select CRYPTO_LIB_AES + select CRYPTO_CCM + select CRYPTO_CTR +diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c +index 1369c5fa3087..07df012893bb 100644 +--- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c ++++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c +@@ -175,7 +175,7 @@ static int sun4i_hash(struct ahash_request *areq) + */ + unsigned int i = 0, end, fill, min_fill, nwait, nbw = 0, j = 0, todo; + unsigned int in_i = 0; +- u32 spaces, rx_cnt = SS_RX_DEFAULT, bf[32] = {0}, wb = 0, v, ivmode = 0; ++ u32 spaces, rx_cnt = SS_RX_DEFAULT, bf[32] = {0}, v, ivmode = 0; + struct sun4i_req_ctx *op = ahash_request_ctx(areq); + struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); + struct sun4i_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); +@@ -184,6 +184,7 @@ static int sun4i_hash(struct ahash_request *areq) + struct sg_mapping_iter mi; + int in_r, err = 0; + size_t copied = 0; ++ __le32 wb = 0; + + dev_dbg(ss->dev, "%s %s bc=%llu len=%u mode=%x wl=%u h0=%0x", + __func__, crypto_tfm_alg_name(areq->base.tfm), +@@ -395,7 +396,7 @@ hash_final: + + nbw = op->len - 4 * nwait; + if (nbw) { +- wb = *(u32 *)(op->buf + nwait * 4); ++ wb = cpu_to_le32(*(u32 *)(op->buf + nwait * 4)); + wb &= GENMASK((nbw * 8) - 1, 0); + + op->byte_count += nbw; +@@ -404,7 +405,7 @@ hash_final: + + /* write the remaining bytes of the nbw buffer */ + wb |= ((1 << 7) << (nbw * 8)); +- bf[j++] = wb; ++ bf[j++] = le32_to_cpu(wb); + + /* + * number of space to pad to obtain 64o minus 8(size) minus 4 (final 1) +@@ -423,13 +424,13 @@ hash_final: + + /* write the length of data */ + if (op->mode == SS_OP_SHA1) { +- __be64 bits = cpu_to_be64(op->byte_count << 3); +- bf[j++] = lower_32_bits(bits); +- bf[j++] = upper_32_bits(bits); ++ __be64 *bits = (__be64 *)&bf[j]; ++ *bits = cpu_to_be64(op->byte_count << 3); ++ j += 2; + } else { +- __le64 bits = op->byte_count << 3; +- bf[j++] = lower_32_bits(bits); +- bf[j++] = upper_32_bits(bits); ++ __le64 *bits = (__le64 *)&bf[j]; ++ *bits = cpu_to_le64(op->byte_count << 3); ++ j += 2; + } + writesl(ss->base + SS_RXFIFO, bf, j); + +@@ -471,7 +472,7 @@ hash_final: + } + } else { + for (i = 0; i < 4; i++) { +- v = readl(ss->base + SS_MD0 + i * 4); ++ v = cpu_to_le32(readl(ss->base + SS_MD0 + i * 4)); + memcpy(areq->result + i * 4, &v, 4); + } + } +diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c +index ba7c4f07fcd6..80b780e49971 100644 +--- a/drivers/dma/ti/edma.c ++++ b/drivers/dma/ti/edma.c +@@ -2403,8 +2403,10 @@ static int edma_probe(struct platform_device *pdev) + + ecc->tc_list = devm_kcalloc(dev, ecc->num_tc, + sizeof(*ecc->tc_list), GFP_KERNEL); +- if (!ecc->tc_list) +- return -ENOMEM; ++ if (!ecc->tc_list) { ++ ret = -ENOMEM; ++ goto err_reg1; ++ } + + for (i = 0;; i++) { + ret = of_parse_phandle_with_fixed_args(node, "ti,tptcs", +diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c +index 4a8012e3cb8c..601af4edad5e 100644 +--- a/drivers/firmware/arm_scmi/perf.c ++++ b/drivers/firmware/arm_scmi/perf.c +@@ -323,7 +323,7 @@ static void scmi_perf_fc_ring_db(struct scmi_fc_db_info *db) + + if (db->mask) + val = ioread64_hi_lo(db->addr) & db->mask; +- iowrite64_hi_lo(db->set, db->addr); ++ iowrite64_hi_lo(db->set | val, db->addr); + } + #endif + } +diff --git a/drivers/firmware/imx/imx-dsp.c b/drivers/firmware/imx/imx-dsp.c +index a43d2db5cbdb..4265e9dbed84 100644 +--- a/drivers/firmware/imx/imx-dsp.c ++++ b/drivers/firmware/imx/imx-dsp.c +@@ -114,7 +114,7 @@ static int imx_dsp_probe(struct platform_device *pdev) + + dev_info(dev, "NXP i.MX DSP IPC initialized\n"); + +- return devm_of_platform_populate(dev); ++ return 0; + out: + kfree(chan_name); + for (j = 0; j < i; j++) { +diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c +index 43ffec3a6fbb..7ee5b7f53aeb 100644 +--- a/drivers/gpio/gpiolib-of.c ++++ b/drivers/gpio/gpiolib-of.c +@@ -909,16 +909,13 @@ int of_gpiochip_add(struct gpio_chip *chip) + of_node_get(chip->of_node); + + ret = of_gpiochip_scan_gpios(chip); +- if (ret) { ++ if (ret) + of_node_put(chip->of_node); +- gpiochip_remove_pin_ranges(chip); +- } + + return ret; + } + + void of_gpiochip_remove(struct gpio_chip *chip) + { +- gpiochip_remove_pin_ranges(chip); + of_node_put(chip->of_node); + } +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c +index 3d9524a2abc4..2476306e7030 100644 +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -1452,6 +1452,7 @@ err_remove_of_chip: + gpiochip_free_hogs(chip); + of_gpiochip_remove(chip); + err_free_gpiochip_mask: ++ gpiochip_remove_pin_ranges(chip); + gpiochip_free_valid_mask(chip); + err_remove_from_list: + spin_lock_irqsave(&gpio_lock, flags); +@@ -1507,8 +1508,8 @@ void gpiochip_remove(struct gpio_chip *chip) + gdev->chip = NULL; + gpiochip_irqchip_remove(chip); + acpi_gpiochip_remove(chip); +- gpiochip_remove_pin_ranges(chip); + of_gpiochip_remove(chip); ++ gpiochip_remove_pin_ranges(chip); + gpiochip_free_valid_mask(chip); + /* + * We accept no more calls into the driver from this point, so +diff --git a/drivers/gpio/sgpio-aspeed.c b/drivers/gpio/sgpio-aspeed.c +index 7e99860ca447..8319812593e3 100644 +--- a/drivers/gpio/sgpio-aspeed.c ++++ b/drivers/gpio/sgpio-aspeed.c +@@ -107,7 +107,7 @@ static void __iomem *bank_reg(struct aspeed_sgpio *gpio, + return gpio->base + bank->irq_regs + GPIO_IRQ_STATUS; + default: + /* acturally if code runs to here, it's an error case */ +- BUG_ON(1); ++ BUG(); + } + } + +diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +index 395c2259f979..9d778a0b2c5e 100644 +--- a/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c ++++ b/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +@@ -423,7 +423,6 @@ static void vcn_v2_5_mc_resume(struct amdgpu_device *adev) + * vcn_v2_5_disable_clock_gating - disable VCN clock gating + * + * @adev: amdgpu_device pointer +- * @sw: enable SW clock gating + * + * Disable clock gating for VCN block + */ +@@ -542,7 +541,6 @@ static void vcn_v2_5_disable_clock_gating(struct amdgpu_device *adev) + * vcn_v2_5_enable_clock_gating - enable VCN clock gating + * + * @adev: amdgpu_device pointer +- * @sw: enable SW clock gating + * + * Enable clock gating for VCN block + */ +diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c +index fa8ad7db2b3a..d306cc711997 100644 +--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c ++++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c +@@ -1421,6 +1421,7 @@ static int pp_get_asic_baco_capability(void *handle, bool *cap) + { + struct pp_hwmgr *hwmgr = handle; + ++ *cap = false; + if (!hwmgr) + return -EINVAL; + +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c +index e41fd94ae5a9..b3d2b91575cb 100644 +--- a/drivers/gpu/drm/i915/gem/i915_gem_context.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c +@@ -2094,8 +2094,7 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data, + ext_data.fpriv = file->driver_priv; + if (client_is_banned(ext_data.fpriv)) { + DRM_DEBUG("client %s[%d] banned from creating ctx\n", +- current->comm, +- pid_nr(get_task_pid(current, PIDTYPE_PID))); ++ current->comm, task_pid_nr(current)); + return -EIO; + } + +diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c +index ad47cc95459e..bf5fcc3e5379 100644 +--- a/drivers/gpu/drm/panel/panel-lvds.c ++++ b/drivers/gpu/drm/panel/panel-lvds.c +@@ -197,7 +197,6 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds) + static int panel_lvds_probe(struct platform_device *pdev) + { + struct panel_lvds *lvds; +- struct device_node *np; + int ret; + + lvds = devm_kzalloc(&pdev->dev, sizeof(*lvds), GFP_KERNEL); +@@ -243,14 +242,9 @@ static int panel_lvds_probe(struct platform_device *pdev) + return ret; + } + +- np = of_parse_phandle(lvds->dev->of_node, "backlight", 0); +- if (np) { +- lvds->backlight = of_find_backlight_by_node(np); +- of_node_put(np); +- +- if (!lvds->backlight) +- return -EPROBE_DEFER; +- } ++ lvds->backlight = devm_of_find_backlight(lvds->dev); ++ if (IS_ERR(lvds->backlight)) ++ return PTR_ERR(lvds->backlight); + + /* + * TODO: Handle all power supplies specified in the DT node in a generic +@@ -266,14 +260,10 @@ static int panel_lvds_probe(struct platform_device *pdev) + + ret = drm_panel_add(&lvds->panel); + if (ret < 0) +- goto error; ++ return ret; + + dev_set_drvdata(lvds->dev, lvds); + return 0; +- +-error: +- put_device(&lvds->backlight->dev); +- return ret; + } + + static int panel_lvds_remove(struct platform_device *pdev) +@@ -284,9 +274,6 @@ static int panel_lvds_remove(struct platform_device *pdev) + + panel_lvds_disable(&lvds->panel); + +- if (lvds->backlight) +- put_device(&lvds->backlight->dev); +- + return 0; + } + +diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c +index 12ff77dacc95..c1eb8cfe6aeb 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c ++++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c +@@ -53,8 +53,10 @@ static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, + if (err) { + dev_err(dev, "Cannot set frequency %lu (%d)\n", target_rate, + err); +- regulator_set_voltage(pfdev->regulator, pfdev->devfreq.cur_volt, +- pfdev->devfreq.cur_volt); ++ if (pfdev->regulator) ++ regulator_set_voltage(pfdev->regulator, ++ pfdev->devfreq.cur_volt, ++ pfdev->devfreq.cur_volt); + return err; + } + +diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c +index 62eab82a64f9..897442754fd0 100644 +--- a/drivers/gpu/drm/radeon/cik.c ++++ b/drivers/gpu/drm/radeon/cik.c +@@ -6969,8 +6969,8 @@ static int cik_irq_init(struct radeon_device *rdev) + } + + /* setup interrupt control */ +- /* XXX this should actually be a bus address, not an MC address. same on older asics */ +- WREG32(INTERRUPT_CNTL2, rdev->ih.gpu_addr >> 8); ++ /* set dummy read address to dummy page address */ ++ WREG32(INTERRUPT_CNTL2, rdev->dummy_page.addr >> 8); + interrupt_cntl = RREG32(INTERRUPT_CNTL); + /* IH_DUMMY_RD_OVERRIDE=0 - dummy read disabled with msi, enabled without msi + * IH_DUMMY_RD_OVERRIDE=1 - dummy read controlled by IH_DUMMY_RD_EN +diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c +index e937cc01910d..033bc466a862 100644 +--- a/drivers/gpu/drm/radeon/r600.c ++++ b/drivers/gpu/drm/radeon/r600.c +@@ -3696,8 +3696,8 @@ int r600_irq_init(struct radeon_device *rdev) + } + + /* setup interrupt control */ +- /* set dummy read address to ring address */ +- WREG32(INTERRUPT_CNTL2, rdev->ih.gpu_addr >> 8); ++ /* set dummy read address to dummy page address */ ++ WREG32(INTERRUPT_CNTL2, rdev->dummy_page.addr >> 8); + interrupt_cntl = RREG32(INTERRUPT_CNTL); + /* IH_DUMMY_RD_OVERRIDE=0 - dummy read disabled with msi, enabled without msi + * IH_DUMMY_RD_OVERRIDE=1 - dummy read controlled by IH_DUMMY_RD_EN +diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c +index 05894d198a79..1d8efb0eefdb 100644 +--- a/drivers/gpu/drm/radeon/si.c ++++ b/drivers/gpu/drm/radeon/si.c +@@ -5997,8 +5997,8 @@ static int si_irq_init(struct radeon_device *rdev) + } + + /* setup interrupt control */ +- /* set dummy read address to ring address */ +- WREG32(INTERRUPT_CNTL2, rdev->ih.gpu_addr >> 8); ++ /* set dummy read address to dummy page address */ ++ WREG32(INTERRUPT_CNTL2, rdev->dummy_page.addr >> 8); + interrupt_cntl = RREG32(INTERRUPT_CNTL); + /* IH_DUMMY_RD_OVERRIDE=0 - dummy read disabled with msi, enabled without msi + * IH_DUMMY_RD_OVERRIDE=1 - dummy read controlled by IH_DUMMY_RD_EN +diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c +index 3fc7e6899cab..50c11a7f0467 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_lvds.c ++++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -842,8 +843,23 @@ static int rcar_lvds_get_clocks(struct rcar_lvds *lvds) + return 0; + } + ++static const struct rcar_lvds_device_info rcar_lvds_r8a7790es1_info = { ++ .gen = 2, ++ .quirks = RCAR_LVDS_QUIRK_LANES, ++ .pll_setup = rcar_lvds_pll_setup_gen2, ++}; ++ ++static const struct soc_device_attribute lvds_quirk_matches[] = { ++ { ++ .soc_id = "r8a7790", .revision = "ES1.*", ++ .data = &rcar_lvds_r8a7790es1_info, ++ }, ++ { /* sentinel */ } ++}; ++ + static int rcar_lvds_probe(struct platform_device *pdev) + { ++ const struct soc_device_attribute *attr; + struct rcar_lvds *lvds; + struct resource *mem; + int ret; +@@ -857,6 +873,10 @@ static int rcar_lvds_probe(struct platform_device *pdev) + lvds->dev = &pdev->dev; + lvds->info = of_device_get_match_data(&pdev->dev); + ++ attr = soc_device_match(lvds_quirk_matches); ++ if (attr) ++ lvds->info = attr->data; ++ + ret = rcar_lvds_parse_dt(lvds); + if (ret < 0) + return ret; +@@ -893,12 +913,6 @@ static const struct rcar_lvds_device_info rcar_lvds_gen2_info = { + .pll_setup = rcar_lvds_pll_setup_gen2, + }; + +-static const struct rcar_lvds_device_info rcar_lvds_r8a7790_info = { +- .gen = 2, +- .quirks = RCAR_LVDS_QUIRK_LANES, +- .pll_setup = rcar_lvds_pll_setup_gen2, +-}; +- + static const struct rcar_lvds_device_info rcar_lvds_gen3_info = { + .gen = 3, + .quirks = RCAR_LVDS_QUIRK_PWD, +@@ -930,7 +944,7 @@ static const struct of_device_id rcar_lvds_of_table[] = { + { .compatible = "renesas,r8a7744-lvds", .data = &rcar_lvds_gen2_info }, + { .compatible = "renesas,r8a774a1-lvds", .data = &rcar_lvds_gen3_info }, + { .compatible = "renesas,r8a774c0-lvds", .data = &rcar_lvds_r8a77990_info }, +- { .compatible = "renesas,r8a7790-lvds", .data = &rcar_lvds_r8a7790_info }, ++ { .compatible = "renesas,r8a7790-lvds", .data = &rcar_lvds_gen2_info }, + { .compatible = "renesas,r8a7791-lvds", .data = &rcar_lvds_gen2_info }, + { .compatible = "renesas,r8a7793-lvds", .data = &rcar_lvds_gen2_info }, + { .compatible = "renesas,r8a7795-lvds", .data = &rcar_lvds_gen3_info }, +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +index 613404f86668..84e3decb17b1 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +@@ -1040,10 +1040,41 @@ static bool vop_crtc_mode_fixup(struct drm_crtc *crtc, + struct drm_display_mode *adjusted_mode) + { + struct vop *vop = to_vop(crtc); ++ unsigned long rate; + +- adjusted_mode->clock = +- DIV_ROUND_UP(clk_round_rate(vop->dclk, +- adjusted_mode->clock * 1000), 1000); ++ /* ++ * Clock craziness. ++ * ++ * Key points: ++ * ++ * - DRM works in in kHz. ++ * - Clock framework works in Hz. ++ * - Rockchip's clock driver picks the clock rate that is the ++ * same _OR LOWER_ than the one requested. ++ * ++ * Action plan: ++ * ++ * 1. When DRM gives us a mode, we should add 999 Hz to it. That way ++ * if the clock we need is 60000001 Hz (~60 MHz) and DRM tells us to ++ * make 60000 kHz then the clock framework will actually give us ++ * the right clock. ++ * ++ * NOTE: if the PLL (maybe through a divider) could actually make ++ * a clock rate 999 Hz higher instead of the one we want then this ++ * could be a problem. Unfortunately there's not much we can do ++ * since it's baked into DRM to use kHz. It shouldn't matter in ++ * practice since Rockchip PLLs are controlled by tables and ++ * even if there is a divider in the middle I wouldn't expect PLL ++ * rates in the table that are just a few kHz different. ++ * ++ * 2. Get the clock framework to round the rate for us to tell us ++ * what it will actually make. ++ * ++ * 3. Store the rounded up rate so that we don't need to worry about ++ * this in the actual clk_set_rate(). ++ */ ++ rate = clk_round_rate(vop->dclk, adjusted_mode->clock * 1000 + 999); ++ adjusted_mode->clock = DIV_ROUND_UP(rate, 1000); + + return true; + } +diff --git a/drivers/i2c/busses/i2c-stm32.c b/drivers/i2c/busses/i2c-stm32.c +index 07d5dfce68d4..1da347e6a358 100644 +--- a/drivers/i2c/busses/i2c-stm32.c ++++ b/drivers/i2c/busses/i2c-stm32.c +@@ -20,13 +20,13 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev, + + dma = devm_kzalloc(dev, sizeof(*dma), GFP_KERNEL); + if (!dma) +- return NULL; ++ return ERR_PTR(-ENOMEM); + + /* Request and configure I2C TX dma channel */ +- dma->chan_tx = dma_request_slave_channel(dev, "tx"); +- if (!dma->chan_tx) { ++ dma->chan_tx = dma_request_chan(dev, "tx"); ++ if (IS_ERR(dma->chan_tx)) { + dev_dbg(dev, "can't request DMA tx channel\n"); +- ret = -EINVAL; ++ ret = PTR_ERR(dma->chan_tx); + goto fail_al; + } + +@@ -42,10 +42,10 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev, + } + + /* Request and configure I2C RX dma channel */ +- dma->chan_rx = dma_request_slave_channel(dev, "rx"); +- if (!dma->chan_rx) { ++ dma->chan_rx = dma_request_chan(dev, "rx"); ++ if (IS_ERR(dma->chan_rx)) { + dev_err(dev, "can't request DMA rx channel\n"); +- ret = -EINVAL; ++ ret = PTR_ERR(dma->chan_rx); + goto fail_tx; + } + +@@ -75,7 +75,7 @@ fail_al: + devm_kfree(dev, dma); + dev_info(dev, "can't use DMA\n"); + +- return NULL; ++ return ERR_PTR(ret); + } + + void stm32_i2c_dma_free(struct stm32_i2c_dma *dma) +diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c +index 84cfed17ff4f..b2634afe066d 100644 +--- a/drivers/i2c/busses/i2c-stm32f7.c ++++ b/drivers/i2c/busses/i2c-stm32f7.c +@@ -1267,8 +1267,8 @@ static int stm32f7_i2c_get_free_slave_id(struct stm32f7_i2c_dev *i2c_dev, + * slave[0] supports 7-bit and 10-bit slave address + * slave[1] supports 7-bit slave address only + */ +- for (i = 0; i < STM32F7_I2C_MAX_SLAVE; i++) { +- if (i == 1 && (slave->flags & I2C_CLIENT_PEC)) ++ for (i = STM32F7_I2C_MAX_SLAVE - 1; i >= 0; i--) { ++ if (i == 1 && (slave->flags & I2C_CLIENT_TEN)) + continue; + if (!i2c_dev->slave[i]) { + *id = i; +@@ -1955,6 +1955,15 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) + i2c_dev->dma = stm32_i2c_dma_request(i2c_dev->dev, phy_addr, + STM32F7_I2C_TXDR, + STM32F7_I2C_RXDR); ++ if (PTR_ERR(i2c_dev->dma) == -ENODEV) ++ i2c_dev->dma = NULL; ++ else if (IS_ERR(i2c_dev->dma)) { ++ ret = PTR_ERR(i2c_dev->dma); ++ if (ret != -EPROBE_DEFER) ++ dev_err(&pdev->dev, ++ "Failed to request dma error %i\n", ret); ++ goto clk_free; ++ } + + platform_set_drvdata(pdev, i2c_dev); + +diff --git a/drivers/leds/leds-tlc591xx.c b/drivers/leds/leds-tlc591xx.c +index 59ff088c7d75..9feaec3c8329 100644 +--- a/drivers/leds/leds-tlc591xx.c ++++ b/drivers/leds/leds-tlc591xx.c +@@ -13,6 +13,7 @@ + #include + + #define TLC591XX_MAX_LEDS 16 ++#define TLC591XX_MAX_BRIGHTNESS 256 + + #define TLC591XX_REG_MODE1 0x00 + #define MODE1_RESPON_ADDR_MASK 0xF0 +@@ -112,11 +113,11 @@ tlc591xx_brightness_set(struct led_classdev *led_cdev, + struct tlc591xx_priv *priv = led->priv; + int err; + +- switch (brightness) { ++ switch ((int)brightness) { + case 0: + err = tlc591xx_set_ledout(priv, led, LEDOUT_OFF); + break; +- case LED_FULL: ++ case TLC591XX_MAX_BRIGHTNESS: + err = tlc591xx_set_ledout(priv, led, LEDOUT_ON); + break; + default: +@@ -157,7 +158,7 @@ tlc591xx_configure(struct device *dev, + led->priv = priv; + led->led_no = i; + led->ldev.brightness_set_blocking = tlc591xx_brightness_set; +- led->ldev.max_brightness = LED_FULL; ++ led->ldev.max_brightness = TLC591XX_MAX_BRIGHTNESS; + err = led_classdev_register(dev, &led->ldev); + if (err < 0) { + dev_err(dev, "couldn't register LED %s\n", +diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c +index 9355db29d2f9..1767f30a1676 100644 +--- a/drivers/mfd/intel-lpss-pci.c ++++ b/drivers/mfd/intel-lpss-pci.c +@@ -122,6 +122,18 @@ static const struct intel_lpss_platform_info apl_i2c_info = { + .properties = apl_i2c_properties, + }; + ++static struct property_entry glk_i2c_properties[] = { ++ PROPERTY_ENTRY_U32("i2c-sda-hold-time-ns", 313), ++ PROPERTY_ENTRY_U32("i2c-sda-falling-time-ns", 171), ++ PROPERTY_ENTRY_U32("i2c-scl-falling-time-ns", 290), ++ { }, ++}; ++ ++static const struct intel_lpss_platform_info glk_i2c_info = { ++ .clk_rate = 133000000, ++ .properties = glk_i2c_properties, ++}; ++ + static const struct intel_lpss_platform_info cnl_i2c_info = { + .clk_rate = 216000000, + .properties = spt_i2c_properties, +@@ -174,14 +186,14 @@ static const struct pci_device_id intel_lpss_pci_ids[] = { + { PCI_VDEVICE(INTEL, 0x1ac6), (kernel_ulong_t)&bxt_info }, + { PCI_VDEVICE(INTEL, 0x1aee), (kernel_ulong_t)&bxt_uart_info }, + /* GLK */ +- { PCI_VDEVICE(INTEL, 0x31ac), (kernel_ulong_t)&bxt_i2c_info }, +- { PCI_VDEVICE(INTEL, 0x31ae), (kernel_ulong_t)&bxt_i2c_info }, +- { PCI_VDEVICE(INTEL, 0x31b0), (kernel_ulong_t)&bxt_i2c_info }, +- { PCI_VDEVICE(INTEL, 0x31b2), (kernel_ulong_t)&bxt_i2c_info }, +- { PCI_VDEVICE(INTEL, 0x31b4), (kernel_ulong_t)&bxt_i2c_info }, +- { PCI_VDEVICE(INTEL, 0x31b6), (kernel_ulong_t)&bxt_i2c_info }, +- { PCI_VDEVICE(INTEL, 0x31b8), (kernel_ulong_t)&bxt_i2c_info }, +- { PCI_VDEVICE(INTEL, 0x31ba), (kernel_ulong_t)&bxt_i2c_info }, ++ { PCI_VDEVICE(INTEL, 0x31ac), (kernel_ulong_t)&glk_i2c_info }, ++ { PCI_VDEVICE(INTEL, 0x31ae), (kernel_ulong_t)&glk_i2c_info }, ++ { PCI_VDEVICE(INTEL, 0x31b0), (kernel_ulong_t)&glk_i2c_info }, ++ { PCI_VDEVICE(INTEL, 0x31b2), (kernel_ulong_t)&glk_i2c_info }, ++ { PCI_VDEVICE(INTEL, 0x31b4), (kernel_ulong_t)&glk_i2c_info }, ++ { PCI_VDEVICE(INTEL, 0x31b6), (kernel_ulong_t)&glk_i2c_info }, ++ { PCI_VDEVICE(INTEL, 0x31b8), (kernel_ulong_t)&glk_i2c_info }, ++ { PCI_VDEVICE(INTEL, 0x31ba), (kernel_ulong_t)&glk_i2c_info }, + { PCI_VDEVICE(INTEL, 0x31bc), (kernel_ulong_t)&bxt_uart_info }, + { PCI_VDEVICE(INTEL, 0x31be), (kernel_ulong_t)&bxt_uart_info }, + { PCI_VDEVICE(INTEL, 0x31c0), (kernel_ulong_t)&bxt_uart_info }, +diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h +index 2d2d9ea8be4f..3dba15bccce2 100644 +--- a/drivers/mmc/core/quirks.h ++++ b/drivers/mmc/core/quirks.h +@@ -119,7 +119,14 @@ static const struct mmc_fixup mmc_ext_csd_fixups[] = { + END_FIXUP + }; + ++ + static const struct mmc_fixup sdio_fixup_methods[] = { ++ SDIO_FIXUP(SDIO_VENDOR_ID_TI_WL1251, SDIO_DEVICE_ID_TI_WL1251, ++ add_quirk, MMC_QUIRK_NONSTD_FUNC_IF), ++ ++ SDIO_FIXUP(SDIO_VENDOR_ID_TI_WL1251, SDIO_DEVICE_ID_TI_WL1251, ++ add_quirk, MMC_QUIRK_DISABLE_CD), ++ + SDIO_FIXUP(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271, + add_quirk, MMC_QUIRK_NONSTD_FUNC_IF), + +diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +index b4b82b9c5cd6..fcbe01f61aa4 100644 +--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c ++++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +@@ -1600,13 +1600,15 @@ static int dpaa_eth_refill_bpools(struct dpaa_priv *priv) + * Skb freeing is not handled here. + * + * This function may be called on error paths in the Tx function, so guard +- * against cases when not all fd relevant fields were filled in. ++ * against cases when not all fd relevant fields were filled in. To avoid ++ * reading the invalid transmission timestamp for the error paths set ts to ++ * false. + * + * Return the skb backpointer, since for S/G frames the buffer containing it + * gets freed here. + */ + static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv, +- const struct qm_fd *fd) ++ const struct qm_fd *fd, bool ts) + { + const enum dma_data_direction dma_dir = DMA_TO_DEVICE; + struct device *dev = priv->net_dev->dev.parent; +@@ -1620,18 +1622,6 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv, + skbh = (struct sk_buff **)phys_to_virt(addr); + skb = *skbh; + +- if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { +- memset(&shhwtstamps, 0, sizeof(shhwtstamps)); +- +- if (!fman_port_get_tstamp(priv->mac_dev->port[TX], (void *)skbh, +- &ns)) { +- shhwtstamps.hwtstamp = ns_to_ktime(ns); +- skb_tstamp_tx(skb, &shhwtstamps); +- } else { +- dev_warn(dev, "fman_port_get_tstamp failed!\n"); +- } +- } +- + if (unlikely(qm_fd_get_format(fd) == qm_fd_sg)) { + nr_frags = skb_shinfo(skb)->nr_frags; + dma_unmap_single(dev, addr, +@@ -1654,14 +1644,29 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv, + dma_unmap_page(dev, qm_sg_addr(&sgt[i]), + qm_sg_entry_get_len(&sgt[i]), dma_dir); + } +- +- /* Free the page frag that we allocated on Tx */ +- skb_free_frag(phys_to_virt(addr)); + } else { + dma_unmap_single(dev, addr, + skb_tail_pointer(skb) - (u8 *)skbh, dma_dir); + } + ++ /* DMA unmapping is required before accessing the HW provided info */ ++ if (ts && priv->tx_tstamp && ++ skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { ++ memset(&shhwtstamps, 0, sizeof(shhwtstamps)); ++ ++ if (!fman_port_get_tstamp(priv->mac_dev->port[TX], (void *)skbh, ++ &ns)) { ++ shhwtstamps.hwtstamp = ns_to_ktime(ns); ++ skb_tstamp_tx(skb, &shhwtstamps); ++ } else { ++ dev_warn(dev, "fman_port_get_tstamp failed!\n"); ++ } ++ } ++ ++ if (qm_fd_get_format(fd) == qm_fd_sg) ++ /* Free the page frag that we allocated on Tx */ ++ skb_free_frag(phys_to_virt(addr)); ++ + return skb; + } + +@@ -2114,7 +2119,7 @@ dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev) + if (likely(dpaa_xmit(priv, percpu_stats, queue_mapping, &fd) == 0)) + return NETDEV_TX_OK; + +- dpaa_cleanup_tx_fd(priv, &fd); ++ dpaa_cleanup_tx_fd(priv, &fd, false); + skb_to_fd_failed: + enomem: + percpu_stats->tx_errors++; +@@ -2160,7 +2165,7 @@ static void dpaa_tx_error(struct net_device *net_dev, + + percpu_priv->stats.tx_errors++; + +- skb = dpaa_cleanup_tx_fd(priv, fd); ++ skb = dpaa_cleanup_tx_fd(priv, fd, false); + dev_kfree_skb(skb); + } + +@@ -2200,7 +2205,7 @@ static void dpaa_tx_conf(struct net_device *net_dev, + + percpu_priv->tx_confirm++; + +- skb = dpaa_cleanup_tx_fd(priv, fd); ++ skb = dpaa_cleanup_tx_fd(priv, fd, true); + + consume_skb(skb); + } +@@ -2430,7 +2435,7 @@ static void egress_ern(struct qman_portal *portal, + percpu_priv->stats.tx_fifo_errors++; + count_ern(percpu_priv, msg); + +- skb = dpaa_cleanup_tx_fd(priv, fd); ++ skb = dpaa_cleanup_tx_fd(priv, fd, false); + dev_kfree_skb_any(skb); + } + +diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c +index 0aa1c34019bb..dc9a6c36cac0 100644 +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c +@@ -216,7 +216,7 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev, + if (err == -EINVAL) + /* Older firmware versions don't support all pages */ + memset(&dpni_stats, 0, sizeof(dpni_stats)); +- else ++ else if (err) + netdev_warn(net_dev, "dpni_get_stats(%d) failed\n", j); + + num_cnt = dpni_stats_page_size[j] / sizeof(u64); +diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +index c0637a0cbfe8..e92a00a61755 100644 +--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c ++++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +@@ -1873,8 +1873,8 @@ static int ice_vc_get_stats_msg(struct ice_vf *vf, u8 *msg) + enum virtchnl_status_code v_ret = VIRTCHNL_STATUS_SUCCESS; + struct virtchnl_queue_select *vqs = + (struct virtchnl_queue_select *)msg; ++ struct ice_eth_stats stats = { 0 }; + struct ice_pf *pf = vf->pf; +- struct ice_eth_stats stats; + struct ice_vsi *vsi; + + if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) { +@@ -1893,7 +1893,6 @@ static int ice_vc_get_stats_msg(struct ice_vf *vf, u8 *msg) + goto error_param; + } + +- memset(&stats, 0, sizeof(struct ice_eth_stats)); + ice_update_eth_stats(vsi); + + stats = vsi->eth_stats; +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +index 947122c68493..96711e34d248 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +@@ -1615,8 +1615,11 @@ static void __mlx5e_tc_del_fdb_peer_flow(struct mlx5e_tc_flow *flow) + + flow_flag_clear(flow, DUP); + +- mlx5e_tc_del_fdb_flow(flow->peer_flow->priv, flow->peer_flow); +- kfree(flow->peer_flow); ++ if (refcount_dec_and_test(&flow->peer_flow->refcnt)) { ++ mlx5e_tc_del_fdb_flow(flow->peer_flow->priv, flow->peer_flow); ++ kfree(flow->peer_flow); ++ } ++ + flow->peer_flow = NULL; + } + +diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c +index f9e6744d8fd6..41ddd8fff2a7 100644 +--- a/drivers/net/ethernet/socionext/netsec.c ++++ b/drivers/net/ethernet/socionext/netsec.c +@@ -847,8 +847,8 @@ static u32 netsec_xdp_queue_one(struct netsec_priv *priv, + enum dma_data_direction dma_dir = + page_pool_get_dma_dir(rx_ring->page_pool); + +- dma_handle = page_pool_get_dma_addr(page) + +- NETSEC_RXBUF_HEADROOM; ++ dma_handle = page_pool_get_dma_addr(page) + xdpf->headroom + ++ sizeof(*xdpf); + dma_sync_single_for_device(priv->dev, dma_handle, xdpf->len, + dma_dir); + tx_desc.buf_type = TYPE_NETSEC_XDP_TX; +diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +index 676006f32f91..479325eeaf8a 100644 +--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c ++++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +@@ -1790,10 +1790,6 @@ static int axienet_probe(struct platform_device *pdev) + /* Check for these resources directly on the Ethernet node. */ + struct resource *res = platform_get_resource(pdev, + IORESOURCE_MEM, 1); +- if (!res) { +- dev_err(&pdev->dev, "unable to get DMA memory resource\n"); +- goto free_netdev; +- } + lp->dma_regs = devm_ioremap_resource(&pdev->dev, res); + lp->rx_irq = platform_get_irq(pdev, 1); + lp->tx_irq = platform_get_irq(pdev, 0); +diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c +index 78e3e689a733..0dee358864f3 100644 +--- a/drivers/net/hyperv/netvsc_drv.c ++++ b/drivers/net/hyperv/netvsc_drv.c +@@ -285,9 +285,9 @@ static inline u32 netvsc_get_hash( + else if (flow.basic.n_proto == htons(ETH_P_IPV6)) + hash = jhash2((u32 *)&flow.addrs.v6addrs, 8, hashrnd); + else +- hash = 0; ++ return 0; + +- skb_set_hash(skb, hash, PKT_HASH_TYPE_L3); ++ __skb_set_sw_hash(skb, hash, false); + } + + return hash; +@@ -795,8 +795,7 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, + skb->protocol == htons(ETH_P_IP)) + netvsc_comp_ipcsum(skb); + +- /* Do L4 checksum offload if enabled and present. +- */ ++ /* Do L4 checksum offload if enabled and present. */ + if (csum_info && (net->features & NETIF_F_RXCSUM)) { + if (csum_info->receive.tcp_checksum_succeeded || + csum_info->receive.udp_checksum_succeeded) +diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c +index 937d0059e8ac..5e956089bf52 100644 +--- a/drivers/net/phy/broadcom.c ++++ b/drivers/net/phy/broadcom.c +@@ -26,18 +26,13 @@ MODULE_DESCRIPTION("Broadcom PHY driver"); + MODULE_AUTHOR("Maciej W. Rozycki"); + MODULE_LICENSE("GPL"); + ++static int bcm54xx_config_clock_delay(struct phy_device *phydev); ++ + static int bcm54210e_config_init(struct phy_device *phydev) + { + int val; + +- val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC); +- val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN; +- val |= MII_BCM54XX_AUXCTL_MISC_WREN; +- bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, val); +- +- val = bcm_phy_read_shadow(phydev, BCM54810_SHD_CLK_CTL); +- val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN; +- bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val); ++ bcm54xx_config_clock_delay(phydev); + + if (phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) { + val = phy_read(phydev, MII_CTRL1000); +diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h +index 8aec7ccf2d79..502814c26b33 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt76.h ++++ b/drivers/net/wireless/mediatek/mt76/mt76.h +@@ -367,8 +367,8 @@ enum mt76u_in_ep { + + enum mt76u_out_ep { + MT_EP_OUT_INBAND_CMD, +- MT_EP_OUT_AC_BK, + MT_EP_OUT_AC_BE, ++ MT_EP_OUT_AC_BK, + MT_EP_OUT_AC_VI, + MT_EP_OUT_AC_VO, + MT_EP_OUT_HCCA, +@@ -799,7 +799,8 @@ static inline int + mt76u_bulk_msg(struct mt76_dev *dev, void *data, int len, int *actual_len, + int timeout) + { +- struct usb_device *udev = to_usb_device(dev->dev); ++ struct usb_interface *uintf = to_usb_interface(dev->dev); ++ struct usb_device *udev = interface_to_usbdev(uintf); + struct mt76_usb *usb = &dev->usb; + unsigned int pipe; + +diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c +index 00a445d27599..65d404e61404 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c ++++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c +@@ -226,7 +226,7 @@ static int mt76x0u_probe(struct usb_interface *usb_intf, + u32 mac_rev; + int ret; + +- mdev = mt76_alloc_device(&usb_dev->dev, sizeof(*dev), &mt76x0u_ops, ++ mdev = mt76_alloc_device(&usb_intf->dev, sizeof(*dev), &mt76x0u_ops, + &drv_ops); + if (!mdev) + return -ENOMEM; +diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c +index da5e0f9a8bae..8b26c6108186 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c ++++ b/drivers/net/wireless/mediatek/mt76/mt76x2/usb.c +@@ -39,7 +39,7 @@ static int mt76x2u_probe(struct usb_interface *intf, + struct mt76_dev *mdev; + int err; + +- mdev = mt76_alloc_device(&udev->dev, sizeof(*dev), &mt76x2u_ops, ++ mdev = mt76_alloc_device(&intf->dev, sizeof(*dev), &mt76x2u_ops, + &drv_ops); + if (!mdev) + return -ENOMEM; +diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c +index 20c6fe510e9d..05aa42bd9808 100644 +--- a/drivers/net/wireless/mediatek/mt76/usb.c ++++ b/drivers/net/wireless/mediatek/mt76/usb.c +@@ -20,7 +20,8 @@ static int __mt76u_vendor_request(struct mt76_dev *dev, u8 req, + u8 req_type, u16 val, u16 offset, + void *buf, size_t len) + { +- struct usb_device *udev = to_usb_device(dev->dev); ++ struct usb_interface *uintf = to_usb_interface(dev->dev); ++ struct usb_device *udev = interface_to_usbdev(uintf); + unsigned int pipe; + int i, ret; + +@@ -235,7 +236,8 @@ mt76u_rd_rp(struct mt76_dev *dev, u32 base, + + static bool mt76u_check_sg(struct mt76_dev *dev) + { +- struct usb_device *udev = to_usb_device(dev->dev); ++ struct usb_interface *uintf = to_usb_interface(dev->dev); ++ struct usb_device *udev = interface_to_usbdev(uintf); + + return (!disable_usb_sg && udev->bus->sg_tablesize > 0 && + (udev->bus->no_sg_constraint || +@@ -370,7 +372,8 @@ mt76u_fill_bulk_urb(struct mt76_dev *dev, int dir, int index, + struct urb *urb, usb_complete_t complete_fn, + void *context) + { +- struct usb_device *udev = to_usb_device(dev->dev); ++ struct usb_interface *uintf = to_usb_interface(dev->dev); ++ struct usb_device *udev = interface_to_usbdev(uintf); + unsigned int pipe; + + if (dir == USB_DIR_IN) +@@ -952,6 +955,7 @@ int mt76u_init(struct mt76_dev *dev, + .rd_rp = mt76u_rd_rp, + .type = MT76_BUS_USB, + }; ++ struct usb_device *udev = interface_to_usbdev(intf); + struct mt76_usb *usb = &dev->usb; + + tasklet_init(&usb->rx_tasklet, mt76u_rx_tasklet, (unsigned long)dev); +@@ -965,6 +969,8 @@ int mt76u_init(struct mt76_dev *dev, + dev->bus = &mt76u_ops; + dev->queue_ops = &usb_queue_ops; + ++ dev_set_drvdata(&udev->dev, dev); ++ + usb->sg_en = mt76u_check_sg(dev); + + return mt76u_set_endpoints(intf, usb); +diff --git a/drivers/net/wireless/mediatek/mt7601u/phy.c b/drivers/net/wireless/mediatek/mt7601u/phy.c +index 06f5702ab4bd..d863ab4a66c9 100644 +--- a/drivers/net/wireless/mediatek/mt7601u/phy.c ++++ b/drivers/net/wireless/mediatek/mt7601u/phy.c +@@ -213,7 +213,7 @@ int mt7601u_wait_bbp_ready(struct mt7601u_dev *dev) + + do { + val = mt7601u_bbp_rr(dev, MT_BBP_REG_VERSION); +- if (val && ~val) ++ if (val && val != 0xff) + break; + } while (--i); + +diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +index f1cdcd61c54a..c99f1912e266 100644 +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -5839,8 +5839,7 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) + rt2800_register_write(rt2x00dev, TX_TXBF_CFG_0, 0x8000fc21); + rt2800_register_write(rt2x00dev, TX_TXBF_CFG_3, 0x00009c40); + } else if (rt2x00_rt(rt2x00dev, RT5390) || +- rt2x00_rt(rt2x00dev, RT5392) || +- rt2x00_rt(rt2x00dev, RT6352)) { ++ rt2x00_rt(rt2x00dev, RT5392)) { + rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); + rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606); + rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); +@@ -5854,8 +5853,6 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) + rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000401); + rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0000); + rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); +- rt2800_register_write(rt2x00dev, MIMO_PS_CFG, 0x00000002); +- rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150F0F); + rt2800_register_write(rt2x00dev, TX_ALC_VGA3, 0x00000000); + rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0); + rt2800_register_write(rt2x00dev, TX1_BB_GAIN_ATTEN, 0x0); +diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c +index b082e2cc95f5..35dbdb3c4f1e 100644 +--- a/drivers/net/wireless/realtek/rtw88/fw.c ++++ b/drivers/net/wireless/realtek/rtw88/fw.c +@@ -498,9 +498,6 @@ static void rtw_rsvd_page_list_to_buf(struct rtw_dev *rtwdev, u8 page_size, + { + struct sk_buff *skb = rsvd_pkt->skb; + +- if (rsvd_pkt->add_txdesc) +- rtw_fill_rsvd_page_desc(rtwdev, skb); +- + if (page >= 1) + memcpy(buf + page_margin + page_size * (page - 1), + skb->data, skb->len); +@@ -625,16 +622,37 @@ static u8 *rtw_build_rsvd_page(struct rtw_dev *rtwdev, + list_for_each_entry(rsvd_pkt, &rtwdev->rsvd_page_list, list) { + iter = rtw_get_rsvd_page_skb(hw, vif, rsvd_pkt->type); + if (!iter) { +- rtw_err(rtwdev, "fail to build rsvd packet\n"); ++ rtw_err(rtwdev, "failed to build rsvd packet\n"); + goto release_skb; + } ++ ++ /* Fill the tx_desc for the rsvd pkt that requires one. ++ * And iter->len will be added with size of tx_desc_sz. ++ */ ++ if (rsvd_pkt->add_txdesc) ++ rtw_fill_rsvd_page_desc(rtwdev, iter); ++ + rsvd_pkt->skb = iter; + rsvd_pkt->page = total_page; +- if (rsvd_pkt->add_txdesc) ++ ++ /* Reserved page is downloaded via TX path, and TX path will ++ * generate a tx_desc at the header to describe length of ++ * the buffer. If we are not counting page numbers with the ++ * size of tx_desc added at the first rsvd_pkt (usually a ++ * beacon, firmware default refer to the first page as the ++ * content of beacon), we could generate a buffer which size ++ * is smaller than the actual size of the whole rsvd_page ++ */ ++ if (total_page == 0) { ++ if (rsvd_pkt->type != RSVD_BEACON) { ++ rtw_err(rtwdev, "first page should be a beacon\n"); ++ goto release_skb; ++ } + total_page += rtw_len_to_page(iter->len + tx_desc_sz, + page_size); +- else ++ } else { + total_page += rtw_len_to_page(iter->len, page_size); ++ } + } + + if (total_page > rtwdev->fifo.rsvd_drv_pg_num) { +@@ -647,13 +665,24 @@ static u8 *rtw_build_rsvd_page(struct rtw_dev *rtwdev, + if (!buf) + goto release_skb; + ++ /* Copy the content of each rsvd_pkt to the buf, and they should ++ * be aligned to the pages. ++ * ++ * Note that the first rsvd_pkt is a beacon no matter what vif->type. ++ * And that rsvd_pkt does not require tx_desc because when it goes ++ * through TX path, the TX path will generate one for it. ++ */ + list_for_each_entry(rsvd_pkt, &rtwdev->rsvd_page_list, list) { + rtw_rsvd_page_list_to_buf(rtwdev, page_size, page_margin, + page, buf, rsvd_pkt); +- page += rtw_len_to_page(rsvd_pkt->skb->len, page_size); +- } +- list_for_each_entry(rsvd_pkt, &rtwdev->rsvd_page_list, list) ++ if (page == 0) ++ page += rtw_len_to_page(rsvd_pkt->skb->len + ++ tx_desc_sz, page_size); ++ else ++ page += rtw_len_to_page(rsvd_pkt->skb->len, page_size); ++ + kfree_skb(rsvd_pkt->skb); ++ } + + return buf; + +@@ -706,6 +735,11 @@ int rtw_fw_download_rsvd_page(struct rtw_dev *rtwdev, struct ieee80211_vif *vif) + goto free; + } + ++ /* The last thing is to download the *ONLY* beacon again, because ++ * the previous tx_desc is to describe the total rsvd page. Download ++ * the beacon again to replace the TX desc header, and we will get ++ * a correct tx_desc for the beacon in the rsvd page. ++ */ + ret = rtw_download_beacon(rtwdev, vif); + if (ret) { + rtw_err(rtwdev, "failed to download beacon\n"); +diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c +index 7a3a4911bde2..806af37192bc 100644 +--- a/drivers/net/wireless/realtek/rtw88/main.c ++++ b/drivers/net/wireless/realtek/rtw88/main.c +@@ -1048,19 +1048,19 @@ static int rtw_chip_efuse_info_setup(struct rtw_dev *rtwdev) + /* power on mac to read efuse */ + ret = rtw_chip_efuse_enable(rtwdev); + if (ret) +- goto out; ++ goto out_unlock; + + ret = rtw_parse_efuse_map(rtwdev); + if (ret) +- goto out; ++ goto out_disable; + + ret = rtw_dump_hw_feature(rtwdev); + if (ret) +- goto out; ++ goto out_disable; + + ret = rtw_check_supported_rfe(rtwdev); + if (ret) +- goto out; ++ goto out_disable; + + if (efuse->crystal_cap == 0xff) + efuse->crystal_cap = 0; +@@ -1087,9 +1087,10 @@ static int rtw_chip_efuse_info_setup(struct rtw_dev *rtwdev) + efuse->ext_pa_5g = efuse->pa_type_5g & BIT(0) ? 1 : 0; + efuse->ext_lna_2g = efuse->lna_type_5g & BIT(3) ? 1 : 0; + ++out_disable: + rtw_chip_efuse_disable(rtwdev); + +-out: ++out_unlock: + mutex_unlock(&rtwdev->mutex); + return ret; + } +diff --git a/drivers/pci/controller/pcie-mobiveil.c b/drivers/pci/controller/pcie-mobiveil.c +index a45a6447b01d..32f37d08d5bc 100644 +--- a/drivers/pci/controller/pcie-mobiveil.c ++++ b/drivers/pci/controller/pcie-mobiveil.c +@@ -235,7 +235,7 @@ static int mobiveil_pcie_write(void __iomem *addr, int size, u32 val) + return PCIBIOS_SUCCESSFUL; + } + +-static u32 csr_read(struct mobiveil_pcie *pcie, u32 off, size_t size) ++static u32 mobiveil_csr_read(struct mobiveil_pcie *pcie, u32 off, size_t size) + { + void *addr; + u32 val; +@@ -250,7 +250,8 @@ static u32 csr_read(struct mobiveil_pcie *pcie, u32 off, size_t size) + return val; + } + +-static void csr_write(struct mobiveil_pcie *pcie, u32 val, u32 off, size_t size) ++static void mobiveil_csr_write(struct mobiveil_pcie *pcie, u32 val, u32 off, ++ size_t size) + { + void *addr; + int ret; +@@ -262,19 +263,19 @@ static void csr_write(struct mobiveil_pcie *pcie, u32 val, u32 off, size_t size) + dev_err(&pcie->pdev->dev, "write CSR address failed\n"); + } + +-static u32 csr_readl(struct mobiveil_pcie *pcie, u32 off) ++static u32 mobiveil_csr_readl(struct mobiveil_pcie *pcie, u32 off) + { +- return csr_read(pcie, off, 0x4); ++ return mobiveil_csr_read(pcie, off, 0x4); + } + +-static void csr_writel(struct mobiveil_pcie *pcie, u32 val, u32 off) ++static void mobiveil_csr_writel(struct mobiveil_pcie *pcie, u32 val, u32 off) + { +- csr_write(pcie, val, off, 0x4); ++ mobiveil_csr_write(pcie, val, off, 0x4); + } + + static bool mobiveil_pcie_link_up(struct mobiveil_pcie *pcie) + { +- return (csr_readl(pcie, LTSSM_STATUS) & ++ return (mobiveil_csr_readl(pcie, LTSSM_STATUS) & + LTSSM_STATUS_L0_MASK) == LTSSM_STATUS_L0; + } + +@@ -323,7 +324,7 @@ static void __iomem *mobiveil_pcie_map_bus(struct pci_bus *bus, + PCI_SLOT(devfn) << PAB_DEVICE_SHIFT | + PCI_FUNC(devfn) << PAB_FUNCTION_SHIFT; + +- csr_writel(pcie, value, PAB_AXI_AMAP_PEX_WIN_L(WIN_NUM_0)); ++ mobiveil_csr_writel(pcie, value, PAB_AXI_AMAP_PEX_WIN_L(WIN_NUM_0)); + + return pcie->config_axi_slave_base + where; + } +@@ -353,13 +354,14 @@ static void mobiveil_pcie_isr(struct irq_desc *desc) + chained_irq_enter(chip, desc); + + /* read INTx status */ +- val = csr_readl(pcie, PAB_INTP_AMBA_MISC_STAT); +- mask = csr_readl(pcie, PAB_INTP_AMBA_MISC_ENB); ++ val = mobiveil_csr_readl(pcie, PAB_INTP_AMBA_MISC_STAT); ++ mask = mobiveil_csr_readl(pcie, PAB_INTP_AMBA_MISC_ENB); + intr_status = val & mask; + + /* Handle INTx */ + if (intr_status & PAB_INTP_INTX_MASK) { +- shifted_status = csr_readl(pcie, PAB_INTP_AMBA_MISC_STAT); ++ shifted_status = mobiveil_csr_readl(pcie, ++ PAB_INTP_AMBA_MISC_STAT); + shifted_status &= PAB_INTP_INTX_MASK; + shifted_status >>= PAB_INTX_START; + do { +@@ -373,12 +375,13 @@ static void mobiveil_pcie_isr(struct irq_desc *desc) + bit); + + /* clear interrupt handled */ +- csr_writel(pcie, 1 << (PAB_INTX_START + bit), +- PAB_INTP_AMBA_MISC_STAT); ++ mobiveil_csr_writel(pcie, ++ 1 << (PAB_INTX_START + bit), ++ PAB_INTP_AMBA_MISC_STAT); + } + +- shifted_status = csr_readl(pcie, +- PAB_INTP_AMBA_MISC_STAT); ++ shifted_status = mobiveil_csr_readl(pcie, ++ PAB_INTP_AMBA_MISC_STAT); + shifted_status &= PAB_INTP_INTX_MASK; + shifted_status >>= PAB_INTX_START; + } while (shifted_status != 0); +@@ -413,7 +416,7 @@ static void mobiveil_pcie_isr(struct irq_desc *desc) + } + + /* Clear the interrupt status */ +- csr_writel(pcie, intr_status, PAB_INTP_AMBA_MISC_STAT); ++ mobiveil_csr_writel(pcie, intr_status, PAB_INTP_AMBA_MISC_STAT); + chained_irq_exit(chip, desc); + } + +@@ -474,24 +477,24 @@ static void program_ib_windows(struct mobiveil_pcie *pcie, int win_num, + return; + } + +- value = csr_readl(pcie, PAB_PEX_AMAP_CTRL(win_num)); ++ value = mobiveil_csr_readl(pcie, PAB_PEX_AMAP_CTRL(win_num)); + value &= ~(AMAP_CTRL_TYPE_MASK << AMAP_CTRL_TYPE_SHIFT | WIN_SIZE_MASK); + value |= type << AMAP_CTRL_TYPE_SHIFT | 1 << AMAP_CTRL_EN_SHIFT | + (lower_32_bits(size64) & WIN_SIZE_MASK); +- csr_writel(pcie, value, PAB_PEX_AMAP_CTRL(win_num)); ++ mobiveil_csr_writel(pcie, value, PAB_PEX_AMAP_CTRL(win_num)); + +- csr_writel(pcie, upper_32_bits(size64), +- PAB_EXT_PEX_AMAP_SIZEN(win_num)); ++ mobiveil_csr_writel(pcie, upper_32_bits(size64), ++ PAB_EXT_PEX_AMAP_SIZEN(win_num)); + +- csr_writel(pcie, lower_32_bits(cpu_addr), +- PAB_PEX_AMAP_AXI_WIN(win_num)); +- csr_writel(pcie, upper_32_bits(cpu_addr), +- PAB_EXT_PEX_AMAP_AXI_WIN(win_num)); ++ mobiveil_csr_writel(pcie, lower_32_bits(cpu_addr), ++ PAB_PEX_AMAP_AXI_WIN(win_num)); ++ mobiveil_csr_writel(pcie, upper_32_bits(cpu_addr), ++ PAB_EXT_PEX_AMAP_AXI_WIN(win_num)); + +- csr_writel(pcie, lower_32_bits(pci_addr), +- PAB_PEX_AMAP_PEX_WIN_L(win_num)); +- csr_writel(pcie, upper_32_bits(pci_addr), +- PAB_PEX_AMAP_PEX_WIN_H(win_num)); ++ mobiveil_csr_writel(pcie, lower_32_bits(pci_addr), ++ PAB_PEX_AMAP_PEX_WIN_L(win_num)); ++ mobiveil_csr_writel(pcie, upper_32_bits(pci_addr), ++ PAB_PEX_AMAP_PEX_WIN_H(win_num)); + + pcie->ib_wins_configured++; + } +@@ -515,27 +518,29 @@ static void program_ob_windows(struct mobiveil_pcie *pcie, int win_num, + * program Enable Bit to 1, Type Bit to (00) base 2, AXI Window Size Bit + * to 4 KB in PAB_AXI_AMAP_CTRL register + */ +- value = csr_readl(pcie, PAB_AXI_AMAP_CTRL(win_num)); ++ value = mobiveil_csr_readl(pcie, PAB_AXI_AMAP_CTRL(win_num)); + value &= ~(WIN_TYPE_MASK << WIN_TYPE_SHIFT | WIN_SIZE_MASK); + value |= 1 << WIN_ENABLE_SHIFT | type << WIN_TYPE_SHIFT | + (lower_32_bits(size64) & WIN_SIZE_MASK); +- csr_writel(pcie, value, PAB_AXI_AMAP_CTRL(win_num)); ++ mobiveil_csr_writel(pcie, value, PAB_AXI_AMAP_CTRL(win_num)); + +- csr_writel(pcie, upper_32_bits(size64), PAB_EXT_AXI_AMAP_SIZE(win_num)); ++ mobiveil_csr_writel(pcie, upper_32_bits(size64), ++ PAB_EXT_AXI_AMAP_SIZE(win_num)); + + /* + * program AXI window base with appropriate value in + * PAB_AXI_AMAP_AXI_WIN0 register + */ +- csr_writel(pcie, lower_32_bits(cpu_addr) & (~AXI_WINDOW_ALIGN_MASK), +- PAB_AXI_AMAP_AXI_WIN(win_num)); +- csr_writel(pcie, upper_32_bits(cpu_addr), +- PAB_EXT_AXI_AMAP_AXI_WIN(win_num)); ++ mobiveil_csr_writel(pcie, ++ lower_32_bits(cpu_addr) & (~AXI_WINDOW_ALIGN_MASK), ++ PAB_AXI_AMAP_AXI_WIN(win_num)); ++ mobiveil_csr_writel(pcie, upper_32_bits(cpu_addr), ++ PAB_EXT_AXI_AMAP_AXI_WIN(win_num)); + +- csr_writel(pcie, lower_32_bits(pci_addr), +- PAB_AXI_AMAP_PEX_WIN_L(win_num)); +- csr_writel(pcie, upper_32_bits(pci_addr), +- PAB_AXI_AMAP_PEX_WIN_H(win_num)); ++ mobiveil_csr_writel(pcie, lower_32_bits(pci_addr), ++ PAB_AXI_AMAP_PEX_WIN_L(win_num)); ++ mobiveil_csr_writel(pcie, upper_32_bits(pci_addr), ++ PAB_AXI_AMAP_PEX_WIN_H(win_num)); + + pcie->ob_wins_configured++; + } +@@ -579,42 +584,42 @@ static int mobiveil_host_init(struct mobiveil_pcie *pcie) + struct resource_entry *win; + + /* setup bus numbers */ +- value = csr_readl(pcie, PCI_PRIMARY_BUS); ++ value = mobiveil_csr_readl(pcie, PCI_PRIMARY_BUS); + value &= 0xff000000; + value |= 0x00ff0100; +- csr_writel(pcie, value, PCI_PRIMARY_BUS); ++ mobiveil_csr_writel(pcie, value, PCI_PRIMARY_BUS); + + /* + * program Bus Master Enable Bit in Command Register in PAB Config + * Space + */ +- value = csr_readl(pcie, PCI_COMMAND); ++ value = mobiveil_csr_readl(pcie, PCI_COMMAND); + value |= PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER; +- csr_writel(pcie, value, PCI_COMMAND); ++ mobiveil_csr_writel(pcie, value, PCI_COMMAND); + + /* + * program PIO Enable Bit to 1 (and PEX PIO Enable to 1) in PAB_CTRL + * register + */ +- pab_ctrl = csr_readl(pcie, PAB_CTRL); ++ pab_ctrl = mobiveil_csr_readl(pcie, PAB_CTRL); + pab_ctrl |= (1 << AMBA_PIO_ENABLE_SHIFT) | (1 << PEX_PIO_ENABLE_SHIFT); +- csr_writel(pcie, pab_ctrl, PAB_CTRL); ++ mobiveil_csr_writel(pcie, pab_ctrl, PAB_CTRL); + +- csr_writel(pcie, (PAB_INTP_INTX_MASK | PAB_INTP_MSI_MASK), +- PAB_INTP_AMBA_MISC_ENB); ++ mobiveil_csr_writel(pcie, (PAB_INTP_INTX_MASK | PAB_INTP_MSI_MASK), ++ PAB_INTP_AMBA_MISC_ENB); + + /* + * program PIO Enable Bit to 1 and Config Window Enable Bit to 1 in + * PAB_AXI_PIO_CTRL Register + */ +- value = csr_readl(pcie, PAB_AXI_PIO_CTRL); ++ value = mobiveil_csr_readl(pcie, PAB_AXI_PIO_CTRL); + value |= APIO_EN_MASK; +- csr_writel(pcie, value, PAB_AXI_PIO_CTRL); ++ mobiveil_csr_writel(pcie, value, PAB_AXI_PIO_CTRL); + + /* Enable PCIe PIO master */ +- value = csr_readl(pcie, PAB_PEX_PIO_CTRL); ++ value = mobiveil_csr_readl(pcie, PAB_PEX_PIO_CTRL); + value |= 1 << PIO_ENABLE_SHIFT; +- csr_writel(pcie, value, PAB_PEX_PIO_CTRL); ++ mobiveil_csr_writel(pcie, value, PAB_PEX_PIO_CTRL); + + /* + * we'll program one outbound window for config reads and +@@ -647,10 +652,10 @@ static int mobiveil_host_init(struct mobiveil_pcie *pcie) + } + + /* fixup for PCIe class register */ +- value = csr_readl(pcie, PAB_INTP_AXI_PIO_CLASS); ++ value = mobiveil_csr_readl(pcie, PAB_INTP_AXI_PIO_CLASS); + value &= 0xff; + value |= (PCI_CLASS_BRIDGE_PCI << 16); +- csr_writel(pcie, value, PAB_INTP_AXI_PIO_CLASS); ++ mobiveil_csr_writel(pcie, value, PAB_INTP_AXI_PIO_CLASS); + + /* setup MSI hardware registers */ + mobiveil_pcie_enable_msi(pcie); +@@ -668,9 +673,9 @@ static void mobiveil_mask_intx_irq(struct irq_data *data) + pcie = irq_desc_get_chip_data(desc); + mask = 1 << ((data->hwirq + PAB_INTX_START) - 1); + raw_spin_lock_irqsave(&pcie->intx_mask_lock, flags); +- shifted_val = csr_readl(pcie, PAB_INTP_AMBA_MISC_ENB); ++ shifted_val = mobiveil_csr_readl(pcie, PAB_INTP_AMBA_MISC_ENB); + shifted_val &= ~mask; +- csr_writel(pcie, shifted_val, PAB_INTP_AMBA_MISC_ENB); ++ mobiveil_csr_writel(pcie, shifted_val, PAB_INTP_AMBA_MISC_ENB); + raw_spin_unlock_irqrestore(&pcie->intx_mask_lock, flags); + } + +@@ -684,9 +689,9 @@ static void mobiveil_unmask_intx_irq(struct irq_data *data) + pcie = irq_desc_get_chip_data(desc); + mask = 1 << ((data->hwirq + PAB_INTX_START) - 1); + raw_spin_lock_irqsave(&pcie->intx_mask_lock, flags); +- shifted_val = csr_readl(pcie, PAB_INTP_AMBA_MISC_ENB); ++ shifted_val = mobiveil_csr_readl(pcie, PAB_INTP_AMBA_MISC_ENB); + shifted_val |= mask; +- csr_writel(pcie, shifted_val, PAB_INTP_AMBA_MISC_ENB); ++ mobiveil_csr_writel(pcie, shifted_val, PAB_INTP_AMBA_MISC_ENB); + raw_spin_unlock_irqrestore(&pcie->intx_mask_lock, flags); + } + +diff --git a/drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c b/drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c +index 544d64a84cc0..6e457967653e 100644 +--- a/drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c ++++ b/drivers/phy/lantiq/phy-lantiq-vrx200-pcie.c +@@ -323,7 +323,8 @@ static int ltq_vrx200_pcie_phy_power_on(struct phy *phy) + goto err_disable_pdi_clk; + + /* Check if we are in "startup ready" status */ +- if (ltq_vrx200_pcie_phy_wait_for_pll(phy) != 0) ++ ret = ltq_vrx200_pcie_phy_wait_for_pll(phy); ++ if (ret) + goto err_disable_phy_clk; + + ltq_vrx200_pcie_phy_apply_workarounds(phy); +diff --git a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +index 2b97fb1185a0..9ca20c947283 100644 +--- a/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c ++++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +@@ -603,6 +603,8 @@ static long inno_hdmi_phy_rk3228_clk_round_rate(struct clk_hw *hw, + { + const struct pre_pll_config *cfg = pre_pll_cfg_table; + ++ rate = (rate / 1000) * 1000; ++ + for (; cfg->pixclock != 0; cfg++) + if (cfg->pixclock == rate && !cfg->fracdiv) + break; +@@ -755,6 +757,8 @@ static long inno_hdmi_phy_rk3328_clk_round_rate(struct clk_hw *hw, + { + const struct pre_pll_config *cfg = pre_pll_cfg_table; + ++ rate = (rate / 1000) * 1000; ++ + for (; cfg->pixclock != 0; cfg++) + if (cfg->pixclock == rate) + break; +diff --git a/drivers/phy/ti/phy-gmii-sel.c b/drivers/phy/ti/phy-gmii-sel.c +index a52c5bb35033..a28bd15297f5 100644 +--- a/drivers/phy/ti/phy-gmii-sel.c ++++ b/drivers/phy/ti/phy-gmii-sel.c +@@ -69,11 +69,11 @@ static int phy_gmii_sel_mode(struct phy *phy, enum phy_mode mode, int submode) + break; + + case PHY_INTERFACE_MODE_RGMII: ++ case PHY_INTERFACE_MODE_RGMII_RXID: + gmii_sel_mode = AM33XX_GMII_SEL_MODE_RGMII; + break; + + case PHY_INTERFACE_MODE_RGMII_ID: +- case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: + gmii_sel_mode = AM33XX_GMII_SEL_MODE_RGMII; + rgmii_id = 1; +diff --git a/drivers/platform/chrome/wilco_ec/telemetry.c b/drivers/platform/chrome/wilco_ec/telemetry.c +index b9d03c33d8dc..1176d543191a 100644 +--- a/drivers/platform/chrome/wilco_ec/telemetry.c ++++ b/drivers/platform/chrome/wilco_ec/telemetry.c +@@ -406,8 +406,8 @@ static int telem_device_remove(struct platform_device *pdev) + struct telem_device_data *dev_data = platform_get_drvdata(pdev); + + cdev_device_del(&dev_data->cdev, &dev_data->dev); +- put_device(&dev_data->dev); + ida_simple_remove(&telem_ida, MINOR(dev_data->dev.devt)); ++ put_device(&dev_data->dev); + + return 0; + } +diff --git a/drivers/power/supply/bd70528-charger.c b/drivers/power/supply/bd70528-charger.c +index 1bb32b7226d7..b8e1ec106627 100644 +--- a/drivers/power/supply/bd70528-charger.c ++++ b/drivers/power/supply/bd70528-charger.c +@@ -741,3 +741,4 @@ module_platform_driver(bd70528_power); + MODULE_AUTHOR("Matti Vaittinen "); + MODULE_DESCRIPTION("BD70528 power-supply driver"); + MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platform:bd70528-power"); +diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c +index 6f5840a1a82d..05273725a9ff 100644 +--- a/drivers/pwm/pwm-sun4i.c ++++ b/drivers/pwm/pwm-sun4i.c +@@ -137,10 +137,10 @@ static void sun4i_pwm_get_state(struct pwm_chip *chip, + + val = sun4i_pwm_readl(sun4i_pwm, PWM_CH_PRD(pwm->hwpwm)); + +- tmp = prescaler * NSEC_PER_SEC * PWM_REG_DTY(val); ++ tmp = (u64)prescaler * NSEC_PER_SEC * PWM_REG_DTY(val); + state->duty_cycle = DIV_ROUND_CLOSEST_ULL(tmp, clk_rate); + +- tmp = prescaler * NSEC_PER_SEC * PWM_REG_PRD(val); ++ tmp = (u64)prescaler * NSEC_PER_SEC * PWM_REG_PRD(val); + state->period = DIV_ROUND_CLOSEST_ULL(tmp, clk_rate); + } + +diff --git a/drivers/regulator/bd70528-regulator.c b/drivers/regulator/bd70528-regulator.c +index 6041839ec38c..5bf8a2dc5fe7 100644 +--- a/drivers/regulator/bd70528-regulator.c ++++ b/drivers/regulator/bd70528-regulator.c +@@ -285,3 +285,4 @@ module_platform_driver(bd70528_regulator); + MODULE_AUTHOR("Matti Vaittinen "); + MODULE_DESCRIPTION("BD70528 voltage regulator driver"); + MODULE_LICENSE("GPL"); ++MODULE_ALIAS("platform:bd70528-pmic"); +diff --git a/drivers/rtc/rtc-bd70528.c b/drivers/rtc/rtc-bd70528.c +index ddfef4d43bab..627037aa66a8 100644 +--- a/drivers/rtc/rtc-bd70528.c ++++ b/drivers/rtc/rtc-bd70528.c +@@ -491,4 +491,4 @@ module_platform_driver(bd70528_rtc); + MODULE_AUTHOR("Matti Vaittinen "); + MODULE_DESCRIPTION("BD70528 RTC driver"); + MODULE_LICENSE("GPL"); +-MODULE_ALIAS("platofrm:bd70528-rtc"); ++MODULE_ALIAS("platform:bd70528-rtc"); +diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c +index 9de3d46b3253..e17fac20127e 100644 +--- a/drivers/s390/crypto/pkey_api.c ++++ b/drivers/s390/crypto/pkey_api.c +@@ -740,8 +740,10 @@ static void *_copy_apqns_from_user(void __user *uapqns, size_t nr_apqns) + kapqns = kmalloc(nbytes, GFP_KERNEL); + if (!kapqns) + return ERR_PTR(-ENOMEM); +- if (copy_from_user(kapqns, uapqns, nbytes)) ++ if (copy_from_user(kapqns, uapqns, nbytes)) { ++ kfree(kapqns); + return ERR_PTR(-EFAULT); ++ } + } + + return kapqns; +diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h +index 65e31df37b1f..820f2c29376c 100644 +--- a/drivers/s390/net/qeth_core.h ++++ b/drivers/s390/net/qeth_core.h +@@ -620,6 +620,7 @@ struct qeth_ipato { + + struct qeth_channel { + struct ccw_device *ccwdev; ++ struct qeth_cmd_buffer *active_cmd; + enum qeth_channel_states state; + atomic_t irq_pending; + }; +@@ -1024,6 +1025,8 @@ int qeth_do_run_thread(struct qeth_card *, unsigned long); + void qeth_clear_thread_start_bit(struct qeth_card *, unsigned long); + void qeth_clear_thread_running_bit(struct qeth_card *, unsigned long); + int qeth_core_hardsetup_card(struct qeth_card *card, bool *carrier_ok); ++int qeth_stop_channel(struct qeth_channel *channel); ++ + void qeth_print_status_message(struct qeth_card *); + int qeth_init_qdio_queues(struct qeth_card *); + int qeth_send_ipa_cmd(struct qeth_card *, struct qeth_cmd_buffer *, +diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c +index 5be4d800e4ba..23852888eb2c 100644 +--- a/drivers/s390/net/qeth_core_main.c ++++ b/drivers/s390/net/qeth_core_main.c +@@ -515,7 +515,9 @@ static int __qeth_issue_next_read(struct qeth_card *card) + + QETH_CARD_TEXT(card, 6, "noirqpnd"); + rc = ccw_device_start(channel->ccwdev, ccw, (addr_t) iob, 0, 0); +- if (rc) { ++ if (!rc) { ++ channel->active_cmd = iob; ++ } else { + QETH_DBF_MESSAGE(2, "error %i on device %x when starting next read ccw!\n", + rc, CARD_DEVID(card)); + atomic_set(&channel->irq_pending, 0); +@@ -986,8 +988,21 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm, + QETH_CARD_TEXT(card, 5, "data"); + } + +- if (qeth_intparm_is_iob(intparm)) +- iob = (struct qeth_cmd_buffer *) __va((addr_t)intparm); ++ if (intparm == 0) { ++ QETH_CARD_TEXT(card, 5, "irqunsol"); ++ } else if ((addr_t)intparm != (addr_t)channel->active_cmd) { ++ QETH_CARD_TEXT(card, 5, "irqunexp"); ++ ++ dev_err(&cdev->dev, ++ "Received IRQ with intparm %lx, expected %px\n", ++ intparm, channel->active_cmd); ++ if (channel->active_cmd) ++ qeth_cancel_cmd(channel->active_cmd, -EIO); ++ } else { ++ iob = (struct qeth_cmd_buffer *) (addr_t)intparm; ++ } ++ ++ channel->active_cmd = NULL; + + rc = qeth_check_irb_error(card, cdev, irb); + if (rc) { +@@ -1007,15 +1022,10 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm, + if (irb->scsw.cmd.fctl & (SCSW_FCTL_HALT_FUNC)) + channel->state = CH_STATE_HALTED; + +- if (intparm == QETH_CLEAR_CHANNEL_PARM) { +- QETH_CARD_TEXT(card, 6, "clrchpar"); +- /* we don't have to handle this further */ +- intparm = 0; +- } +- if (intparm == QETH_HALT_CHANNEL_PARM) { +- QETH_CARD_TEXT(card, 6, "hltchpar"); +- /* we don't have to handle this further */ +- intparm = 0; ++ if (iob && (irb->scsw.cmd.fctl & (SCSW_FCTL_CLEAR_FUNC | ++ SCSW_FCTL_HALT_FUNC))) { ++ qeth_cancel_cmd(iob, -ECANCELED); ++ iob = NULL; + } + + cstat = irb->scsw.cmd.cstat; +@@ -1408,7 +1418,7 @@ static int qeth_clear_channel(struct qeth_card *card, + + QETH_CARD_TEXT(card, 3, "clearch"); + spin_lock_irq(get_ccwdev_lock(channel->ccwdev)); +- rc = ccw_device_clear(channel->ccwdev, QETH_CLEAR_CHANNEL_PARM); ++ rc = ccw_device_clear(channel->ccwdev, (addr_t)channel->active_cmd); + spin_unlock_irq(get_ccwdev_lock(channel->ccwdev)); + + if (rc) +@@ -1430,7 +1440,7 @@ static int qeth_halt_channel(struct qeth_card *card, + + QETH_CARD_TEXT(card, 3, "haltch"); + spin_lock_irq(get_ccwdev_lock(channel->ccwdev)); +- rc = ccw_device_halt(channel->ccwdev, QETH_HALT_CHANNEL_PARM); ++ rc = ccw_device_halt(channel->ccwdev, (addr_t)channel->active_cmd); + spin_unlock_irq(get_ccwdev_lock(channel->ccwdev)); + + if (rc) +@@ -1444,6 +1454,25 @@ static int qeth_halt_channel(struct qeth_card *card, + return 0; + } + ++int qeth_stop_channel(struct qeth_channel *channel) ++{ ++ struct ccw_device *cdev = channel->ccwdev; ++ int rc; ++ ++ rc = ccw_device_set_offline(cdev); ++ ++ spin_lock_irq(get_ccwdev_lock(cdev)); ++ if (channel->active_cmd) { ++ dev_err(&cdev->dev, "Stopped channel while cmd %px was still active\n", ++ channel->active_cmd); ++ channel->active_cmd = NULL; ++ } ++ spin_unlock_irq(get_ccwdev_lock(cdev)); ++ ++ return rc; ++} ++EXPORT_SYMBOL_GPL(qeth_stop_channel); ++ + static int qeth_halt_channels(struct qeth_card *card) + { + int rc1 = 0, rc2 = 0, rc3 = 0; +@@ -1747,6 +1776,8 @@ static int qeth_send_control_data(struct qeth_card *card, + spin_lock_irq(get_ccwdev_lock(channel->ccwdev)); + rc = ccw_device_start_timeout(channel->ccwdev, __ccw_from_cmd(iob), + (addr_t) iob, 0, 0, timeout); ++ if (!rc) ++ channel->active_cmd = iob; + spin_unlock_irq(get_ccwdev_lock(channel->ccwdev)); + if (rc) { + QETH_DBF_MESSAGE(2, "qeth_send_control_data on device %x: ccw_device_start rc = %i\n", +@@ -4625,12 +4656,12 @@ EXPORT_SYMBOL_GPL(qeth_vm_request_mac); + + static void qeth_determine_capabilities(struct qeth_card *card) + { ++ struct qeth_channel *channel = &card->data; ++ struct ccw_device *ddev = channel->ccwdev; + int rc; +- struct ccw_device *ddev; + int ddev_offline = 0; + + QETH_CARD_TEXT(card, 2, "detcapab"); +- ddev = CARD_DDEV(card); + if (!ddev->online) { + ddev_offline = 1; + rc = ccw_device_set_online(ddev); +@@ -4669,7 +4700,7 @@ static void qeth_determine_capabilities(struct qeth_card *card) + + out_offline: + if (ddev_offline == 1) +- ccw_device_set_offline(ddev); ++ qeth_stop_channel(channel); + out: + return; + } +@@ -4870,9 +4901,9 @@ retry: + QETH_DBF_MESSAGE(2, "Retrying to do IDX activates on device %x.\n", + CARD_DEVID(card)); + rc = qeth_qdio_clear_card(card, !IS_IQD(card)); +- ccw_device_set_offline(CARD_DDEV(card)); +- ccw_device_set_offline(CARD_WDEV(card)); +- ccw_device_set_offline(CARD_RDEV(card)); ++ qeth_stop_channel(&card->data); ++ qeth_stop_channel(&card->write); ++ qeth_stop_channel(&card->read); + qdio_free(CARD_DDEV(card)); + rc = ccw_device_set_online(CARD_RDEV(card)); + if (rc) +diff --git a/drivers/s390/net/qeth_core_mpc.h b/drivers/s390/net/qeth_core_mpc.h +index b7c17b5c823b..65038539b324 100644 +--- a/drivers/s390/net/qeth_core_mpc.h ++++ b/drivers/s390/net/qeth_core_mpc.h +@@ -28,20 +28,6 @@ extern unsigned char IPA_PDU_HEADER[]; + #define QETH_TIMEOUT (10 * HZ) + #define QETH_IPA_TIMEOUT (45 * HZ) + +-#define QETH_CLEAR_CHANNEL_PARM -10 +-#define QETH_HALT_CHANNEL_PARM -11 +- +-static inline bool qeth_intparm_is_iob(unsigned long intparm) +-{ +- switch (intparm) { +- case QETH_CLEAR_CHANNEL_PARM: +- case QETH_HALT_CHANNEL_PARM: +- case 0: +- return false; +- } +- return true; +-} +- + /*****************************************************************************/ + /* IP Assist related definitions */ + /*****************************************************************************/ +diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c +index 11e3292c0adf..59e220749ad1 100644 +--- a/drivers/s390/net/qeth_l2_main.c ++++ b/drivers/s390/net/qeth_l2_main.c +@@ -877,9 +877,9 @@ static int qeth_l2_set_online(struct ccwgroup_device *gdev) + + out_remove: + qeth_l2_stop_card(card); +- ccw_device_set_offline(CARD_DDEV(card)); +- ccw_device_set_offline(CARD_WDEV(card)); +- ccw_device_set_offline(CARD_RDEV(card)); ++ qeth_stop_channel(&card->data); ++ qeth_stop_channel(&card->write); ++ qeth_stop_channel(&card->read); + qdio_free(CARD_DDEV(card)); + + mutex_unlock(&card->conf_mutex); +@@ -910,9 +910,9 @@ static int __qeth_l2_set_offline(struct ccwgroup_device *cgdev, + rtnl_unlock(); + + qeth_l2_stop_card(card); +- rc = ccw_device_set_offline(CARD_DDEV(card)); +- rc2 = ccw_device_set_offline(CARD_WDEV(card)); +- rc3 = ccw_device_set_offline(CARD_RDEV(card)); ++ rc = qeth_stop_channel(&card->data); ++ rc2 = qeth_stop_channel(&card->write); ++ rc3 = qeth_stop_channel(&card->read); + if (!rc) + rc = (rc2) ? rc2 : rc3; + if (rc) +diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c +index 5152970a9aa4..a1c23e998f97 100644 +--- a/drivers/s390/net/qeth_l3_main.c ++++ b/drivers/s390/net/qeth_l3_main.c +@@ -2383,9 +2383,9 @@ static int qeth_l3_set_online(struct ccwgroup_device *gdev) + return 0; + out_remove: + qeth_l3_stop_card(card); +- ccw_device_set_offline(CARD_DDEV(card)); +- ccw_device_set_offline(CARD_WDEV(card)); +- ccw_device_set_offline(CARD_RDEV(card)); ++ qeth_stop_channel(&card->data); ++ qeth_stop_channel(&card->write); ++ qeth_stop_channel(&card->read); + qdio_free(CARD_DDEV(card)); + + mutex_unlock(&card->conf_mutex); +@@ -2421,9 +2421,10 @@ static int __qeth_l3_set_offline(struct ccwgroup_device *cgdev, + call_netdevice_notifiers(NETDEV_REBOOT, card->dev); + rtnl_unlock(); + } +- rc = ccw_device_set_offline(CARD_DDEV(card)); +- rc2 = ccw_device_set_offline(CARD_WDEV(card)); +- rc3 = ccw_device_set_offline(CARD_RDEV(card)); ++ ++ rc = qeth_stop_channel(&card->data); ++ rc2 = qeth_stop_channel(&card->write); ++ rc3 = qeth_stop_channel(&card->read); + if (!rc) + rc = (rc2) ? rc2 : rc3; + if (rc) +diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c +index 25a6a25b17a2..1e38bb967871 100644 +--- a/drivers/scsi/ufs/ufshcd.c ++++ b/drivers/scsi/ufs/ufshcd.c +@@ -6779,23 +6779,13 @@ static void ufshcd_init_desc_sizes(struct ufs_hba *hba) + &hba->desc_size.geom_desc); + if (err) + hba->desc_size.geom_desc = QUERY_DESC_GEOMETRY_DEF_SIZE; ++ + err = ufshcd_read_desc_length(hba, QUERY_DESC_IDN_HEALTH, 0, + &hba->desc_size.hlth_desc); + if (err) + hba->desc_size.hlth_desc = QUERY_DESC_HEALTH_DEF_SIZE; + } + +-static void ufshcd_def_desc_sizes(struct ufs_hba *hba) +-{ +- hba->desc_size.dev_desc = QUERY_DESC_DEVICE_DEF_SIZE; +- hba->desc_size.pwr_desc = QUERY_DESC_POWER_DEF_SIZE; +- hba->desc_size.interc_desc = QUERY_DESC_INTERCONNECT_DEF_SIZE; +- hba->desc_size.conf_desc = QUERY_DESC_CONFIGURATION_DEF_SIZE; +- hba->desc_size.unit_desc = QUERY_DESC_UNIT_DEF_SIZE; +- hba->desc_size.geom_desc = QUERY_DESC_GEOMETRY_DEF_SIZE; +- hba->desc_size.hlth_desc = QUERY_DESC_HEALTH_DEF_SIZE; +-} +- + static struct ufs_ref_clk ufs_ref_clk_freqs[] = { + {19200000, REF_CLK_FREQ_19_2_MHZ}, + {26000000, REF_CLK_FREQ_26_MHZ}, +@@ -8283,9 +8273,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) + hba->mmio_base = mmio_base; + hba->irq = irq; + +- /* Set descriptor lengths to specification defaults */ +- ufshcd_def_desc_sizes(hba); +- + err = ufshcd_hba_init(hba); + if (err) + goto out_error; +diff --git a/drivers/soc/aspeed/aspeed-lpc-snoop.c b/drivers/soc/aspeed/aspeed-lpc-snoop.c +index 48f7ac238861..f3d8d53ab84d 100644 +--- a/drivers/soc/aspeed/aspeed-lpc-snoop.c ++++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c +@@ -97,13 +97,13 @@ static ssize_t snoop_file_read(struct file *file, char __user *buffer, + return ret ? ret : copied; + } + +-static unsigned int snoop_file_poll(struct file *file, ++static __poll_t snoop_file_poll(struct file *file, + struct poll_table_struct *pt) + { + struct aspeed_lpc_snoop_channel *chan = snoop_file_to_chan(file); + + poll_wait(file, &chan->wq, pt); +- return !kfifo_is_empty(&chan->fifo) ? POLLIN : 0; ++ return !kfifo_is_empty(&chan->fifo) ? EPOLLIN : 0; + } + + static const struct file_operations snoop_fops = { +diff --git a/drivers/soc/qcom/llcc-slice.c b/drivers/soc/qcom/llcc-slice.c +index 9090ea12eaf3..4a6111635f82 100644 +--- a/drivers/soc/qcom/llcc-slice.c ++++ b/drivers/soc/qcom/llcc-slice.c +@@ -48,7 +48,7 @@ + + static struct llcc_drv_data *drv_data = (void *) -EPROBE_DEFER; + +-static const struct regmap_config llcc_regmap_config = { ++static struct regmap_config llcc_regmap_config = { + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, +@@ -323,6 +323,7 @@ static struct regmap *qcom_llcc_init_mmio(struct platform_device *pdev, + if (IS_ERR(base)) + return ERR_CAST(base); + ++ llcc_regmap_config.name = name; + return devm_regmap_init_mmio(&pdev->dev, base, &llcc_regmap_config); + } + +diff --git a/drivers/soc/renesas/renesas-soc.c b/drivers/soc/renesas/renesas-soc.c +index 3299cf5365f3..6651755e9f20 100644 +--- a/drivers/soc/renesas/renesas-soc.c ++++ b/drivers/soc/renesas/renesas-soc.c +@@ -326,7 +326,7 @@ static int __init renesas_soc_init(void) + if (np) { + chipid = of_iomap(np, 0); + of_node_put(np); +- } else if (soc->id) { ++ } else if (soc->id && family->reg) { + chipid = ioremap(family->reg, 4); + } + if (chipid) { +diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c +index 9f9c1c677cf4..0447afa970f5 100644 +--- a/drivers/soc/tegra/pmc.c ++++ b/drivers/soc/tegra/pmc.c +@@ -1899,6 +1899,20 @@ static int tegra_pmc_irq_alloc(struct irq_domain *domain, unsigned int virq, + event->id, + &pmc->irq, pmc); + ++ /* ++ * GPIOs don't have an equivalent interrupt in the ++ * parent controller (GIC). However some code, such ++ * as the one in irq_get_irqchip_state(), require a ++ * valid IRQ chip to be set. Make sure that's the ++ * case by passing NULL here, which will install a ++ * dummy IRQ chip for the interrupt in the parent ++ * domain. ++ */ ++ if (domain->parent) ++ irq_domain_set_hwirq_and_chip(domain->parent, ++ virq, 0, NULL, ++ NULL); ++ + break; + } + } +@@ -1908,10 +1922,22 @@ static int tegra_pmc_irq_alloc(struct irq_domain *domain, unsigned int virq, + * dummy hardware IRQ number. This is used in the ->irq_set_type() + * and ->irq_set_wake() callbacks to return early for these IRQs. + */ +- if (i == soc->num_wake_events) ++ if (i == soc->num_wake_events) { + err = irq_domain_set_hwirq_and_chip(domain, virq, ULONG_MAX, + &pmc->irq, pmc); + ++ /* ++ * Interrupts without a wake event don't have a corresponding ++ * interrupt in the parent controller (GIC). Pass NULL for the ++ * chip here, which causes a dummy IRQ chip to be installed ++ * for the interrupt in the parent domain, to make this ++ * explicit. ++ */ ++ if (domain->parent) ++ irq_domain_set_hwirq_and_chip(domain->parent, virq, 0, ++ NULL, NULL); ++ } ++ + return err; + } + +diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c +index 13b0269a0abc..cf2367ba08d6 100644 +--- a/drivers/tee/optee/call.c ++++ b/drivers/tee/optee/call.c +@@ -554,6 +554,13 @@ static int check_mem_type(unsigned long start, size_t num_pages) + struct mm_struct *mm = current->mm; + int rc; + ++ /* ++ * Allow kernel address to register with OP-TEE as kernel ++ * pages are configured as normal memory only. ++ */ ++ if (virt_addr_valid(start)) ++ return 0; ++ + down_read(&mm->mmap_sem); + rc = __check_mem_type(find_vma(mm, start), + start + num_pages * PAGE_SIZE); +diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c +index 1854a3db7345..b830e0a87fba 100644 +--- a/drivers/tee/optee/core.c ++++ b/drivers/tee/optee/core.c +@@ -643,11 +643,6 @@ static struct optee *optee_probe(struct device_node *np) + if (optee->sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM) + pr_info("dynamic shared memory is enabled\n"); + +- rc = optee_enumerate_devices(); +- if (rc) +- goto err; +- +- pr_info("initialized driver\n"); + return optee; + err: + if (optee) { +@@ -702,9 +697,10 @@ static struct optee *optee_svc; + + static int __init optee_driver_init(void) + { +- struct device_node *fw_np; +- struct device_node *np; +- struct optee *optee; ++ struct device_node *fw_np = NULL; ++ struct device_node *np = NULL; ++ struct optee *optee = NULL; ++ int rc = 0; + + /* Node is supposed to be below /firmware */ + fw_np = of_find_node_by_name(NULL, "firmware"); +@@ -723,6 +719,14 @@ static int __init optee_driver_init(void) + if (IS_ERR(optee)) + return PTR_ERR(optee); + ++ rc = optee_enumerate_devices(); ++ if (rc) { ++ optee_remove(optee); ++ return rc; ++ } ++ ++ pr_info("initialized driver\n"); ++ + optee_svc = optee; + + return 0; +diff --git a/drivers/tee/optee/shm_pool.c b/drivers/tee/optee/shm_pool.c +index de1d9b8fad90..d767eebf30bd 100644 +--- a/drivers/tee/optee/shm_pool.c ++++ b/drivers/tee/optee/shm_pool.c +@@ -17,6 +17,7 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm, + { + unsigned int order = get_order(size); + struct page *page; ++ int rc = 0; + + page = alloc_pages(GFP_KERNEL | __GFP_ZERO, order); + if (!page) +@@ -26,12 +27,34 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm, + shm->paddr = page_to_phys(page); + shm->size = PAGE_SIZE << order; + +- return 0; ++ if (shm->flags & TEE_SHM_DMA_BUF) { ++ unsigned int nr_pages = 1 << order, i; ++ struct page **pages; ++ ++ pages = kcalloc(nr_pages, sizeof(pages), GFP_KERNEL); ++ if (!pages) ++ return -ENOMEM; ++ ++ for (i = 0; i < nr_pages; i++) { ++ pages[i] = page; ++ page++; ++ } ++ ++ shm->flags |= TEE_SHM_REGISTER; ++ rc = optee_shm_register(shm->ctx, shm, pages, nr_pages, ++ (unsigned long)shm->kaddr); ++ kfree(pages); ++ } ++ ++ return rc; + } + + static void pool_op_free(struct tee_shm_pool_mgr *poolm, + struct tee_shm *shm) + { ++ if (shm->flags & TEE_SHM_DMA_BUF) ++ optee_shm_unregister(shm->ctx, shm); ++ + free_pages((unsigned long)shm->kaddr, get_order(shm->size)); + shm->kaddr = NULL; + } +diff --git a/drivers/watchdog/sprd_wdt.c b/drivers/watchdog/sprd_wdt.c +index 0bb17b046140..65cb55f3916f 100644 +--- a/drivers/watchdog/sprd_wdt.c ++++ b/drivers/watchdog/sprd_wdt.c +@@ -327,10 +327,9 @@ static int sprd_wdt_probe(struct platform_device *pdev) + + static int __maybe_unused sprd_wdt_pm_suspend(struct device *dev) + { +- struct watchdog_device *wdd = dev_get_drvdata(dev); + struct sprd_wdt *wdt = dev_get_drvdata(dev); + +- if (watchdog_active(wdd)) ++ if (watchdog_active(&wdt->wdd)) + sprd_wdt_stop(&wdt->wdd); + sprd_wdt_disable(wdt); + +@@ -339,7 +338,6 @@ static int __maybe_unused sprd_wdt_pm_suspend(struct device *dev) + + static int __maybe_unused sprd_wdt_pm_resume(struct device *dev) + { +- struct watchdog_device *wdd = dev_get_drvdata(dev); + struct sprd_wdt *wdt = dev_get_drvdata(dev); + int ret; + +@@ -347,7 +345,7 @@ static int __maybe_unused sprd_wdt_pm_resume(struct device *dev) + if (ret) + return ret; + +- if (watchdog_active(wdd)) { ++ if (watchdog_active(&wdt->wdd)) { + ret = sprd_wdt_start(&wdt->wdd); + if (ret) { + sprd_wdt_disable(wdt); +diff --git a/fs/afs/dir_edit.c b/fs/afs/dir_edit.c +index d4fbe5f85f1b..b108528bf010 100644 +--- a/fs/afs/dir_edit.c ++++ b/fs/afs/dir_edit.c +@@ -68,13 +68,11 @@ static int afs_find_contig_bits(union afs_xdr_dir_block *block, unsigned int nr_ + static void afs_set_contig_bits(union afs_xdr_dir_block *block, + int bit, unsigned int nr_slots) + { +- u64 mask, before, after; ++ u64 mask; + + mask = (1 << nr_slots) - 1; + mask <<= bit; + +- before = *(u64 *)block->hdr.bitmap; +- + block->hdr.bitmap[0] |= (u8)(mask >> 0 * 8); + block->hdr.bitmap[1] |= (u8)(mask >> 1 * 8); + block->hdr.bitmap[2] |= (u8)(mask >> 2 * 8); +@@ -83,8 +81,6 @@ static void afs_set_contig_bits(union afs_xdr_dir_block *block, + block->hdr.bitmap[5] |= (u8)(mask >> 5 * 8); + block->hdr.bitmap[6] |= (u8)(mask >> 6 * 8); + block->hdr.bitmap[7] |= (u8)(mask >> 7 * 8); +- +- after = *(u64 *)block->hdr.bitmap; + } + + /* +@@ -93,13 +89,11 @@ static void afs_set_contig_bits(union afs_xdr_dir_block *block, + static void afs_clear_contig_bits(union afs_xdr_dir_block *block, + int bit, unsigned int nr_slots) + { +- u64 mask, before, after; ++ u64 mask; + + mask = (1 << nr_slots) - 1; + mask <<= bit; + +- before = *(u64 *)block->hdr.bitmap; +- + block->hdr.bitmap[0] &= ~(u8)(mask >> 0 * 8); + block->hdr.bitmap[1] &= ~(u8)(mask >> 1 * 8); + block->hdr.bitmap[2] &= ~(u8)(mask >> 2 * 8); +@@ -108,8 +102,6 @@ static void afs_clear_contig_bits(union afs_xdr_dir_block *block, + block->hdr.bitmap[5] &= ~(u8)(mask >> 5 * 8); + block->hdr.bitmap[6] &= ~(u8)(mask >> 6 * 8); + block->hdr.bitmap[7] &= ~(u8)(mask >> 7 * 8); +- +- after = *(u64 *)block->hdr.bitmap; + } + + /* +diff --git a/fs/nfsd/Kconfig b/fs/nfsd/Kconfig +index c4b1a89b8845..f2f81561ebb6 100644 +--- a/fs/nfsd/Kconfig ++++ b/fs/nfsd/Kconfig +@@ -73,6 +73,7 @@ config NFSD_V4 + select NFSD_V3 + select FS_POSIX_ACL + select SUNRPC_GSS ++ select CRYPTO_MD5 + select CRYPTO_SHA256 + select GRACE_PERIOD + help +diff --git a/fs/xfs/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c +index cd6c7210a373..c7de17deeae6 100644 +--- a/fs/xfs/xfs_quotaops.c ++++ b/fs/xfs/xfs_quotaops.c +@@ -201,6 +201,9 @@ xfs_fs_rm_xquota( + if (XFS_IS_QUOTA_ON(mp)) + return -EINVAL; + ++ if (uflags & ~(FS_USER_QUOTA | FS_GROUP_QUOTA | FS_PROJ_QUOTA)) ++ return -EINVAL; ++ + if (uflags & FS_USER_QUOTA) + flags |= XFS_DQ_USER; + if (uflags & FS_GROUP_QUOTA) +diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h +index d1a5d5df02f5..08b25c02b5a1 100644 +--- a/include/linux/mmc/sdio_ids.h ++++ b/include/linux/mmc/sdio_ids.h +@@ -71,6 +71,8 @@ + + #define SDIO_VENDOR_ID_TI 0x0097 + #define SDIO_DEVICE_ID_TI_WL1271 0x4076 ++#define SDIO_VENDOR_ID_TI_WL1251 0x104c ++#define SDIO_DEVICE_ID_TI_WL1251 0x9066 + + #define SDIO_VENDOR_ID_STE 0x0020 + #define SDIO_DEVICE_ID_STE_CW1200 0x2280 +diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c +index 3867864cdc2f..3d3d61b5985b 100644 +--- a/kernel/bpf/devmap.c ++++ b/kernel/bpf/devmap.c +@@ -74,7 +74,7 @@ struct bpf_dtab_netdev { + + struct bpf_dtab { + struct bpf_map map; +- struct bpf_dtab_netdev **netdev_map; ++ struct bpf_dtab_netdev **netdev_map; /* DEVMAP type only */ + struct list_head __percpu *flush_list; + struct list_head list; + +@@ -101,6 +101,12 @@ static struct hlist_head *dev_map_create_hash(unsigned int entries) + return hash; + } + ++static inline struct hlist_head *dev_map_index_hash(struct bpf_dtab *dtab, ++ int idx) ++{ ++ return &dtab->dev_index_head[idx & (dtab->n_buckets - 1)]; ++} ++ + static int dev_map_init_map(struct bpf_dtab *dtab, union bpf_attr *attr) + { + int err, cpu; +@@ -120,8 +126,7 @@ static int dev_map_init_map(struct bpf_dtab *dtab, union bpf_attr *attr) + bpf_map_init_from_attr(&dtab->map, attr); + + /* make sure page count doesn't overflow */ +- cost = (u64) dtab->map.max_entries * sizeof(struct bpf_dtab_netdev *); +- cost += sizeof(struct list_head) * num_possible_cpus(); ++ cost = (u64) sizeof(struct list_head) * num_possible_cpus(); + + if (attr->map_type == BPF_MAP_TYPE_DEVMAP_HASH) { + dtab->n_buckets = roundup_pow_of_two(dtab->map.max_entries); +@@ -129,6 +134,8 @@ static int dev_map_init_map(struct bpf_dtab *dtab, union bpf_attr *attr) + if (!dtab->n_buckets) /* Overflow check */ + return -EINVAL; + cost += (u64) sizeof(struct hlist_head) * dtab->n_buckets; ++ } else { ++ cost += (u64) dtab->map.max_entries * sizeof(struct bpf_dtab_netdev *); + } + + /* if map size is larger than memlock limit, reject it */ +@@ -143,24 +150,22 @@ static int dev_map_init_map(struct bpf_dtab *dtab, union bpf_attr *attr) + for_each_possible_cpu(cpu) + INIT_LIST_HEAD(per_cpu_ptr(dtab->flush_list, cpu)); + +- dtab->netdev_map = bpf_map_area_alloc(dtab->map.max_entries * +- sizeof(struct bpf_dtab_netdev *), +- dtab->map.numa_node); +- if (!dtab->netdev_map) +- goto free_percpu; +- + if (attr->map_type == BPF_MAP_TYPE_DEVMAP_HASH) { + dtab->dev_index_head = dev_map_create_hash(dtab->n_buckets); + if (!dtab->dev_index_head) +- goto free_map_area; ++ goto free_percpu; + + spin_lock_init(&dtab->index_lock); ++ } else { ++ dtab->netdev_map = bpf_map_area_alloc(dtab->map.max_entries * ++ sizeof(struct bpf_dtab_netdev *), ++ dtab->map.numa_node); ++ if (!dtab->netdev_map) ++ goto free_percpu; + } + + return 0; + +-free_map_area: +- bpf_map_area_free(dtab->netdev_map); + free_percpu: + free_percpu(dtab->flush_list); + free_charge: +@@ -228,21 +233,40 @@ static void dev_map_free(struct bpf_map *map) + cond_resched(); + } + +- for (i = 0; i < dtab->map.max_entries; i++) { +- struct bpf_dtab_netdev *dev; ++ if (dtab->map.map_type == BPF_MAP_TYPE_DEVMAP_HASH) { ++ for (i = 0; i < dtab->n_buckets; i++) { ++ struct bpf_dtab_netdev *dev; ++ struct hlist_head *head; ++ struct hlist_node *next; + +- dev = dtab->netdev_map[i]; +- if (!dev) +- continue; ++ head = dev_map_index_hash(dtab, i); + +- free_percpu(dev->bulkq); +- dev_put(dev->dev); +- kfree(dev); ++ hlist_for_each_entry_safe(dev, next, head, index_hlist) { ++ hlist_del_rcu(&dev->index_hlist); ++ free_percpu(dev->bulkq); ++ dev_put(dev->dev); ++ kfree(dev); ++ } ++ } ++ ++ kfree(dtab->dev_index_head); ++ } else { ++ for (i = 0; i < dtab->map.max_entries; i++) { ++ struct bpf_dtab_netdev *dev; ++ ++ dev = dtab->netdev_map[i]; ++ if (!dev) ++ continue; ++ ++ free_percpu(dev->bulkq); ++ dev_put(dev->dev); ++ kfree(dev); ++ } ++ ++ bpf_map_area_free(dtab->netdev_map); + } + + free_percpu(dtab->flush_list); +- bpf_map_area_free(dtab->netdev_map); +- kfree(dtab->dev_index_head); + kfree(dtab); + } + +@@ -263,12 +287,6 @@ static int dev_map_get_next_key(struct bpf_map *map, void *key, void *next_key) + return 0; + } + +-static inline struct hlist_head *dev_map_index_hash(struct bpf_dtab *dtab, +- int idx) +-{ +- return &dtab->dev_index_head[idx & (dtab->n_buckets - 1)]; +-} +- + struct bpf_dtab_netdev *__dev_map_hash_lookup_elem(struct bpf_map *map, u32 key) + { + struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map); +diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c +index 8402b29c280f..867fd72cb260 100644 +--- a/kernel/dma/direct.c ++++ b/kernel/dma/direct.c +@@ -375,7 +375,7 @@ dma_addr_t dma_direct_map_resource(struct device *dev, phys_addr_t paddr, + { + dma_addr_t dma_addr = paddr; + +- if (unlikely(!dma_direct_possible(dev, dma_addr, size))) { ++ if (unlikely(!dma_capable(dev, dma_addr, size))) { + report_addr(dev, dma_addr, size); + return DMA_MAPPING_ERROR; + } +diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h +index 2defc7fe74c3..fa08d55f7040 100644 +--- a/kernel/rcu/tree_plugin.h ++++ b/kernel/rcu/tree_plugin.h +@@ -1946,7 +1946,7 @@ static void nocb_gp_wait(struct rcu_data *my_rdp) + int __maybe_unused cpu = my_rdp->cpu; + unsigned long cur_gp_seq; + unsigned long flags; +- bool gotcbs; ++ bool gotcbs = false; + unsigned long j = jiffies; + bool needwait_gp = false; // This prevents actual uninitialized use. + bool needwake; +diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c +index a8a08030a8f7..08bdee0480b3 100644 +--- a/kernel/sched/deadline.c ++++ b/kernel/sched/deadline.c +@@ -1743,13 +1743,16 @@ static void start_hrtick_dl(struct rq *rq, struct task_struct *p) + } + #endif + +-static void set_next_task_dl(struct rq *rq, struct task_struct *p) ++static void set_next_task_dl(struct rq *rq, struct task_struct *p, bool first) + { + p->se.exec_start = rq_clock_task(rq); + + /* You can't push away the running task */ + dequeue_pushable_dl_task(rq, p); + ++ if (!first) ++ return; ++ + if (hrtick_enabled(rq)) + start_hrtick_dl(rq, p); + +@@ -1785,7 +1788,7 @@ pick_next_task_dl(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) + dl_se = pick_next_dl_entity(rq, dl_rq); + BUG_ON(!dl_se); + p = dl_task_of(dl_se); +- set_next_task_dl(rq, p); ++ set_next_task_dl(rq, p, true); + return p; + } + +diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c +index 69a81a5709ff..c87a798d1456 100644 +--- a/kernel/sched/fair.c ++++ b/kernel/sched/fair.c +@@ -3504,9 +3504,6 @@ update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq) + cfs_rq->load_last_update_time_copy = sa->last_update_time; + #endif + +- if (decayed) +- cfs_rq_util_change(cfs_rq, 0); +- + return decayed; + } + +@@ -3616,8 +3613,12 @@ static inline void update_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s + attach_entity_load_avg(cfs_rq, se, SCHED_CPUFREQ_MIGRATION); + update_tg_load_avg(cfs_rq, 0); + +- } else if (decayed && (flags & UPDATE_TG)) +- update_tg_load_avg(cfs_rq, 0); ++ } else if (decayed) { ++ cfs_rq_util_change(cfs_rq, 0); ++ ++ if (flags & UPDATE_TG) ++ update_tg_load_avg(cfs_rq, 0); ++ } + } + + #ifndef CONFIG_64BIT +@@ -7517,6 +7518,28 @@ static inline bool others_have_blocked(struct rq *rq) { return false; } + static inline void update_blocked_load_status(struct rq *rq, bool has_blocked) {} + #endif + ++static bool __update_blocked_others(struct rq *rq, bool *done) ++{ ++ const struct sched_class *curr_class; ++ u64 now = rq_clock_pelt(rq); ++ bool decayed; ++ ++ /* ++ * update_load_avg() can call cpufreq_update_util(). Make sure that RT, ++ * DL and IRQ signals have been updated before updating CFS. ++ */ ++ curr_class = rq->curr->sched_class; ++ ++ decayed = update_rt_rq_load_avg(now, rq, curr_class == &rt_sched_class) | ++ update_dl_rq_load_avg(now, rq, curr_class == &dl_sched_class) | ++ update_irq_load_avg(rq, 0); ++ ++ if (others_have_blocked(rq)) ++ *done = false; ++ ++ return decayed; ++} ++ + #ifdef CONFIG_FAIR_GROUP_SCHED + + static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq) +@@ -7536,29 +7559,11 @@ static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq) + return true; + } + +-static void update_blocked_averages(int cpu) ++static bool __update_blocked_fair(struct rq *rq, bool *done) + { +- struct rq *rq = cpu_rq(cpu); + struct cfs_rq *cfs_rq, *pos; +- const struct sched_class *curr_class; +- struct rq_flags rf; +- bool done = true; +- +- rq_lock_irqsave(rq, &rf); +- update_rq_clock(rq); +- +- /* +- * update_cfs_rq_load_avg() can call cpufreq_update_util(). Make sure +- * that RT, DL and IRQ signals have been updated before updating CFS. +- */ +- curr_class = rq->curr->sched_class; +- update_rt_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &rt_sched_class); +- update_dl_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &dl_sched_class); +- update_irq_load_avg(rq, 0); +- +- /* Don't need periodic decay once load/util_avg are null */ +- if (others_have_blocked(rq)) +- done = false; ++ bool decayed = false; ++ int cpu = cpu_of(rq); + + /* + * Iterates the task_group tree in a bottom up fashion, see +@@ -7567,9 +7572,13 @@ static void update_blocked_averages(int cpu) + for_each_leaf_cfs_rq_safe(rq, cfs_rq, pos) { + struct sched_entity *se; + +- if (update_cfs_rq_load_avg(cfs_rq_clock_pelt(cfs_rq), cfs_rq)) ++ if (update_cfs_rq_load_avg(cfs_rq_clock_pelt(cfs_rq), cfs_rq)) { + update_tg_load_avg(cfs_rq, 0); + ++ if (cfs_rq == &rq->cfs) ++ decayed = true; ++ } ++ + /* Propagate pending load changes to the parent, if any: */ + se = cfs_rq->tg->se[cpu]; + if (se && !skip_blocked_update(se)) +@@ -7584,11 +7593,10 @@ static void update_blocked_averages(int cpu) + + /* Don't need periodic decay once load/util_avg are null */ + if (cfs_rq_has_blocked(cfs_rq)) +- done = false; ++ *done = false; + } + +- update_blocked_load_status(rq, !done); +- rq_unlock_irqrestore(rq, &rf); ++ return decayed; + } + + /* +@@ -7638,29 +7646,16 @@ static unsigned long task_h_load(struct task_struct *p) + cfs_rq_load_avg(cfs_rq) + 1); + } + #else +-static inline void update_blocked_averages(int cpu) ++static bool __update_blocked_fair(struct rq *rq, bool *done) + { +- struct rq *rq = cpu_rq(cpu); + struct cfs_rq *cfs_rq = &rq->cfs; +- const struct sched_class *curr_class; +- struct rq_flags rf; +- +- rq_lock_irqsave(rq, &rf); +- update_rq_clock(rq); +- +- /* +- * update_cfs_rq_load_avg() can call cpufreq_update_util(). Make sure +- * that RT, DL and IRQ signals have been updated before updating CFS. +- */ +- curr_class = rq->curr->sched_class; +- update_rt_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &rt_sched_class); +- update_dl_rq_load_avg(rq_clock_pelt(rq), rq, curr_class == &dl_sched_class); +- update_irq_load_avg(rq, 0); ++ bool decayed; + +- update_cfs_rq_load_avg(cfs_rq_clock_pelt(cfs_rq), cfs_rq); ++ decayed = update_cfs_rq_load_avg(cfs_rq_clock_pelt(cfs_rq), cfs_rq); ++ if (cfs_rq_has_blocked(cfs_rq)) ++ *done = false; + +- update_blocked_load_status(rq, cfs_rq_has_blocked(cfs_rq) || others_have_blocked(rq)); +- rq_unlock_irqrestore(rq, &rf); ++ return decayed; + } + + static unsigned long task_h_load(struct task_struct *p) +@@ -7669,6 +7664,24 @@ static unsigned long task_h_load(struct task_struct *p) + } + #endif + ++static void update_blocked_averages(int cpu) ++{ ++ bool decayed = false, done = true; ++ struct rq *rq = cpu_rq(cpu); ++ struct rq_flags rf; ++ ++ rq_lock_irqsave(rq, &rf); ++ update_rq_clock(rq); ++ ++ decayed |= __update_blocked_others(rq, &done); ++ decayed |= __update_blocked_fair(rq, &done); ++ ++ update_blocked_load_status(rq, !done); ++ if (decayed) ++ cpufreq_update_util(rq, 0); ++ rq_unlock_irqrestore(rq, &rf); ++} ++ + /********** Helpers for find_busiest_group ************************/ + + /* +@@ -10151,7 +10164,7 @@ static void switched_to_fair(struct rq *rq, struct task_struct *p) + * This routine is mostly called to set cfs_rq->curr field when a task + * migrates between groups/classes. + */ +-static void set_next_task_fair(struct rq *rq, struct task_struct *p) ++static void set_next_task_fair(struct rq *rq, struct task_struct *p, bool first) + { + struct sched_entity *se = &p->se; + +diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c +index f65ef1e2f204..131e7c86cf06 100644 +--- a/kernel/sched/idle.c ++++ b/kernel/sched/idle.c +@@ -385,7 +385,7 @@ static void put_prev_task_idle(struct rq *rq, struct task_struct *prev) + { + } + +-static void set_next_task_idle(struct rq *rq, struct task_struct *next) ++static void set_next_task_idle(struct rq *rq, struct task_struct *next, bool first) + { + update_idle_core(rq); + schedstat_inc(rq->sched_goidle); +@@ -399,7 +399,7 @@ pick_next_task_idle(struct rq *rq, struct task_struct *prev, struct rq_flags *rf + if (prev) + put_prev_task(rq, prev); + +- set_next_task_idle(rq, next); ++ set_next_task_idle(rq, next, true); + + return next; + } +diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c +index 9b8adc01be3d..7bf917e4d63a 100644 +--- a/kernel/sched/rt.c ++++ b/kernel/sched/rt.c +@@ -1515,13 +1515,16 @@ static void check_preempt_curr_rt(struct rq *rq, struct task_struct *p, int flag + #endif + } + +-static inline void set_next_task_rt(struct rq *rq, struct task_struct *p) ++static inline void set_next_task_rt(struct rq *rq, struct task_struct *p, bool first) + { + p->se.exec_start = rq_clock_task(rq); + + /* The running task is never eligible for pushing */ + dequeue_pushable_task(rq, p); + ++ if (!first) ++ return; ++ + /* + * If prev task was rt, put_prev_task() has already updated the + * utilization. We only care of the case where we start to schedule a +@@ -1575,7 +1578,7 @@ pick_next_task_rt(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) + return NULL; + + p = _pick_next_task_rt(rq); +- set_next_task_rt(rq, p); ++ set_next_task_rt(rq, p, true); + return p; + } + +diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h +index 49ed949f850c..e5e2605778c9 100644 +--- a/kernel/sched/sched.h ++++ b/kernel/sched/sched.h +@@ -1728,7 +1728,7 @@ struct sched_class { + struct task_struct *prev, + struct rq_flags *rf); + void (*put_prev_task)(struct rq *rq, struct task_struct *p); +- void (*set_next_task)(struct rq *rq, struct task_struct *p); ++ void (*set_next_task)(struct rq *rq, struct task_struct *p, bool first); + + #ifdef CONFIG_SMP + int (*balance)(struct rq *rq, struct task_struct *prev, struct rq_flags *rf); +@@ -1780,7 +1780,7 @@ static inline void put_prev_task(struct rq *rq, struct task_struct *prev) + static inline void set_next_task(struct rq *rq, struct task_struct *next) + { + WARN_ON_ONCE(rq->curr != next); +- next->sched_class->set_next_task(rq, next); ++ next->sched_class->set_next_task(rq, next, false); + } + + #ifdef CONFIG_SMP +diff --git a/kernel/sched/stop_task.c b/kernel/sched/stop_task.c +index c0640739e05e..02dc0a8e3925 100644 +--- a/kernel/sched/stop_task.c ++++ b/kernel/sched/stop_task.c +@@ -29,7 +29,7 @@ check_preempt_curr_stop(struct rq *rq, struct task_struct *p, int flags) + /* we're never preempted */ + } + +-static void set_next_task_stop(struct rq *rq, struct task_struct *stop) ++static void set_next_task_stop(struct rq *rq, struct task_struct *stop, bool first) + { + stop->se.exec_start = rq_clock_task(rq); + } +@@ -42,7 +42,7 @@ pick_next_task_stop(struct rq *rq, struct task_struct *prev, struct rq_flags *rf + if (!sched_stop_runnable(rq)) + return NULL; + +- set_next_task_stop(rq, rq->stop); ++ set_next_task_stop(rq, rq->stop, true); + return rq->stop; + } + +diff --git a/kernel/workqueue.c b/kernel/workqueue.c +index 649687622654..e9c63b79e03f 100644 +--- a/kernel/workqueue.c ++++ b/kernel/workqueue.c +@@ -425,7 +425,8 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq); + * ignored. + */ + #define for_each_pwq(pwq, wq) \ +- list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node) \ ++ list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node, \ ++ lockdep_is_held(&wq->mutex)) \ + if (({ assert_rcu_or_wq_mutex(wq); false; })) { } \ + else + +diff --git a/net/core/neighbour.c b/net/core/neighbour.c +index f2452496ad9f..920784a9b7ff 100644 +--- a/net/core/neighbour.c ++++ b/net/core/neighbour.c +@@ -2049,8 +2049,8 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl, + goto nla_put_failure; + { + unsigned long now = jiffies; +- unsigned int flush_delta = now - tbl->last_flush; +- unsigned int rand_delta = now - tbl->last_rand; ++ long flush_delta = now - tbl->last_flush; ++ long rand_delta = now - tbl->last_rand; + struct neigh_hash_table *nht; + struct ndt_config ndc = { + .ndtc_key_len = tbl->key_len, +diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c +index b4db68e5caa9..4c826b8bf9b1 100644 +--- a/net/core/net-sysfs.c ++++ b/net/core/net-sysfs.c +@@ -1462,14 +1462,17 @@ static int netdev_queue_add_kobject(struct net_device *dev, int index) + struct kobject *kobj = &queue->kobj; + int error = 0; + ++ /* Kobject_put later will trigger netdev_queue_release call ++ * which decreases dev refcount: Take that reference here ++ */ ++ dev_hold(queue->dev); ++ + kobj->kset = dev->queues_kset; + error = kobject_init_and_add(kobj, &netdev_queue_ktype, NULL, + "tx-%u", index); + if (error) + goto err; + +- dev_hold(queue->dev); +- + #ifdef CONFIG_BQL + error = sysfs_create_group(kobj, &dql_group); + if (error) +diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c +index 23f67b8fdeaa..3eed90bfa2bf 100644 +--- a/net/openvswitch/datapath.c ++++ b/net/openvswitch/datapath.c +@@ -1667,6 +1667,7 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) + ovs_dp_reset_user_features(skb, info); + } + ++ ovs_unlock(); + goto err_destroy_meters; + } + +@@ -1683,7 +1684,6 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info) + return 0; + + err_destroy_meters: +- ovs_unlock(); + ovs_meters_exit(dp); + err_destroy_ports_array: + kfree(dp->ports); +diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c +index 529d4ce945db..118cd66b7516 100644 +--- a/net/packet/af_packet.c ++++ b/net/packet/af_packet.c +@@ -1296,15 +1296,21 @@ static void packet_sock_destruct(struct sock *sk) + + static bool fanout_flow_is_huge(struct packet_sock *po, struct sk_buff *skb) + { +- u32 rxhash; ++ u32 *history = po->rollover->history; ++ u32 victim, rxhash; + int i, count = 0; + + rxhash = skb_get_hash(skb); + for (i = 0; i < ROLLOVER_HLEN; i++) +- if (po->rollover->history[i] == rxhash) ++ if (READ_ONCE(history[i]) == rxhash) + count++; + +- po->rollover->history[prandom_u32() % ROLLOVER_HLEN] = rxhash; ++ victim = prandom_u32() % ROLLOVER_HLEN; ++ ++ /* Avoid dirtying the cache line if possible */ ++ if (READ_ONCE(history[victim]) != rxhash) ++ WRITE_ONCE(history[victim], rxhash); ++ + return count > (ROLLOVER_HLEN >> 1); + } + +diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c +index 8be2f209982b..908b60a72d95 100644 +--- a/net/sunrpc/auth_gss/svcauth_gss.c ++++ b/net/sunrpc/auth_gss/svcauth_gss.c +@@ -1075,24 +1075,32 @@ gss_read_verf(struct rpc_gss_wire_cred *gc, + return 0; + } + +-/* Ok this is really heavily depending on a set of semantics in +- * how rqstp is set up by svc_recv and pages laid down by the +- * server when reading a request. We are basically guaranteed that +- * the token lays all down linearly across a set of pages, starting +- * at iov_base in rq_arg.head[0] which happens to be the first of a +- * set of pages stored in rq_pages[]. +- * rq_arg.head[0].iov_base will provide us the page_base to pass +- * to the upcall. +- */ +-static inline int +-gss_read_proxy_verf(struct svc_rqst *rqstp, +- struct rpc_gss_wire_cred *gc, __be32 *authp, +- struct xdr_netobj *in_handle, +- struct gssp_in_token *in_token) ++static void gss_free_in_token_pages(struct gssp_in_token *in_token) + { +- struct kvec *argv = &rqstp->rq_arg.head[0]; + u32 inlen; +- int res; ++ int i; ++ ++ i = 0; ++ inlen = in_token->page_len; ++ while (inlen) { ++ if (in_token->pages[i]) ++ put_page(in_token->pages[i]); ++ inlen -= inlen > PAGE_SIZE ? PAGE_SIZE : inlen; ++ } ++ ++ kfree(in_token->pages); ++ in_token->pages = NULL; ++} ++ ++static int gss_read_proxy_verf(struct svc_rqst *rqstp, ++ struct rpc_gss_wire_cred *gc, __be32 *authp, ++ struct xdr_netobj *in_handle, ++ struct gssp_in_token *in_token) ++{ ++ struct kvec *argv = &rqstp->rq_arg.head[0]; ++ unsigned int page_base, length; ++ int pages, i, res; ++ size_t inlen; + + res = gss_read_common_verf(gc, argv, authp, in_handle); + if (res) +@@ -1102,10 +1110,36 @@ gss_read_proxy_verf(struct svc_rqst *rqstp, + if (inlen > (argv->iov_len + rqstp->rq_arg.page_len)) + return SVC_DENIED; + +- in_token->pages = rqstp->rq_pages; +- in_token->page_base = (ulong)argv->iov_base & ~PAGE_MASK; ++ pages = DIV_ROUND_UP(inlen, PAGE_SIZE); ++ in_token->pages = kcalloc(pages, sizeof(struct page *), GFP_KERNEL); ++ if (!in_token->pages) ++ return SVC_DENIED; ++ in_token->page_base = 0; + in_token->page_len = inlen; ++ for (i = 0; i < pages; i++) { ++ in_token->pages[i] = alloc_page(GFP_KERNEL); ++ if (!in_token->pages[i]) { ++ gss_free_in_token_pages(in_token); ++ return SVC_DENIED; ++ } ++ } + ++ length = min_t(unsigned int, inlen, argv->iov_len); ++ memcpy(page_address(in_token->pages[0]), argv->iov_base, length); ++ inlen -= length; ++ ++ i = 1; ++ page_base = rqstp->rq_arg.page_base; ++ while (inlen) { ++ length = min_t(unsigned int, inlen, PAGE_SIZE); ++ memcpy(page_address(in_token->pages[i]), ++ page_address(rqstp->rq_arg.pages[i]) + page_base, ++ length); ++ ++ inlen -= length; ++ page_base = 0; ++ i++; ++ } + return 0; + } + +@@ -1280,8 +1314,11 @@ static int svcauth_gss_proxy_init(struct svc_rqst *rqstp, + break; + case GSS_S_COMPLETE: + status = gss_proxy_save_rsc(sn->rsc_cache, &ud, &handle); +- if (status) ++ if (status) { ++ pr_info("%s: gss_proxy_save_rsc failed (%d)\n", ++ __func__, status); + goto out; ++ } + cli_handle.data = (u8 *)&handle; + cli_handle.len = sizeof(handle); + break; +@@ -1292,15 +1329,20 @@ static int svcauth_gss_proxy_init(struct svc_rqst *rqstp, + + /* Got an answer to the upcall; use it: */ + if (gss_write_init_verf(sn->rsc_cache, rqstp, +- &cli_handle, &ud.major_status)) ++ &cli_handle, &ud.major_status)) { ++ pr_info("%s: gss_write_init_verf failed\n", __func__); + goto out; ++ } + if (gss_write_resv(resv, PAGE_SIZE, + &cli_handle, &ud.out_token, +- ud.major_status, ud.minor_status)) ++ ud.major_status, ud.minor_status)) { ++ pr_info("%s: gss_write_resv failed\n", __func__); + goto out; ++ } + + ret = SVC_COMPLETE; + out: ++ gss_free_in_token_pages(&ud.in_token); + gssp_free_upcall_data(&ud); + return ret; + } +diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c +index 14ba9e72a204..f3104be8ff5d 100644 +--- a/net/sunrpc/xdr.c ++++ b/net/sunrpc/xdr.c +@@ -436,13 +436,12 @@ xdr_shrink_bufhead(struct xdr_buf *buf, size_t len) + } + + /** +- * xdr_shrink_pagelen ++ * xdr_shrink_pagelen - shrinks buf->pages by up to @len bytes + * @buf: xdr_buf + * @len: bytes to remove from buf->pages + * +- * Shrinks XDR buffer's page array buf->pages by +- * 'len' bytes. The extra data is not lost, but is instead +- * moved into the tail. ++ * The extra data is not lost, but is instead moved into buf->tail. ++ * Returns the actual number of bytes moved. + */ + static unsigned int + xdr_shrink_pagelen(struct xdr_buf *buf, size_t len) +@@ -455,8 +454,8 @@ xdr_shrink_pagelen(struct xdr_buf *buf, size_t len) + + result = 0; + tail = buf->tail; +- BUG_ON (len > pglen); +- ++ if (len > buf->page_len) ++ len = buf-> page_len; + tailbuf_len = buf->buflen - buf->head->iov_len - buf->page_len; + + /* Shift the tail first */ +diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c +index d1fcc41d5eb5..908e78bb87c6 100644 +--- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c ++++ b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c +@@ -195,6 +195,7 @@ rpcrdma_bc_send_request(struct svcxprt_rdma *rdma, struct rpc_rqst *rqst) + pr_info("%s: %*ph\n", __func__, 64, rqst->rq_buffer); + #endif + ++ rqst->rq_xtime = ktime_get(); + rc = svc_rdma_bc_sendto(rdma, rqst, ctxt); + if (rc) { + svc_rdma_send_ctxt_put(rdma, ctxt); +diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c +index 70e52f567b2a..5361b98f31ae 100644 +--- a/net/sunrpc/xprtsock.c ++++ b/net/sunrpc/xprtsock.c +@@ -2659,6 +2659,8 @@ static int bc_sendto(struct rpc_rqst *req) + .iov_len = sizeof(marker), + }; + ++ req->rq_xtime = ktime_get(); ++ + len = kernel_sendmsg(transport->sock, &msg, &iov, 1, iov.iov_len); + if (len != iov.iov_len) + return -EAGAIN; +@@ -2684,7 +2686,6 @@ static int bc_send_request(struct rpc_rqst *req) + struct svc_xprt *xprt; + int len; + +- dprintk("sending request with xid: %08x\n", ntohl(req->rq_xid)); + /* + * Get the server socket associated with this callback xprt + */ +diff --git a/net/tipc/link.c b/net/tipc/link.c +index 999eab592de8..a9d8a81e80cf 100644 +--- a/net/tipc/link.c ++++ b/net/tipc/link.c +@@ -1084,7 +1084,7 @@ static bool link_retransmit_failure(struct tipc_link *l, struct tipc_link *r, + return false; + + if (!time_after(jiffies, TIPC_SKB_CB(skb)->retr_stamp + +- msecs_to_jiffies(r->tolerance))) ++ msecs_to_jiffies(r->tolerance * 10))) + return false; + + hdr = buf_msg(skb); +diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c +index 6a6eae88442f..58708b4c7719 100644 +--- a/net/tipc/monitor.c ++++ b/net/tipc/monitor.c +@@ -665,6 +665,21 @@ void tipc_mon_delete(struct net *net, int bearer_id) + kfree(mon); + } + ++void tipc_mon_reinit_self(struct net *net) ++{ ++ struct tipc_monitor *mon; ++ int bearer_id; ++ ++ for (bearer_id = 0; bearer_id < MAX_BEARERS; bearer_id++) { ++ mon = tipc_monitor(net, bearer_id); ++ if (!mon) ++ continue; ++ write_lock_bh(&mon->lock); ++ mon->self->addr = tipc_own_addr(net); ++ write_unlock_bh(&mon->lock); ++ } ++} ++ + int tipc_nl_monitor_set_threshold(struct net *net, u32 cluster_size) + { + struct tipc_net *tn = tipc_net(net); +diff --git a/net/tipc/monitor.h b/net/tipc/monitor.h +index 2a21b93e0d04..ed63d2e650b0 100644 +--- a/net/tipc/monitor.h ++++ b/net/tipc/monitor.h +@@ -77,6 +77,7 @@ int __tipc_nl_add_monitor(struct net *net, struct tipc_nl_msg *msg, + u32 bearer_id); + int tipc_nl_add_monitor_peer(struct net *net, struct tipc_nl_msg *msg, + u32 bearer_id, u32 *prev_node); ++void tipc_mon_reinit_self(struct net *net); + + extern const int tipc_max_domain_size; + #endif +diff --git a/net/tipc/net.c b/net/tipc/net.c +index 85707c185360..2de3cec9929d 100644 +--- a/net/tipc/net.c ++++ b/net/tipc/net.c +@@ -42,6 +42,7 @@ + #include "node.h" + #include "bcast.h" + #include "netlink.h" ++#include "monitor.h" + + /* + * The TIPC locking policy is designed to ensure a very fine locking +@@ -136,6 +137,7 @@ static void tipc_net_finalize(struct net *net, u32 addr) + tipc_set_node_addr(net, addr); + tipc_named_reinit(net); + tipc_sk_reinit(net); ++ tipc_mon_reinit_self(net); + tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr, + TIPC_CLUSTER_SCOPE, 0, addr); + } +diff --git a/net/tipc/socket.c b/net/tipc/socket.c +index 79d06c21ebe3..aea951a1f805 100644 +--- a/net/tipc/socket.c ++++ b/net/tipc/socket.c +@@ -504,7 +504,7 @@ static void __tipc_shutdown(struct socket *sock, int error) + struct sock *sk = sock->sk; + struct tipc_sock *tsk = tipc_sk(sk); + struct net *net = sock_net(sk); +- long timeout = CONN_TIMEOUT_DEFAULT; ++ long timeout = msecs_to_jiffies(CONN_TIMEOUT_DEFAULT); + u32 dnode = tsk_peer_node(tsk); + struct sk_buff *skb; + +@@ -1396,8 +1396,10 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen) + rc = tipc_msg_build(hdr, m, 0, dlen, mtu, &pkts); + if (unlikely(rc != dlen)) + return rc; +- if (unlikely(syn && !tipc_msg_skb_clone(&pkts, &sk->sk_write_queue))) ++ if (unlikely(syn && !tipc_msg_skb_clone(&pkts, &sk->sk_write_queue))) { ++ __skb_queue_purge(&pkts); + return -ENOMEM; ++ } + + trace_tipc_sk_sendmsg(sk, skb_peek(&pkts), TIPC_DUMP_SK_SNDQ, " "); + rc = tipc_node_xmit(net, &pkts, dnode, tsk->portid); +@@ -2685,6 +2687,7 @@ static void tipc_sk_timeout(struct timer_list *t) + if (sock_owned_by_user(sk)) { + sk_reset_timer(sk, &sk->sk_timer, jiffies + HZ / 20); + bh_unlock_sock(sk); ++ sock_put(sk); + return; + } + +diff --git a/samples/bpf/sockex1_kern.c b/samples/bpf/sockex1_kern.c +index ed18e9a4909c..43e38ce594d4 100644 +--- a/samples/bpf/sockex1_kern.c ++++ b/samples/bpf/sockex1_kern.c +@@ -4,12 +4,12 @@ + #include + #include "bpf_helpers.h" + +-struct bpf_map_def SEC("maps") my_map = { +- .type = BPF_MAP_TYPE_ARRAY, +- .key_size = sizeof(u32), +- .value_size = sizeof(long), +- .max_entries = 256, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_ARRAY); ++ __type(key, u32); ++ __type(value, long); ++ __uint(max_entries, 256); ++} my_map SEC(".maps"); + + SEC("socket1") + int bpf_prog1(struct __sk_buff *skb) +diff --git a/samples/bpf/sockex2_kern.c b/samples/bpf/sockex2_kern.c +index f2f9dbc021b0..ae4bdc89b599 100644 +--- a/samples/bpf/sockex2_kern.c ++++ b/samples/bpf/sockex2_kern.c +@@ -189,12 +189,12 @@ struct pair { + long bytes; + }; + +-struct bpf_map_def SEC("maps") hash_map = { +- .type = BPF_MAP_TYPE_HASH, +- .key_size = sizeof(__be32), +- .value_size = sizeof(struct pair), +- .max_entries = 1024, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_HASH); ++ __type(key, __be32); ++ __type(value, struct pair); ++ __uint(max_entries, 1024); ++} hash_map SEC(".maps"); + + SEC("socket2") + int bpf_prog2(struct __sk_buff *skb) +diff --git a/samples/bpf/xdp1_kern.c b/samples/bpf/xdp1_kern.c +index 219742106bfd..db6870aee42c 100644 +--- a/samples/bpf/xdp1_kern.c ++++ b/samples/bpf/xdp1_kern.c +@@ -14,12 +14,12 @@ + #include + #include "bpf_helpers.h" + +-struct bpf_map_def SEC("maps") rxcnt = { +- .type = BPF_MAP_TYPE_PERCPU_ARRAY, +- .key_size = sizeof(u32), +- .value_size = sizeof(long), +- .max_entries = 256, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); ++ __type(key, u32); ++ __type(value, long); ++ __uint(max_entries, 256); ++} rxcnt SEC(".maps"); + + static int parse_ipv4(void *data, u64 nh_off, void *data_end) + { +diff --git a/samples/bpf/xdp2_kern.c b/samples/bpf/xdp2_kern.c +index e01288867d15..c74b52c6d945 100644 +--- a/samples/bpf/xdp2_kern.c ++++ b/samples/bpf/xdp2_kern.c +@@ -14,12 +14,12 @@ + #include + #include "bpf_helpers.h" + +-struct bpf_map_def SEC("maps") rxcnt = { +- .type = BPF_MAP_TYPE_PERCPU_ARRAY, +- .key_size = sizeof(u32), +- .value_size = sizeof(long), +- .max_entries = 256, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); ++ __type(key, u32); ++ __type(value, long); ++ __uint(max_entries, 256); ++} rxcnt SEC(".maps"); + + static void swap_src_dst_mac(void *data) + { +diff --git a/samples/bpf/xdp_adjust_tail_kern.c b/samples/bpf/xdp_adjust_tail_kern.c +index 411fdb21f8bc..cd9ff2a40a39 100644 +--- a/samples/bpf/xdp_adjust_tail_kern.c ++++ b/samples/bpf/xdp_adjust_tail_kern.c +@@ -25,12 +25,12 @@ + #define ICMP_TOOBIG_SIZE 98 + #define ICMP_TOOBIG_PAYLOAD_SIZE 92 + +-struct bpf_map_def SEC("maps") icmpcnt = { +- .type = BPF_MAP_TYPE_ARRAY, +- .key_size = sizeof(__u32), +- .value_size = sizeof(__u64), +- .max_entries = 1, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_ARRAY); ++ __type(key, __u32); ++ __type(value, __u64); ++ __uint(max_entries, 1); ++} icmpcnt SEC(".maps"); + + static __always_inline void count_icmp(void) + { +diff --git a/samples/bpf/xdp_fwd_kern.c b/samples/bpf/xdp_fwd_kern.c +index 701a30f258b1..d013029aeaa2 100644 +--- a/samples/bpf/xdp_fwd_kern.c ++++ b/samples/bpf/xdp_fwd_kern.c +@@ -23,13 +23,12 @@ + + #define IPV6_FLOWINFO_MASK cpu_to_be32(0x0FFFFFFF) + +-/* For TX-traffic redirect requires net_device ifindex to be in this devmap */ +-struct bpf_map_def SEC("maps") xdp_tx_ports = { +- .type = BPF_MAP_TYPE_DEVMAP, +- .key_size = sizeof(int), +- .value_size = sizeof(int), +- .max_entries = 64, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_DEVMAP); ++ __uint(key_size, sizeof(int)); ++ __uint(value_size, sizeof(int)); ++ __uint(max_entries, 64); ++} xdp_tx_ports SEC(".maps"); + + /* from include/net/ip.h */ + static __always_inline int ip_decrease_ttl(struct iphdr *iph) +diff --git a/samples/bpf/xdp_redirect_cpu_kern.c b/samples/bpf/xdp_redirect_cpu_kern.c +index a306d1c75622..cfcc31e51197 100644 +--- a/samples/bpf/xdp_redirect_cpu_kern.c ++++ b/samples/bpf/xdp_redirect_cpu_kern.c +@@ -18,12 +18,12 @@ + #define MAX_CPUS 64 /* WARNING - sync with _user.c */ + + /* Special map type that can XDP_REDIRECT frames to another CPU */ +-struct bpf_map_def SEC("maps") cpu_map = { +- .type = BPF_MAP_TYPE_CPUMAP, +- .key_size = sizeof(u32), +- .value_size = sizeof(u32), +- .max_entries = MAX_CPUS, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_CPUMAP); ++ __uint(key_size, sizeof(u32)); ++ __uint(value_size, sizeof(u32)); ++ __uint(max_entries, MAX_CPUS); ++} cpu_map SEC(".maps"); + + /* Common stats data record to keep userspace more simple */ + struct datarec { +@@ -35,67 +35,67 @@ struct datarec { + /* Count RX packets, as XDP bpf_prog doesn't get direct TX-success + * feedback. Redirect TX errors can be caught via a tracepoint. + */ +-struct bpf_map_def SEC("maps") rx_cnt = { +- .type = BPF_MAP_TYPE_PERCPU_ARRAY, +- .key_size = sizeof(u32), +- .value_size = sizeof(struct datarec), +- .max_entries = 1, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); ++ __type(key, u32); ++ __type(value, struct datarec); ++ __uint(max_entries, 1); ++} rx_cnt SEC(".maps"); + + /* Used by trace point */ +-struct bpf_map_def SEC("maps") redirect_err_cnt = { +- .type = BPF_MAP_TYPE_PERCPU_ARRAY, +- .key_size = sizeof(u32), +- .value_size = sizeof(struct datarec), +- .max_entries = 2, ++struct { ++ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); ++ __type(key, u32); ++ __type(value, struct datarec); ++ __uint(max_entries, 2); + /* TODO: have entries for all possible errno's */ +-}; ++} redirect_err_cnt SEC(".maps"); + + /* Used by trace point */ +-struct bpf_map_def SEC("maps") cpumap_enqueue_cnt = { +- .type = BPF_MAP_TYPE_PERCPU_ARRAY, +- .key_size = sizeof(u32), +- .value_size = sizeof(struct datarec), +- .max_entries = MAX_CPUS, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); ++ __type(key, u32); ++ __type(value, struct datarec); ++ __uint(max_entries, MAX_CPUS); ++} cpumap_enqueue_cnt SEC(".maps"); + + /* Used by trace point */ +-struct bpf_map_def SEC("maps") cpumap_kthread_cnt = { +- .type = BPF_MAP_TYPE_PERCPU_ARRAY, +- .key_size = sizeof(u32), +- .value_size = sizeof(struct datarec), +- .max_entries = 1, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); ++ __type(key, u32); ++ __type(value, struct datarec); ++ __uint(max_entries, 1); ++} cpumap_kthread_cnt SEC(".maps"); + + /* Set of maps controlling available CPU, and for iterating through + * selectable redirect CPUs. + */ +-struct bpf_map_def SEC("maps") cpus_available = { +- .type = BPF_MAP_TYPE_ARRAY, +- .key_size = sizeof(u32), +- .value_size = sizeof(u32), +- .max_entries = MAX_CPUS, +-}; +-struct bpf_map_def SEC("maps") cpus_count = { +- .type = BPF_MAP_TYPE_ARRAY, +- .key_size = sizeof(u32), +- .value_size = sizeof(u32), +- .max_entries = 1, +-}; +-struct bpf_map_def SEC("maps") cpus_iterator = { +- .type = BPF_MAP_TYPE_PERCPU_ARRAY, +- .key_size = sizeof(u32), +- .value_size = sizeof(u32), +- .max_entries = 1, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_ARRAY); ++ __type(key, u32); ++ __type(value, u32); ++ __uint(max_entries, MAX_CPUS); ++} cpus_available SEC(".maps"); ++struct { ++ __uint(type, BPF_MAP_TYPE_ARRAY); ++ __type(key, u32); ++ __type(value, u32); ++ __uint(max_entries, 1); ++} cpus_count SEC(".maps"); ++struct { ++ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); ++ __type(key, u32); ++ __type(value, u32); ++ __uint(max_entries, 1); ++} cpus_iterator SEC(".maps"); + + /* Used by trace point */ +-struct bpf_map_def SEC("maps") exception_cnt = { +- .type = BPF_MAP_TYPE_PERCPU_ARRAY, +- .key_size = sizeof(u32), +- .value_size = sizeof(struct datarec), +- .max_entries = 1, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); ++ __type(key, u32); ++ __type(value, struct datarec); ++ __uint(max_entries, 1); ++} exception_cnt SEC(".maps"); + + /* Helper parse functions */ + +diff --git a/samples/bpf/xdp_redirect_kern.c b/samples/bpf/xdp_redirect_kern.c +index 8abb151e385f..1f0b7d05abb2 100644 +--- a/samples/bpf/xdp_redirect_kern.c ++++ b/samples/bpf/xdp_redirect_kern.c +@@ -19,22 +19,22 @@ + #include + #include "bpf_helpers.h" + +-struct bpf_map_def SEC("maps") tx_port = { +- .type = BPF_MAP_TYPE_ARRAY, +- .key_size = sizeof(int), +- .value_size = sizeof(int), +- .max_entries = 1, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_ARRAY); ++ __type(key, int); ++ __type(value, int); ++ __uint(max_entries, 1); ++} tx_port SEC(".maps"); + + /* Count RX packets, as XDP bpf_prog doesn't get direct TX-success + * feedback. Redirect TX errors can be caught via a tracepoint. + */ +-struct bpf_map_def SEC("maps") rxcnt = { +- .type = BPF_MAP_TYPE_PERCPU_ARRAY, +- .key_size = sizeof(u32), +- .value_size = sizeof(long), +- .max_entries = 1, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); ++ __type(key, u32); ++ __type(value, long); ++ __uint(max_entries, 1); ++} rxcnt SEC(".maps"); + + static void swap_src_dst_mac(void *data) + { +diff --git a/samples/bpf/xdp_redirect_map_kern.c b/samples/bpf/xdp_redirect_map_kern.c +index 740a529ba84f..4631b484c432 100644 +--- a/samples/bpf/xdp_redirect_map_kern.c ++++ b/samples/bpf/xdp_redirect_map_kern.c +@@ -19,22 +19,22 @@ + #include + #include "bpf_helpers.h" + +-struct bpf_map_def SEC("maps") tx_port = { +- .type = BPF_MAP_TYPE_DEVMAP, +- .key_size = sizeof(int), +- .value_size = sizeof(int), +- .max_entries = 100, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_DEVMAP); ++ __uint(key_size, sizeof(int)); ++ __uint(value_size, sizeof(int)); ++ __uint(max_entries, 100); ++} tx_port SEC(".maps"); + + /* Count RX packets, as XDP bpf_prog doesn't get direct TX-success + * feedback. Redirect TX errors can be caught via a tracepoint. + */ +-struct bpf_map_def SEC("maps") rxcnt = { +- .type = BPF_MAP_TYPE_PERCPU_ARRAY, +- .key_size = sizeof(u32), +- .value_size = sizeof(long), +- .max_entries = 1, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); ++ __type(key, u32); ++ __type(value, long); ++ __uint(max_entries, 1); ++} rxcnt SEC(".maps"); + + static void swap_src_dst_mac(void *data) + { +diff --git a/samples/bpf/xdp_router_ipv4_kern.c b/samples/bpf/xdp_router_ipv4_kern.c +index 993f56bc7b9a..bf11efc8e949 100644 +--- a/samples/bpf/xdp_router_ipv4_kern.c ++++ b/samples/bpf/xdp_router_ipv4_kern.c +@@ -42,44 +42,44 @@ struct direct_map { + }; + + /* Map for trie implementation*/ +-struct bpf_map_def SEC("maps") lpm_map = { +- .type = BPF_MAP_TYPE_LPM_TRIE, +- .key_size = 8, +- .value_size = sizeof(struct trie_value), +- .max_entries = 50, +- .map_flags = BPF_F_NO_PREALLOC, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_LPM_TRIE); ++ __uint(key_size, 8); ++ __uint(value_size, sizeof(struct trie_value)); ++ __uint(max_entries, 50); ++ __uint(map_flags, BPF_F_NO_PREALLOC); ++} lpm_map SEC(".maps"); + + /* Map for counter*/ +-struct bpf_map_def SEC("maps") rxcnt = { +- .type = BPF_MAP_TYPE_PERCPU_ARRAY, +- .key_size = sizeof(u32), +- .value_size = sizeof(u64), +- .max_entries = 256, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); ++ __type(key, u32); ++ __type(value, u64); ++ __uint(max_entries, 256); ++} rxcnt SEC(".maps"); + + /* Map for ARP table*/ +-struct bpf_map_def SEC("maps") arp_table = { +- .type = BPF_MAP_TYPE_HASH, +- .key_size = sizeof(__be32), +- .value_size = sizeof(__be64), +- .max_entries = 50, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_HASH); ++ __type(key, __be32); ++ __type(value, __be64); ++ __uint(max_entries, 50); ++} arp_table SEC(".maps"); + + /* Map to keep the exact match entries in the route table*/ +-struct bpf_map_def SEC("maps") exact_match = { +- .type = BPF_MAP_TYPE_HASH, +- .key_size = sizeof(__be32), +- .value_size = sizeof(struct direct_map), +- .max_entries = 50, +-}; +- +-struct bpf_map_def SEC("maps") tx_port = { +- .type = BPF_MAP_TYPE_DEVMAP, +- .key_size = sizeof(int), +- .value_size = sizeof(int), +- .max_entries = 100, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_HASH); ++ __type(key, __be32); ++ __type(value, struct direct_map); ++ __uint(max_entries, 50); ++} exact_match SEC(".maps"); ++ ++struct { ++ __uint(type, BPF_MAP_TYPE_DEVMAP); ++ __uint(key_size, sizeof(int)); ++ __uint(value_size, sizeof(int)); ++ __uint(max_entries, 100); ++} tx_port SEC(".maps"); + + /* Function to set source and destination mac of the packet */ + static inline void set_src_dst_mac(void *data, void *src, void *dst) +diff --git a/samples/bpf/xdp_rxq_info_kern.c b/samples/bpf/xdp_rxq_info_kern.c +index 222a83eed1cb..272d0f82a6b5 100644 +--- a/samples/bpf/xdp_rxq_info_kern.c ++++ b/samples/bpf/xdp_rxq_info_kern.c +@@ -23,12 +23,13 @@ enum cfg_options_flags { + READ_MEM = 0x1U, + SWAP_MAC = 0x2U, + }; +-struct bpf_map_def SEC("maps") config_map = { +- .type = BPF_MAP_TYPE_ARRAY, +- .key_size = sizeof(int), +- .value_size = sizeof(struct config), +- .max_entries = 1, +-}; ++ ++struct { ++ __uint(type, BPF_MAP_TYPE_ARRAY); ++ __type(key, int); ++ __type(value, struct config); ++ __uint(max_entries, 1); ++} config_map SEC(".maps"); + + /* Common stats data record (shared with userspace) */ + struct datarec { +@@ -36,22 +37,22 @@ struct datarec { + __u64 issue; + }; + +-struct bpf_map_def SEC("maps") stats_global_map = { +- .type = BPF_MAP_TYPE_PERCPU_ARRAY, +- .key_size = sizeof(u32), +- .value_size = sizeof(struct datarec), +- .max_entries = 1, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); ++ __type(key, u32); ++ __type(value, struct datarec); ++ __uint(max_entries, 1); ++} stats_global_map SEC(".maps"); + + #define MAX_RXQs 64 + + /* Stats per rx_queue_index (per CPU) */ +-struct bpf_map_def SEC("maps") rx_queue_index_map = { +- .type = BPF_MAP_TYPE_PERCPU_ARRAY, +- .key_size = sizeof(u32), +- .value_size = sizeof(struct datarec), +- .max_entries = MAX_RXQs + 1, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); ++ __type(key, u32); ++ __type(value, struct datarec); ++ __uint(max_entries, MAX_RXQs + 1); ++} rx_queue_index_map SEC(".maps"); + + static __always_inline + void swap_src_dst_mac(void *data) +diff --git a/samples/bpf/xdp_rxq_info_user.c b/samples/bpf/xdp_rxq_info_user.c +index c7e4e45d824a..b88df17853b8 100644 +--- a/samples/bpf/xdp_rxq_info_user.c ++++ b/samples/bpf/xdp_rxq_info_user.c +@@ -489,9 +489,9 @@ int main(int argc, char **argv) + if (bpf_prog_load_xattr(&prog_load_attr, &obj, &prog_fd)) + return EXIT_FAIL; + +- map = bpf_map__next(NULL, obj); +- stats_global_map = bpf_map__next(map, obj); +- rx_queue_index_map = bpf_map__next(stats_global_map, obj); ++ map = bpf_object__find_map_by_name(obj, "config_map"); ++ stats_global_map = bpf_object__find_map_by_name(obj, "stats_global_map"); ++ rx_queue_index_map = bpf_object__find_map_by_name(obj, "rx_queue_index_map"); + if (!map || !stats_global_map || !rx_queue_index_map) { + printf("finding a map in obj file failed\n"); + return EXIT_FAIL; +diff --git a/samples/bpf/xdp_tx_iptunnel_kern.c b/samples/bpf/xdp_tx_iptunnel_kern.c +index 0f4f6e8c8611..6db450a5c1ca 100644 +--- a/samples/bpf/xdp_tx_iptunnel_kern.c ++++ b/samples/bpf/xdp_tx_iptunnel_kern.c +@@ -19,19 +19,19 @@ + #include "bpf_helpers.h" + #include "xdp_tx_iptunnel_common.h" + +-struct bpf_map_def SEC("maps") rxcnt = { +- .type = BPF_MAP_TYPE_PERCPU_ARRAY, +- .key_size = sizeof(__u32), +- .value_size = sizeof(__u64), +- .max_entries = 256, +-}; +- +-struct bpf_map_def SEC("maps") vip2tnl = { +- .type = BPF_MAP_TYPE_HASH, +- .key_size = sizeof(struct vip), +- .value_size = sizeof(struct iptnl_info), +- .max_entries = MAX_IPTNL_ENTRIES, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); ++ __type(key, __u32); ++ __type(value, __u64); ++ __uint(max_entries, 256); ++} rxcnt SEC(".maps"); ++ ++struct { ++ __uint(type, BPF_MAP_TYPE_HASH); ++ __type(key, struct vip); ++ __type(value, struct iptnl_info); ++ __uint(max_entries, MAX_IPTNL_ENTRIES); ++} vip2tnl SEC(".maps"); + + static __always_inline void count_tx(u32 protocol) + { +diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh +index 2998ddb323e3..436379940356 100755 +--- a/scripts/link-vmlinux.sh ++++ b/scripts/link-vmlinux.sh +@@ -127,8 +127,9 @@ gen_btf() + cut -d, -f1 | cut -d' ' -f2) + bin_format=$(LANG=C ${OBJDUMP} -f ${1} | grep 'file format' | \ + awk '{print $4}') +- ${OBJCOPY} --set-section-flags .BTF=alloc -O binary \ +- --only-section=.BTF ${1} .btf.vmlinux.bin 2>/dev/null ++ ${OBJCOPY} --change-section-address .BTF=0 \ ++ --set-section-flags .BTF=alloc -O binary \ ++ --only-section=.BTF ${1} .btf.vmlinux.bin + ${OBJCOPY} -I binary -O ${bin_format} -B ${bin_arch} \ + --rename-section .data=.BTF .btf.vmlinux.bin ${2} + } +diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c +index cbb933532981..9d0485959308 100644 +--- a/tools/lib/bpf/bpf.c ++++ b/tools/lib/bpf/bpf.c +@@ -189,7 +189,7 @@ static void * + alloc_zero_tailing_info(const void *orecord, __u32 cnt, + __u32 actual_rec_size, __u32 expected_rec_size) + { +- __u64 info_len = actual_rec_size * cnt; ++ __u64 info_len = (__u64)actual_rec_size * cnt; + void *info, *nrecord; + int i; + +diff --git a/tools/lib/bpf/bpf_prog_linfo.c b/tools/lib/bpf/bpf_prog_linfo.c +index 8c67561c93b0..3ed1a27b5f7c 100644 +--- a/tools/lib/bpf/bpf_prog_linfo.c ++++ b/tools/lib/bpf/bpf_prog_linfo.c +@@ -101,6 +101,7 @@ struct bpf_prog_linfo *bpf_prog_linfo__new(const struct bpf_prog_info *info) + { + struct bpf_prog_linfo *prog_linfo; + __u32 nr_linfo, nr_jited_func; ++ __u64 data_sz; + + nr_linfo = info->nr_line_info; + +@@ -122,11 +123,11 @@ struct bpf_prog_linfo *bpf_prog_linfo__new(const struct bpf_prog_info *info) + /* Copy xlated line_info */ + prog_linfo->nr_linfo = nr_linfo; + prog_linfo->rec_size = info->line_info_rec_size; +- prog_linfo->raw_linfo = malloc(nr_linfo * prog_linfo->rec_size); ++ data_sz = (__u64)nr_linfo * prog_linfo->rec_size; ++ prog_linfo->raw_linfo = malloc(data_sz); + if (!prog_linfo->raw_linfo) + goto err_free; +- memcpy(prog_linfo->raw_linfo, (void *)(long)info->line_info, +- nr_linfo * prog_linfo->rec_size); ++ memcpy(prog_linfo->raw_linfo, (void *)(long)info->line_info, data_sz); + + nr_jited_func = info->nr_jited_ksyms; + if (!nr_jited_func || +@@ -142,13 +143,12 @@ struct bpf_prog_linfo *bpf_prog_linfo__new(const struct bpf_prog_info *info) + /* Copy jited_line_info */ + prog_linfo->nr_jited_func = nr_jited_func; + prog_linfo->jited_rec_size = info->jited_line_info_rec_size; +- prog_linfo->raw_jited_linfo = malloc(nr_linfo * +- prog_linfo->jited_rec_size); ++ data_sz = (__u64)nr_linfo * prog_linfo->jited_rec_size; ++ prog_linfo->raw_jited_linfo = malloc(data_sz); + if (!prog_linfo->raw_jited_linfo) + goto err_free; + memcpy(prog_linfo->raw_jited_linfo, +- (void *)(long)info->jited_line_info, +- nr_linfo * prog_linfo->jited_rec_size); ++ (void *)(long)info->jited_line_info, data_sz); + + /* Number of jited_line_info per jited func */ + prog_linfo->nr_jited_linfo_per_func = malloc(nr_jited_func * +diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c +index 1aa189a9112a..d606a358480d 100644 +--- a/tools/lib/bpf/btf.c ++++ b/tools/lib/bpf/btf.c +@@ -269,10 +269,9 @@ __s64 btf__resolve_size(const struct btf *btf, __u32 type_id) + t = btf__type_by_id(btf, type_id); + } + ++done: + if (size < 0) + return -EINVAL; +- +-done: + if (nelems && size > UINT32_MAX / nelems) + return -E2BIG; + +diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c +index a267cd0c0ce2..d98838c5820c 100644 +--- a/tools/lib/bpf/libbpf.c ++++ b/tools/lib/bpf/libbpf.c +@@ -3220,6 +3220,7 @@ bpf_program__reloc_text(struct bpf_program *prog, struct bpf_object *obj, + pr_warning("oom in prog realloc\n"); + return -ENOMEM; + } ++ prog->insns = new_insn; + + if (obj->btf_ext) { + err = bpf_program_reloc_btf_ext(prog, obj, +@@ -3231,7 +3232,6 @@ bpf_program__reloc_text(struct bpf_program *prog, struct bpf_object *obj, + + memcpy(new_insn + prog->insns_cnt, text->insns, + text->insns_cnt * sizeof(*insn)); +- prog->insns = new_insn; + prog->main_prog_cnt = prog->insns_cnt; + prog->insns_cnt = new_cnt; + pr_debug("added %zd insn from %s to prog %s\n", +diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c +index 70f9e10de286..0c7386b0e42e 100644 +--- a/tools/lib/bpf/xsk.c ++++ b/tools/lib/bpf/xsk.c +@@ -73,6 +73,21 @@ struct xsk_nl_info { + int fd; + }; + ++/* Up until and including Linux 5.3 */ ++struct xdp_ring_offset_v1 { ++ __u64 producer; ++ __u64 consumer; ++ __u64 desc; ++}; ++ ++/* Up until and including Linux 5.3 */ ++struct xdp_mmap_offsets_v1 { ++ struct xdp_ring_offset_v1 rx; ++ struct xdp_ring_offset_v1 tx; ++ struct xdp_ring_offset_v1 fr; ++ struct xdp_ring_offset_v1 cr; ++}; ++ + int xsk_umem__fd(const struct xsk_umem *umem) + { + return umem ? umem->fd : -EINVAL; +@@ -133,6 +148,58 @@ static int xsk_set_xdp_socket_config(struct xsk_socket_config *cfg, + return 0; + } + ++static void xsk_mmap_offsets_v1(struct xdp_mmap_offsets *off) ++{ ++ struct xdp_mmap_offsets_v1 off_v1; ++ ++ /* getsockopt on a kernel <= 5.3 has no flags fields. ++ * Copy over the offsets to the correct places in the >=5.4 format ++ * and put the flags where they would have been on that kernel. ++ */ ++ memcpy(&off_v1, off, sizeof(off_v1)); ++ ++ off->rx.producer = off_v1.rx.producer; ++ off->rx.consumer = off_v1.rx.consumer; ++ off->rx.desc = off_v1.rx.desc; ++ off->rx.flags = off_v1.rx.consumer + sizeof(__u32); ++ ++ off->tx.producer = off_v1.tx.producer; ++ off->tx.consumer = off_v1.tx.consumer; ++ off->tx.desc = off_v1.tx.desc; ++ off->tx.flags = off_v1.tx.consumer + sizeof(__u32); ++ ++ off->fr.producer = off_v1.fr.producer; ++ off->fr.consumer = off_v1.fr.consumer; ++ off->fr.desc = off_v1.fr.desc; ++ off->fr.flags = off_v1.fr.consumer + sizeof(__u32); ++ ++ off->cr.producer = off_v1.cr.producer; ++ off->cr.consumer = off_v1.cr.consumer; ++ off->cr.desc = off_v1.cr.desc; ++ off->cr.flags = off_v1.cr.consumer + sizeof(__u32); ++} ++ ++static int xsk_get_mmap_offsets(int fd, struct xdp_mmap_offsets *off) ++{ ++ socklen_t optlen; ++ int err; ++ ++ optlen = sizeof(*off); ++ err = getsockopt(fd, SOL_XDP, XDP_MMAP_OFFSETS, off, &optlen); ++ if (err) ++ return err; ++ ++ if (optlen == sizeof(*off)) ++ return 0; ++ ++ if (optlen == sizeof(struct xdp_mmap_offsets_v1)) { ++ xsk_mmap_offsets_v1(off); ++ return 0; ++ } ++ ++ return -EINVAL; ++} ++ + int xsk_umem__create_v0_0_4(struct xsk_umem **umem_ptr, void *umem_area, + __u64 size, struct xsk_ring_prod *fill, + struct xsk_ring_cons *comp, +@@ -141,7 +208,6 @@ int xsk_umem__create_v0_0_4(struct xsk_umem **umem_ptr, void *umem_area, + struct xdp_mmap_offsets off; + struct xdp_umem_reg mr; + struct xsk_umem *umem; +- socklen_t optlen; + void *map; + int err; + +@@ -190,8 +256,7 @@ int xsk_umem__create_v0_0_4(struct xsk_umem **umem_ptr, void *umem_area, + goto out_socket; + } + +- optlen = sizeof(off); +- err = getsockopt(umem->fd, SOL_XDP, XDP_MMAP_OFFSETS, &off, &optlen); ++ err = xsk_get_mmap_offsets(umem->fd, &off); + if (err) { + err = -errno; + goto out_socket; +@@ -499,7 +564,6 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname, + struct sockaddr_xdp sxdp = {}; + struct xdp_mmap_offsets off; + struct xsk_socket *xsk; +- socklen_t optlen; + int err; + + if (!umem || !xsk_ptr || !rx || !tx) +@@ -558,8 +622,7 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname, + } + } + +- optlen = sizeof(off); +- err = getsockopt(xsk->fd, SOL_XDP, XDP_MMAP_OFFSETS, &off, &optlen); ++ err = xsk_get_mmap_offsets(xsk->fd, &off); + if (err) { + err = -errno; + goto out_socket; +@@ -645,7 +708,6 @@ out_xsk_alloc: + int xsk_umem__delete(struct xsk_umem *umem) + { + struct xdp_mmap_offsets off; +- socklen_t optlen; + int err; + + if (!umem) +@@ -654,8 +716,7 @@ int xsk_umem__delete(struct xsk_umem *umem) + if (umem->refcount) + return -EBUSY; + +- optlen = sizeof(off); +- err = getsockopt(umem->fd, SOL_XDP, XDP_MMAP_OFFSETS, &off, &optlen); ++ err = xsk_get_mmap_offsets(umem->fd, &off); + if (!err) { + munmap(umem->fill->ring - off.fr.desc, + off.fr.desc + umem->config.fill_size * sizeof(__u64)); +@@ -673,7 +734,6 @@ void xsk_socket__delete(struct xsk_socket *xsk) + { + size_t desc_sz = sizeof(struct xdp_desc); + struct xdp_mmap_offsets off; +- socklen_t optlen; + int err; + + if (!xsk) +@@ -684,8 +744,7 @@ void xsk_socket__delete(struct xsk_socket *xsk) + close(xsk->prog_fd); + } + +- optlen = sizeof(off); +- err = getsockopt(xsk->fd, SOL_XDP, XDP_MMAP_OFFSETS, &off, &optlen); ++ err = xsk_get_mmap_offsets(xsk->fd, &off); + if (!err) { + if (xsk->rx) { + munmap(xsk->rx->ring - off.rx.desc, +diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c +index 888814df758d..ea277ce63a46 100644 +--- a/tools/perf/util/machine.c ++++ b/tools/perf/util/machine.c +@@ -767,24 +767,6 @@ int machine__process_ksymbol(struct machine *machine __maybe_unused, + return machine__process_ksymbol_register(machine, event, sample); + } + +-static void dso__adjust_kmod_long_name(struct dso *dso, const char *filename) +-{ +- const char *dup_filename; +- +- if (!filename || !dso || !dso->long_name) +- return; +- if (dso->long_name[0] != '[') +- return; +- if (!strchr(filename, '/')) +- return; +- +- dup_filename = strdup(filename); +- if (!dup_filename) +- return; +- +- dso__set_long_name(dso, dup_filename, true); +-} +- + struct map *machine__findnew_module_map(struct machine *machine, u64 start, + const char *filename) + { +@@ -796,15 +778,8 @@ struct map *machine__findnew_module_map(struct machine *machine, u64 start, + return NULL; + + map = map_groups__find_by_name(&machine->kmaps, m.name); +- if (map) { +- /* +- * If the map's dso is an offline module, give dso__load() +- * a chance to find the file path of that module by fixing +- * long_name. +- */ +- dso__adjust_kmod_long_name(map->dso, filename); ++ if (map) + goto out; +- } + + dso = machine__findnew_module_dso(machine, &m, filename); + if (dso == NULL) +diff --git a/tools/testing/selftests/cgroup/test_freezer.c b/tools/testing/selftests/cgroup/test_freezer.c +index 0fc1b6d4b0f9..62a27ab3c2f3 100644 +--- a/tools/testing/selftests/cgroup/test_freezer.c ++++ b/tools/testing/selftests/cgroup/test_freezer.c +@@ -72,6 +72,7 @@ static int cg_prepare_for_wait(const char *cgroup) + if (ret == -1) { + debug("Error: inotify_add_watch() failed\n"); + close(fd); ++ fd = -1; + } + + return fd; +diff --git a/tools/testing/selftests/gen_kselftest_tar.sh b/tools/testing/selftests/gen_kselftest_tar.sh +index a27e2eec3586..8b2b6088540d 100755 +--- a/tools/testing/selftests/gen_kselftest_tar.sh ++++ b/tools/testing/selftests/gen_kselftest_tar.sh +@@ -38,16 +38,21 @@ main() + esac + fi + +- install_dir=./kselftest ++ # Create working directory. ++ dest=`pwd` ++ install_work="$dest"/kselftest_install ++ install_name=kselftest ++ install_dir="$install_work"/"$install_name" ++ mkdir -p "$install_dir" + +-# Run install using INSTALL_KSFT_PATH override to generate install +-# directory +-./kselftest_install.sh +-tar $copts kselftest${ext} $install_dir +-echo "Kselftest archive kselftest${ext} created!" ++ # Run install using INSTALL_KSFT_PATH override to generate install ++ # directory ++ ./kselftest_install.sh "$install_dir" ++ (cd "$install_work"; tar $copts "$dest"/kselftest${ext} $install_name) ++ echo "Kselftest archive kselftest${ext} created!" + +-# clean up install directory +-rm -rf kselftest ++ # clean up top-level install work directory ++ rm -rf "$install_work" + } + + main "$@" +diff --git a/tools/testing/selftests/kselftest_install.sh b/tools/testing/selftests/kselftest_install.sh +index e2e1911d62d5..407af7da7037 100755 +--- a/tools/testing/selftests/kselftest_install.sh ++++ b/tools/testing/selftests/kselftest_install.sh +@@ -6,30 +6,30 @@ + # Author: Shuah Khan + # Copyright (C) 2015 Samsung Electronics Co., Ltd. + +-install_loc=`pwd` +- + main() + { +- if [ $(basename $install_loc) != "selftests" ]; then ++ base_dir=`pwd` ++ install_dir="$base_dir"/kselftest_install ++ ++ # Make sure we're in the selftests top-level directory. ++ if [ $(basename "$base_dir") != "selftests" ]; then + echo "$0: Please run it in selftests directory ..." + exit 1; + fi ++ ++ # Only allow installation into an existing location. + if [ "$#" -eq 0 ]; then +- echo "$0: Installing in default location - $install_loc ..." ++ echo "$0: Installing in default location - $install_dir ..." + elif [ ! -d "$1" ]; then + echo "$0: $1 doesn't exist!!" + exit 1; + else +- install_loc=$1 +- echo "$0: Installing in specified location - $install_loc ..." ++ install_dir="$1" ++ echo "$0: Installing in specified location - $install_dir ..." + fi + +- install_dir=$install_loc/kselftest_install +- +-# Create install directory +- mkdir -p $install_dir +-# Build tests +- KSFT_INSTALL_PATH=$install_dir make install ++ # Build tests ++ KSFT_INSTALL_PATH="$install_dir" make install + } + + main "$@" diff --git a/patch/kernel/odroidxu4-current/03-patch-5.4.15-16.patch b/patch/kernel/odroidxu4-current/03-patch-5.4.15-16.patch new file mode 100644 index 000000000..2c9e8a851 --- /dev/null +++ b/patch/kernel/odroidxu4-current/03-patch-5.4.15-16.patch @@ -0,0 +1,5662 @@ +diff --git a/Makefile b/Makefile +index 30600e309c73..e16d2e58ed4b 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 15 ++SUBLEVEL = 16 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h +index 15b75005bc34..3fa1b962dc27 100644 +--- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h ++++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h +@@ -600,8 +600,11 @@ extern void slb_set_size(u16 size); + * + */ + #define MAX_USER_CONTEXT ((ASM_CONST(1) << CONTEXT_BITS) - 2) ++ ++// The + 2 accounts for INVALID_REGION and 1 more to avoid overlap with kernel + #define MIN_USER_CONTEXT (MAX_KERNEL_CTX_CNT + MAX_VMALLOC_CTX_CNT + \ +- MAX_IO_CTX_CNT + MAX_VMEMMAP_CTX_CNT) ++ MAX_IO_CTX_CNT + MAX_VMEMMAP_CTX_CNT + 2) ++ + /* + * For platforms that support on 65bit VA we limit the context bits + */ +diff --git a/arch/powerpc/include/asm/xive-regs.h b/arch/powerpc/include/asm/xive-regs.h +index f2dfcd50a2d3..33aee7490cbb 100644 +--- a/arch/powerpc/include/asm/xive-regs.h ++++ b/arch/powerpc/include/asm/xive-regs.h +@@ -39,6 +39,7 @@ + + #define XIVE_ESB_VAL_P 0x2 + #define XIVE_ESB_VAL_Q 0x1 ++#define XIVE_ESB_INVALID 0xFF + + /* + * Thread Management (aka "TM") registers +diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c +index f5fadbd2533a..9651ca061828 100644 +--- a/arch/powerpc/sysdev/xive/common.c ++++ b/arch/powerpc/sysdev/xive/common.c +@@ -972,12 +972,21 @@ static int xive_get_irqchip_state(struct irq_data *data, + enum irqchip_irq_state which, bool *state) + { + struct xive_irq_data *xd = irq_data_get_irq_handler_data(data); ++ u8 pq; + + switch (which) { + case IRQCHIP_STATE_ACTIVE: +- *state = !xd->stale_p && +- (xd->saved_p || +- !!(xive_esb_read(xd, XIVE_ESB_GET) & XIVE_ESB_VAL_P)); ++ pq = xive_esb_read(xd, XIVE_ESB_GET); ++ ++ /* ++ * The esb value being all 1's means we couldn't get ++ * the PQ state of the interrupt through mmio. It may ++ * happen, for example when querying a PHB interrupt ++ * while the PHB is in an error state. We consider the ++ * interrupt to be inactive in that case. ++ */ ++ *state = (pq != XIVE_ESB_INVALID) && !xd->stale_p && ++ (xd->saved_p || !!(pq & XIVE_ESB_VAL_P)); + return 0; + default: + return -EINVAL; +diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c +index 2bbab0230aeb..d287837ed755 100644 +--- a/drivers/atm/firestream.c ++++ b/drivers/atm/firestream.c +@@ -912,6 +912,7 @@ static int fs_open(struct atm_vcc *atm_vcc) + } + if (!to) { + printk ("No more free channels for FS50..\n"); ++ kfree(vcc); + return -EBUSY; + } + vcc->channo = dev->channo; +@@ -922,6 +923,7 @@ static int fs_open(struct atm_vcc *atm_vcc) + if (((DO_DIRECTION(rxtp) && dev->atm_vccs[vcc->channo])) || + ( DO_DIRECTION(txtp) && test_bit (vcc->channo, dev->tx_inuse))) { + printk ("Channel is in use for FS155.\n"); ++ kfree(vcc); + return -EBUSY; + } + } +@@ -935,6 +937,7 @@ static int fs_open(struct atm_vcc *atm_vcc) + tc, sizeof (struct fs_transmit_config)); + if (!tc) { + fs_dprintk (FS_DEBUG_OPEN, "fs: can't alloc transmit_config.\n"); ++ kfree(vcc); + return -ENOMEM; + } + +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_busy.c b/drivers/gpu/drm/i915/gem/i915_gem_busy.c +index 3d4f5775a4ba..25235ef630c1 100644 +--- a/drivers/gpu/drm/i915/gem/i915_gem_busy.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_busy.c +@@ -9,16 +9,16 @@ + #include "i915_gem_ioctls.h" + #include "i915_gem_object.h" + +-static __always_inline u32 __busy_read_flag(u8 id) ++static __always_inline u32 __busy_read_flag(u16 id) + { +- if (id == (u8)I915_ENGINE_CLASS_INVALID) ++ if (id == (u16)I915_ENGINE_CLASS_INVALID) + return 0xffff0000u; + + GEM_BUG_ON(id >= 16); + return 0x10000u << id; + } + +-static __always_inline u32 __busy_write_id(u8 id) ++static __always_inline u32 __busy_write_id(u16 id) + { + /* + * The uABI guarantees an active writer is also amongst the read +@@ -29,14 +29,14 @@ static __always_inline u32 __busy_write_id(u8 id) + * last_read - hence we always set both read and write busy for + * last_write. + */ +- if (id == (u8)I915_ENGINE_CLASS_INVALID) ++ if (id == (u16)I915_ENGINE_CLASS_INVALID) + return 0xffffffffu; + + return (id + 1) | __busy_read_flag(id); + } + + static __always_inline unsigned int +-__busy_set_if_active(const struct dma_fence *fence, u32 (*flag)(u8 id)) ++__busy_set_if_active(const struct dma_fence *fence, u32 (*flag)(u16 id)) + { + const struct i915_request *rq; + +@@ -57,7 +57,7 @@ __busy_set_if_active(const struct dma_fence *fence, u32 (*flag)(u8 id)) + return 0; + + /* Beware type-expansion follies! */ +- BUILD_BUG_ON(!typecheck(u8, rq->engine->uabi_class)); ++ BUILD_BUG_ON(!typecheck(u16, rq->engine->uabi_class)); + return flag(rq->engine->uabi_class); + } + +diff --git a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c +index abfbac49b8e8..968d9b2705d0 100644 +--- a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c +@@ -427,7 +427,7 @@ struct get_pages_work { + + static struct sg_table * + __i915_gem_userptr_alloc_pages(struct drm_i915_gem_object *obj, +- struct page **pvec, int num_pages) ++ struct page **pvec, unsigned long num_pages) + { + unsigned int max_segment = i915_sg_segment_size(); + struct sg_table *st; +@@ -473,9 +473,10 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work) + { + struct get_pages_work *work = container_of(_work, typeof(*work), work); + struct drm_i915_gem_object *obj = work->obj; +- const int npages = obj->base.size >> PAGE_SHIFT; ++ const unsigned long npages = obj->base.size >> PAGE_SHIFT; ++ unsigned long pinned; + struct page **pvec; +- int pinned, ret; ++ int ret; + + ret = -ENOMEM; + pinned = 0; +@@ -578,7 +579,7 @@ __i915_gem_userptr_get_pages_schedule(struct drm_i915_gem_object *obj) + + static int i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj) + { +- const int num_pages = obj->base.size >> PAGE_SHIFT; ++ const unsigned long num_pages = obj->base.size >> PAGE_SHIFT; + struct mm_struct *mm = obj->userptr.mm->mm; + struct page **pvec; + struct sg_table *pages; +diff --git a/drivers/gpu/drm/i915/gt/intel_engine_types.h b/drivers/gpu/drm/i915/gt/intel_engine_types.h +index 9dd8c299cb2d..798e1b024406 100644 +--- a/drivers/gpu/drm/i915/gt/intel_engine_types.h ++++ b/drivers/gpu/drm/i915/gt/intel_engine_types.h +@@ -300,8 +300,8 @@ struct intel_engine_cs { + u8 class; + u8 instance; + +- u8 uabi_class; +- u8 uabi_instance; ++ u16 uabi_class; ++ u16 uabi_instance; + + u32 context_size; + u32 mmio_base; +diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c +index b1a7a8b9b46a..f614646ed3f9 100644 +--- a/drivers/gpu/drm/i915/i915_gem_gtt.c ++++ b/drivers/gpu/drm/i915/i915_gem_gtt.c +@@ -1178,6 +1178,7 @@ gen8_ppgtt_insert_pte(struct i915_ppgtt *ppgtt, + pd = i915_pd_entry(pdp, gen8_pd_index(idx, 2)); + vaddr = kmap_atomic_px(i915_pt_entry(pd, gen8_pd_index(idx, 1))); + do { ++ GEM_BUG_ON(iter->sg->length < I915_GTT_PAGE_SIZE); + vaddr[gen8_pd_index(idx, 0)] = pte_encode | iter->dma; + + iter->dma += I915_GTT_PAGE_SIZE; +@@ -1657,6 +1658,7 @@ static void gen6_ppgtt_insert_entries(struct i915_address_space *vm, + + vaddr = kmap_atomic_px(i915_pt_entry(pd, act_pt)); + do { ++ GEM_BUG_ON(iter.sg->length < I915_GTT_PAGE_SIZE); + vaddr[act_pte] = pte_encode | GEN6_PTE_ADDR_ENCODE(iter.dma); + + iter.dma += I915_GTT_PAGE_SIZE; +diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c +index 1c67ac434e10..5906c80c4b2c 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_drv.c ++++ b/drivers/gpu/drm/panfrost/panfrost_drv.c +@@ -78,8 +78,10 @@ static int panfrost_ioctl_get_param(struct drm_device *ddev, void *data, struct + static int panfrost_ioctl_create_bo(struct drm_device *dev, void *data, + struct drm_file *file) + { ++ struct panfrost_file_priv *priv = file->driver_priv; + struct panfrost_gem_object *bo; + struct drm_panfrost_create_bo *args = data; ++ struct panfrost_gem_mapping *mapping; + + if (!args->size || args->pad || + (args->flags & ~(PANFROST_BO_NOEXEC | PANFROST_BO_HEAP))) +@@ -95,7 +97,14 @@ static int panfrost_ioctl_create_bo(struct drm_device *dev, void *data, + if (IS_ERR(bo)) + return PTR_ERR(bo); + +- args->offset = bo->node.start << PAGE_SHIFT; ++ mapping = panfrost_gem_mapping_get(bo, priv); ++ if (!mapping) { ++ drm_gem_object_put_unlocked(&bo->base.base); ++ return -EINVAL; ++ } ++ ++ args->offset = mapping->mmnode.start << PAGE_SHIFT; ++ panfrost_gem_mapping_put(mapping); + + return 0; + } +@@ -119,6 +128,11 @@ panfrost_lookup_bos(struct drm_device *dev, + struct drm_panfrost_submit *args, + struct panfrost_job *job) + { ++ struct panfrost_file_priv *priv = file_priv->driver_priv; ++ struct panfrost_gem_object *bo; ++ unsigned int i; ++ int ret; ++ + job->bo_count = args->bo_handle_count; + + if (!job->bo_count) +@@ -130,9 +144,32 @@ panfrost_lookup_bos(struct drm_device *dev, + if (!job->implicit_fences) + return -ENOMEM; + +- return drm_gem_objects_lookup(file_priv, +- (void __user *)(uintptr_t)args->bo_handles, +- job->bo_count, &job->bos); ++ ret = drm_gem_objects_lookup(file_priv, ++ (void __user *)(uintptr_t)args->bo_handles, ++ job->bo_count, &job->bos); ++ if (ret) ++ return ret; ++ ++ job->mappings = kvmalloc_array(job->bo_count, ++ sizeof(struct panfrost_gem_mapping *), ++ GFP_KERNEL | __GFP_ZERO); ++ if (!job->mappings) ++ return -ENOMEM; ++ ++ for (i = 0; i < job->bo_count; i++) { ++ struct panfrost_gem_mapping *mapping; ++ ++ bo = to_panfrost_bo(job->bos[i]); ++ mapping = panfrost_gem_mapping_get(bo, priv); ++ if (!mapping) { ++ ret = -EINVAL; ++ break; ++ } ++ ++ job->mappings[i] = mapping; ++ } ++ ++ return ret; + } + + /** +@@ -320,7 +357,9 @@ out: + static int panfrost_ioctl_get_bo_offset(struct drm_device *dev, void *data, + struct drm_file *file_priv) + { ++ struct panfrost_file_priv *priv = file_priv->driver_priv; + struct drm_panfrost_get_bo_offset *args = data; ++ struct panfrost_gem_mapping *mapping; + struct drm_gem_object *gem_obj; + struct panfrost_gem_object *bo; + +@@ -331,18 +370,26 @@ static int panfrost_ioctl_get_bo_offset(struct drm_device *dev, void *data, + } + bo = to_panfrost_bo(gem_obj); + +- args->offset = bo->node.start << PAGE_SHIFT; +- ++ mapping = panfrost_gem_mapping_get(bo, priv); + drm_gem_object_put_unlocked(gem_obj); ++ ++ if (!mapping) ++ return -EINVAL; ++ ++ args->offset = mapping->mmnode.start << PAGE_SHIFT; ++ panfrost_gem_mapping_put(mapping); + return 0; + } + + static int panfrost_ioctl_madvise(struct drm_device *dev, void *data, + struct drm_file *file_priv) + { ++ struct panfrost_file_priv *priv = file_priv->driver_priv; + struct drm_panfrost_madvise *args = data; + struct panfrost_device *pfdev = dev->dev_private; + struct drm_gem_object *gem_obj; ++ struct panfrost_gem_object *bo; ++ int ret = 0; + + gem_obj = drm_gem_object_lookup(file_priv, args->handle); + if (!gem_obj) { +@@ -350,22 +397,48 @@ static int panfrost_ioctl_madvise(struct drm_device *dev, void *data, + return -ENOENT; + } + ++ bo = to_panfrost_bo(gem_obj); ++ + mutex_lock(&pfdev->shrinker_lock); ++ mutex_lock(&bo->mappings.lock); ++ if (args->madv == PANFROST_MADV_DONTNEED) { ++ struct panfrost_gem_mapping *first; ++ ++ first = list_first_entry(&bo->mappings.list, ++ struct panfrost_gem_mapping, ++ node); ++ ++ /* ++ * If we want to mark the BO purgeable, there must be only one ++ * user: the caller FD. ++ * We could do something smarter and mark the BO purgeable only ++ * when all its users have marked it purgeable, but globally ++ * visible/shared BOs are likely to never be marked purgeable ++ * anyway, so let's not bother. ++ */ ++ if (!list_is_singular(&bo->mappings.list) || ++ WARN_ON_ONCE(first->mmu != &priv->mmu)) { ++ ret = -EINVAL; ++ goto out_unlock_mappings; ++ } ++ } ++ + args->retained = drm_gem_shmem_madvise(gem_obj, args->madv); + + if (args->retained) { +- struct panfrost_gem_object *bo = to_panfrost_bo(gem_obj); +- + if (args->madv == PANFROST_MADV_DONTNEED) + list_add_tail(&bo->base.madv_list, + &pfdev->shrinker_list); + else if (args->madv == PANFROST_MADV_WILLNEED) + list_del_init(&bo->base.madv_list); + } ++ ++out_unlock_mappings: ++ mutex_unlock(&bo->mappings.lock); + mutex_unlock(&pfdev->shrinker_lock); + + drm_gem_object_put_unlocked(gem_obj); +- return 0; ++ return ret; + } + + int panfrost_unstable_ioctl_check(void) +diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c +index 92a95210a899..77c3a3855c68 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_gem.c ++++ b/drivers/gpu/drm/panfrost/panfrost_gem.c +@@ -29,6 +29,12 @@ static void panfrost_gem_free_object(struct drm_gem_object *obj) + list_del_init(&bo->base.madv_list); + mutex_unlock(&pfdev->shrinker_lock); + ++ /* ++ * If we still have mappings attached to the BO, there's a problem in ++ * our refcounting. ++ */ ++ WARN_ON_ONCE(!list_empty(&bo->mappings.list)); ++ + if (bo->sgts) { + int i; + int n_sgt = bo->base.base.size / SZ_2M; +@@ -46,6 +52,69 @@ static void panfrost_gem_free_object(struct drm_gem_object *obj) + drm_gem_shmem_free_object(obj); + } + ++struct panfrost_gem_mapping * ++panfrost_gem_mapping_get(struct panfrost_gem_object *bo, ++ struct panfrost_file_priv *priv) ++{ ++ struct panfrost_gem_mapping *iter, *mapping = NULL; ++ ++ mutex_lock(&bo->mappings.lock); ++ list_for_each_entry(iter, &bo->mappings.list, node) { ++ if (iter->mmu == &priv->mmu) { ++ kref_get(&iter->refcount); ++ mapping = iter; ++ break; ++ } ++ } ++ mutex_unlock(&bo->mappings.lock); ++ ++ return mapping; ++} ++ ++static void ++panfrost_gem_teardown_mapping(struct panfrost_gem_mapping *mapping) ++{ ++ struct panfrost_file_priv *priv; ++ ++ if (mapping->active) ++ panfrost_mmu_unmap(mapping); ++ ++ priv = container_of(mapping->mmu, struct panfrost_file_priv, mmu); ++ spin_lock(&priv->mm_lock); ++ if (drm_mm_node_allocated(&mapping->mmnode)) ++ drm_mm_remove_node(&mapping->mmnode); ++ spin_unlock(&priv->mm_lock); ++} ++ ++static void panfrost_gem_mapping_release(struct kref *kref) ++{ ++ struct panfrost_gem_mapping *mapping; ++ ++ mapping = container_of(kref, struct panfrost_gem_mapping, refcount); ++ ++ panfrost_gem_teardown_mapping(mapping); ++ drm_gem_object_put_unlocked(&mapping->obj->base.base); ++ kfree(mapping); ++} ++ ++void panfrost_gem_mapping_put(struct panfrost_gem_mapping *mapping) ++{ ++ if (!mapping) ++ return; ++ ++ kref_put(&mapping->refcount, panfrost_gem_mapping_release); ++} ++ ++void panfrost_gem_teardown_mappings(struct panfrost_gem_object *bo) ++{ ++ struct panfrost_gem_mapping *mapping; ++ ++ mutex_lock(&bo->mappings.lock); ++ list_for_each_entry(mapping, &bo->mappings.list, node) ++ panfrost_gem_teardown_mapping(mapping); ++ mutex_unlock(&bo->mappings.lock); ++} ++ + int panfrost_gem_open(struct drm_gem_object *obj, struct drm_file *file_priv) + { + int ret; +@@ -54,6 +123,16 @@ int panfrost_gem_open(struct drm_gem_object *obj, struct drm_file *file_priv) + struct panfrost_gem_object *bo = to_panfrost_bo(obj); + unsigned long color = bo->noexec ? PANFROST_BO_NOEXEC : 0; + struct panfrost_file_priv *priv = file_priv->driver_priv; ++ struct panfrost_gem_mapping *mapping; ++ ++ mapping = kzalloc(sizeof(*mapping), GFP_KERNEL); ++ if (!mapping) ++ return -ENOMEM; ++ ++ INIT_LIST_HEAD(&mapping->node); ++ kref_init(&mapping->refcount); ++ drm_gem_object_get(obj); ++ mapping->obj = bo; + + /* + * Executable buffers cannot cross a 16MB boundary as the program +@@ -66,37 +145,48 @@ int panfrost_gem_open(struct drm_gem_object *obj, struct drm_file *file_priv) + else + align = size >= SZ_2M ? SZ_2M >> PAGE_SHIFT : 0; + +- bo->mmu = &priv->mmu; ++ mapping->mmu = &priv->mmu; + spin_lock(&priv->mm_lock); +- ret = drm_mm_insert_node_generic(&priv->mm, &bo->node, ++ ret = drm_mm_insert_node_generic(&priv->mm, &mapping->mmnode, + size >> PAGE_SHIFT, align, color, 0); + spin_unlock(&priv->mm_lock); + if (ret) +- return ret; ++ goto err; + + if (!bo->is_heap) { +- ret = panfrost_mmu_map(bo); +- if (ret) { +- spin_lock(&priv->mm_lock); +- drm_mm_remove_node(&bo->node); +- spin_unlock(&priv->mm_lock); +- } ++ ret = panfrost_mmu_map(mapping); ++ if (ret) ++ goto err; + } ++ ++ mutex_lock(&bo->mappings.lock); ++ WARN_ON(bo->base.madv != PANFROST_MADV_WILLNEED); ++ list_add_tail(&mapping->node, &bo->mappings.list); ++ mutex_unlock(&bo->mappings.lock); ++ ++err: ++ if (ret) ++ panfrost_gem_mapping_put(mapping); + return ret; + } + + void panfrost_gem_close(struct drm_gem_object *obj, struct drm_file *file_priv) + { +- struct panfrost_gem_object *bo = to_panfrost_bo(obj); + struct panfrost_file_priv *priv = file_priv->driver_priv; ++ struct panfrost_gem_object *bo = to_panfrost_bo(obj); ++ struct panfrost_gem_mapping *mapping = NULL, *iter; + +- if (bo->is_mapped) +- panfrost_mmu_unmap(bo); ++ mutex_lock(&bo->mappings.lock); ++ list_for_each_entry(iter, &bo->mappings.list, node) { ++ if (iter->mmu == &priv->mmu) { ++ mapping = iter; ++ list_del(&iter->node); ++ break; ++ } ++ } ++ mutex_unlock(&bo->mappings.lock); + +- spin_lock(&priv->mm_lock); +- if (drm_mm_node_allocated(&bo->node)) +- drm_mm_remove_node(&bo->node); +- spin_unlock(&priv->mm_lock); ++ panfrost_gem_mapping_put(mapping); + } + + static int panfrost_gem_pin(struct drm_gem_object *obj) +@@ -136,6 +226,8 @@ struct drm_gem_object *panfrost_gem_create_object(struct drm_device *dev, size_t + if (!obj) + return NULL; + ++ INIT_LIST_HEAD(&obj->mappings.list); ++ mutex_init(&obj->mappings.lock); + obj->base.base.funcs = &panfrost_gem_funcs; + + return &obj->base.base; +diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.h b/drivers/gpu/drm/panfrost/panfrost_gem.h +index 4b17e7308764..ca1bc9019600 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_gem.h ++++ b/drivers/gpu/drm/panfrost/panfrost_gem.h +@@ -13,23 +13,46 @@ struct panfrost_gem_object { + struct drm_gem_shmem_object base; + struct sg_table *sgts; + +- struct panfrost_mmu *mmu; +- struct drm_mm_node node; +- bool is_mapped :1; ++ /* ++ * Use a list for now. If searching a mapping ever becomes the ++ * bottleneck, we should consider using an RB-tree, or even better, ++ * let the core store drm_gem_object_mapping entries (where we ++ * could place driver specific data) instead of drm_gem_object ones ++ * in its drm_file->object_idr table. ++ * ++ * struct drm_gem_object_mapping { ++ * struct drm_gem_object *obj; ++ * void *driver_priv; ++ * }; ++ */ ++ struct { ++ struct list_head list; ++ struct mutex lock; ++ } mappings; ++ + bool noexec :1; + bool is_heap :1; + }; + ++struct panfrost_gem_mapping { ++ struct list_head node; ++ struct kref refcount; ++ struct panfrost_gem_object *obj; ++ struct drm_mm_node mmnode; ++ struct panfrost_mmu *mmu; ++ bool active :1; ++}; ++ + static inline + struct panfrost_gem_object *to_panfrost_bo(struct drm_gem_object *obj) + { + return container_of(to_drm_gem_shmem_obj(obj), struct panfrost_gem_object, base); + } + +-static inline +-struct panfrost_gem_object *drm_mm_node_to_panfrost_bo(struct drm_mm_node *node) ++static inline struct panfrost_gem_mapping * ++drm_mm_node_to_panfrost_mapping(struct drm_mm_node *node) + { +- return container_of(node, struct panfrost_gem_object, node); ++ return container_of(node, struct panfrost_gem_mapping, mmnode); + } + + struct drm_gem_object *panfrost_gem_create_object(struct drm_device *dev, size_t size); +@@ -49,6 +72,12 @@ int panfrost_gem_open(struct drm_gem_object *obj, struct drm_file *file_priv); + void panfrost_gem_close(struct drm_gem_object *obj, + struct drm_file *file_priv); + ++struct panfrost_gem_mapping * ++panfrost_gem_mapping_get(struct panfrost_gem_object *bo, ++ struct panfrost_file_priv *priv); ++void panfrost_gem_mapping_put(struct panfrost_gem_mapping *mapping); ++void panfrost_gem_teardown_mappings(struct panfrost_gem_object *bo); ++ + void panfrost_gem_shrinker_init(struct drm_device *dev); + void panfrost_gem_shrinker_cleanup(struct drm_device *dev); + +diff --git a/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c b/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c +index 458f0fa68111..f5dd7b29bc95 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c ++++ b/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c +@@ -39,11 +39,12 @@ panfrost_gem_shrinker_count(struct shrinker *shrinker, struct shrink_control *sc + static bool panfrost_gem_purge(struct drm_gem_object *obj) + { + struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj); ++ struct panfrost_gem_object *bo = to_panfrost_bo(obj); + + if (!mutex_trylock(&shmem->pages_lock)) + return false; + +- panfrost_mmu_unmap(to_panfrost_bo(obj)); ++ panfrost_gem_teardown_mappings(bo); + drm_gem_shmem_purge_locked(obj); + + mutex_unlock(&shmem->pages_lock); +diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c +index 21f34d44aac2..bbb0c5e3ca6f 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_job.c ++++ b/drivers/gpu/drm/panfrost/panfrost_job.c +@@ -269,9 +269,20 @@ static void panfrost_job_cleanup(struct kref *ref) + dma_fence_put(job->done_fence); + dma_fence_put(job->render_done_fence); + +- if (job->bos) { ++ if (job->mappings) { + for (i = 0; i < job->bo_count; i++) ++ panfrost_gem_mapping_put(job->mappings[i]); ++ kvfree(job->mappings); ++ } ++ ++ if (job->bos) { ++ struct panfrost_gem_object *bo; ++ ++ for (i = 0; i < job->bo_count; i++) { ++ bo = to_panfrost_bo(job->bos[i]); + drm_gem_object_put_unlocked(job->bos[i]); ++ } ++ + kvfree(job->bos); + } + +diff --git a/drivers/gpu/drm/panfrost/panfrost_job.h b/drivers/gpu/drm/panfrost/panfrost_job.h +index 62454128a792..bbd3ba97ff67 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_job.h ++++ b/drivers/gpu/drm/panfrost/panfrost_job.h +@@ -32,6 +32,7 @@ struct panfrost_job { + + /* Exclusive fences we have taken from the BOs to wait for */ + struct dma_fence **implicit_fences; ++ struct panfrost_gem_mapping **mappings; + struct drm_gem_object **bos; + u32 bo_count; + +diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c +index a3ed64a1f15e..763cfca886a7 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c ++++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c +@@ -269,14 +269,15 @@ static int mmu_map_sg(struct panfrost_device *pfdev, struct panfrost_mmu *mmu, + return 0; + } + +-int panfrost_mmu_map(struct panfrost_gem_object *bo) ++int panfrost_mmu_map(struct panfrost_gem_mapping *mapping) + { ++ struct panfrost_gem_object *bo = mapping->obj; + struct drm_gem_object *obj = &bo->base.base; + struct panfrost_device *pfdev = to_panfrost_device(obj->dev); + struct sg_table *sgt; + int prot = IOMMU_READ | IOMMU_WRITE; + +- if (WARN_ON(bo->is_mapped)) ++ if (WARN_ON(mapping->active)) + return 0; + + if (bo->noexec) +@@ -286,25 +287,28 @@ int panfrost_mmu_map(struct panfrost_gem_object *bo) + if (WARN_ON(IS_ERR(sgt))) + return PTR_ERR(sgt); + +- mmu_map_sg(pfdev, bo->mmu, bo->node.start << PAGE_SHIFT, prot, sgt); +- bo->is_mapped = true; ++ mmu_map_sg(pfdev, mapping->mmu, mapping->mmnode.start << PAGE_SHIFT, ++ prot, sgt); ++ mapping->active = true; + + return 0; + } + +-void panfrost_mmu_unmap(struct panfrost_gem_object *bo) ++void panfrost_mmu_unmap(struct panfrost_gem_mapping *mapping) + { ++ struct panfrost_gem_object *bo = mapping->obj; + struct drm_gem_object *obj = &bo->base.base; + struct panfrost_device *pfdev = to_panfrost_device(obj->dev); +- struct io_pgtable_ops *ops = bo->mmu->pgtbl_ops; +- u64 iova = bo->node.start << PAGE_SHIFT; +- size_t len = bo->node.size << PAGE_SHIFT; ++ struct io_pgtable_ops *ops = mapping->mmu->pgtbl_ops; ++ u64 iova = mapping->mmnode.start << PAGE_SHIFT; ++ size_t len = mapping->mmnode.size << PAGE_SHIFT; + size_t unmapped_len = 0; + +- if (WARN_ON(!bo->is_mapped)) ++ if (WARN_ON(!mapping->active)) + return; + +- dev_dbg(pfdev->dev, "unmap: as=%d, iova=%llx, len=%zx", bo->mmu->as, iova, len); ++ dev_dbg(pfdev->dev, "unmap: as=%d, iova=%llx, len=%zx", ++ mapping->mmu->as, iova, len); + + while (unmapped_len < len) { + size_t unmapped_page; +@@ -318,8 +322,9 @@ void panfrost_mmu_unmap(struct panfrost_gem_object *bo) + unmapped_len += pgsize; + } + +- panfrost_mmu_flush_range(pfdev, bo->mmu, bo->node.start << PAGE_SHIFT, len); +- bo->is_mapped = false; ++ panfrost_mmu_flush_range(pfdev, mapping->mmu, ++ mapping->mmnode.start << PAGE_SHIFT, len); ++ mapping->active = false; + } + + static void mmu_tlb_inv_context_s1(void *cookie) +@@ -394,10 +399,10 @@ void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv) + free_io_pgtable_ops(mmu->pgtbl_ops); + } + +-static struct panfrost_gem_object * +-addr_to_drm_mm_node(struct panfrost_device *pfdev, int as, u64 addr) ++static struct panfrost_gem_mapping * ++addr_to_mapping(struct panfrost_device *pfdev, int as, u64 addr) + { +- struct panfrost_gem_object *bo = NULL; ++ struct panfrost_gem_mapping *mapping = NULL; + struct panfrost_file_priv *priv; + struct drm_mm_node *node; + u64 offset = addr >> PAGE_SHIFT; +@@ -418,8 +423,9 @@ found_mmu: + drm_mm_for_each_node(node, &priv->mm) { + if (offset >= node->start && + offset < (node->start + node->size)) { +- bo = drm_mm_node_to_panfrost_bo(node); +- drm_gem_object_get(&bo->base.base); ++ mapping = drm_mm_node_to_panfrost_mapping(node); ++ ++ kref_get(&mapping->refcount); + break; + } + } +@@ -427,7 +433,7 @@ found_mmu: + spin_unlock(&priv->mm_lock); + out: + spin_unlock(&pfdev->as_lock); +- return bo; ++ return mapping; + } + + #define NUM_FAULT_PAGES (SZ_2M / PAGE_SIZE) +@@ -436,28 +442,30 @@ static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, + u64 addr) + { + int ret, i; ++ struct panfrost_gem_mapping *bomapping; + struct panfrost_gem_object *bo; + struct address_space *mapping; + pgoff_t page_offset; + struct sg_table *sgt; + struct page **pages; + +- bo = addr_to_drm_mm_node(pfdev, as, addr); +- if (!bo) ++ bomapping = addr_to_mapping(pfdev, as, addr); ++ if (!bomapping) + return -ENOENT; + ++ bo = bomapping->obj; + if (!bo->is_heap) { + dev_WARN(pfdev->dev, "matching BO is not heap type (GPU VA = %llx)", +- bo->node.start << PAGE_SHIFT); ++ bomapping->mmnode.start << PAGE_SHIFT); + ret = -EINVAL; + goto err_bo; + } +- WARN_ON(bo->mmu->as != as); ++ WARN_ON(bomapping->mmu->as != as); + + /* Assume 2MB alignment and size multiple */ + addr &= ~((u64)SZ_2M - 1); + page_offset = addr >> PAGE_SHIFT; +- page_offset -= bo->node.start; ++ page_offset -= bomapping->mmnode.start; + + mutex_lock(&bo->base.pages_lock); + +@@ -509,13 +517,14 @@ static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, + goto err_map; + } + +- mmu_map_sg(pfdev, bo->mmu, addr, IOMMU_WRITE | IOMMU_READ | IOMMU_NOEXEC, sgt); ++ mmu_map_sg(pfdev, bomapping->mmu, addr, ++ IOMMU_WRITE | IOMMU_READ | IOMMU_NOEXEC, sgt); + +- bo->is_mapped = true; ++ bomapping->active = true; + + dev_dbg(pfdev->dev, "mapped page fault @ AS%d %llx", as, addr); + +- drm_gem_object_put_unlocked(&bo->base.base); ++ panfrost_gem_mapping_put(bomapping); + + return 0; + +diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.h b/drivers/gpu/drm/panfrost/panfrost_mmu.h +index 7c5b6775ae23..44fc2edf63ce 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_mmu.h ++++ b/drivers/gpu/drm/panfrost/panfrost_mmu.h +@@ -4,12 +4,12 @@ + #ifndef __PANFROST_MMU_H__ + #define __PANFROST_MMU_H__ + +-struct panfrost_gem_object; ++struct panfrost_gem_mapping; + struct panfrost_file_priv; + struct panfrost_mmu; + +-int panfrost_mmu_map(struct panfrost_gem_object *bo); +-void panfrost_mmu_unmap(struct panfrost_gem_object *bo); ++int panfrost_mmu_map(struct panfrost_gem_mapping *mapping); ++void panfrost_mmu_unmap(struct panfrost_gem_mapping *mapping); + + int panfrost_mmu_init(struct panfrost_device *pfdev); + void panfrost_mmu_fini(struct panfrost_device *pfdev); +diff --git a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c +index 2c04e858c50a..684820448be3 100644 +--- a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c ++++ b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c +@@ -25,7 +25,7 @@ + #define V4_SHADERS_PER_COREGROUP 4 + + struct panfrost_perfcnt { +- struct panfrost_gem_object *bo; ++ struct panfrost_gem_mapping *mapping; + size_t bosize; + void *buf; + struct panfrost_file_priv *user; +@@ -49,7 +49,7 @@ static int panfrost_perfcnt_dump_locked(struct panfrost_device *pfdev) + int ret; + + reinit_completion(&pfdev->perfcnt->dump_comp); +- gpuva = pfdev->perfcnt->bo->node.start << PAGE_SHIFT; ++ gpuva = pfdev->perfcnt->mapping->mmnode.start << PAGE_SHIFT; + gpu_write(pfdev, GPU_PERFCNT_BASE_LO, gpuva); + gpu_write(pfdev, GPU_PERFCNT_BASE_HI, gpuva >> 32); + gpu_write(pfdev, GPU_INT_CLEAR, +@@ -89,17 +89,22 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev, + if (IS_ERR(bo)) + return PTR_ERR(bo); + +- perfcnt->bo = to_panfrost_bo(&bo->base); +- + /* Map the perfcnt buf in the address space attached to file_priv. */ +- ret = panfrost_gem_open(&perfcnt->bo->base.base, file_priv); ++ ret = panfrost_gem_open(&bo->base, file_priv); + if (ret) + goto err_put_bo; + ++ perfcnt->mapping = panfrost_gem_mapping_get(to_panfrost_bo(&bo->base), ++ user); ++ if (!perfcnt->mapping) { ++ ret = -EINVAL; ++ goto err_close_bo; ++ } ++ + perfcnt->buf = drm_gem_shmem_vmap(&bo->base); + if (IS_ERR(perfcnt->buf)) { + ret = PTR_ERR(perfcnt->buf); +- goto err_close_bo; ++ goto err_put_mapping; + } + + /* +@@ -154,12 +159,17 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev, + if (panfrost_has_hw_issue(pfdev, HW_ISSUE_8186)) + gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0xffffffff); + ++ /* The BO ref is retained by the mapping. */ ++ drm_gem_object_put_unlocked(&bo->base); ++ + return 0; + + err_vunmap: +- drm_gem_shmem_vunmap(&perfcnt->bo->base.base, perfcnt->buf); ++ drm_gem_shmem_vunmap(&bo->base, perfcnt->buf); ++err_put_mapping: ++ panfrost_gem_mapping_put(perfcnt->mapping); + err_close_bo: +- panfrost_gem_close(&perfcnt->bo->base.base, file_priv); ++ panfrost_gem_close(&bo->base, file_priv); + err_put_bo: + drm_gem_object_put_unlocked(&bo->base); + return ret; +@@ -182,11 +192,11 @@ static int panfrost_perfcnt_disable_locked(struct panfrost_device *pfdev, + GPU_PERFCNT_CFG_MODE(GPU_PERFCNT_CFG_MODE_OFF)); + + perfcnt->user = NULL; +- drm_gem_shmem_vunmap(&perfcnt->bo->base.base, perfcnt->buf); ++ drm_gem_shmem_vunmap(&perfcnt->mapping->obj->base.base, perfcnt->buf); + perfcnt->buf = NULL; +- panfrost_gem_close(&perfcnt->bo->base.base, file_priv); +- drm_gem_object_put_unlocked(&perfcnt->bo->base.base); +- perfcnt->bo = NULL; ++ panfrost_gem_close(&perfcnt->mapping->obj->base.base, file_priv); ++ panfrost_gem_mapping_put(perfcnt->mapping); ++ perfcnt->mapping = NULL; + pm_runtime_mark_last_busy(pfdev->dev); + pm_runtime_put_autosuspend(pfdev->dev); + +diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c +index 6c64d50c9aae..01c2eeb02aa9 100644 +--- a/drivers/hwmon/adt7475.c ++++ b/drivers/hwmon/adt7475.c +@@ -294,9 +294,10 @@ static inline u16 volt2reg(int channel, long volt, u8 bypass_attn) + long reg; + + if (bypass_attn & (1 << channel)) +- reg = (volt * 1024) / 2250; ++ reg = DIV_ROUND_CLOSEST(volt * 1024, 2250); + else +- reg = (volt * r[1] * 1024) / ((r[0] + r[1]) * 2250); ++ reg = DIV_ROUND_CLOSEST(volt * r[1] * 1024, ++ (r[0] + r[1]) * 2250); + return clamp_val(reg, 0, 1023) & (0xff << 2); + } + +diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c +index 1f3b30b085b9..d018b20089ec 100644 +--- a/drivers/hwmon/hwmon.c ++++ b/drivers/hwmon/hwmon.c +@@ -51,6 +51,7 @@ struct hwmon_device_attribute { + + #define to_hwmon_attr(d) \ + container_of(d, struct hwmon_device_attribute, dev_attr) ++#define to_dev_attr(a) container_of(a, struct device_attribute, attr) + + /* + * Thermal zone information +@@ -58,7 +59,7 @@ struct hwmon_device_attribute { + * also provides the sensor index. + */ + struct hwmon_thermal_data { +- struct hwmon_device *hwdev; /* Reference to hwmon device */ ++ struct device *dev; /* Reference to hwmon device */ + int index; /* sensor index */ + }; + +@@ -95,9 +96,27 @@ static const struct attribute_group *hwmon_dev_attr_groups[] = { + NULL + }; + ++static void hwmon_free_attrs(struct attribute **attrs) ++{ ++ int i; ++ ++ for (i = 0; attrs[i]; i++) { ++ struct device_attribute *dattr = to_dev_attr(attrs[i]); ++ struct hwmon_device_attribute *hattr = to_hwmon_attr(dattr); ++ ++ kfree(hattr); ++ } ++ kfree(attrs); ++} ++ + static void hwmon_dev_release(struct device *dev) + { +- kfree(to_hwmon_device(dev)); ++ struct hwmon_device *hwdev = to_hwmon_device(dev); ++ ++ if (hwdev->group.attrs) ++ hwmon_free_attrs(hwdev->group.attrs); ++ kfree(hwdev->groups); ++ kfree(hwdev); + } + + static struct class hwmon_class = { +@@ -119,11 +138,11 @@ static DEFINE_IDA(hwmon_ida); + static int hwmon_thermal_get_temp(void *data, int *temp) + { + struct hwmon_thermal_data *tdata = data; +- struct hwmon_device *hwdev = tdata->hwdev; ++ struct hwmon_device *hwdev = to_hwmon_device(tdata->dev); + int ret; + long t; + +- ret = hwdev->chip->ops->read(&hwdev->dev, hwmon_temp, hwmon_temp_input, ++ ret = hwdev->chip->ops->read(tdata->dev, hwmon_temp, hwmon_temp_input, + tdata->index, &t); + if (ret < 0) + return ret; +@@ -137,8 +156,7 @@ static const struct thermal_zone_of_device_ops hwmon_thermal_ops = { + .get_temp = hwmon_thermal_get_temp, + }; + +-static int hwmon_thermal_add_sensor(struct device *dev, +- struct hwmon_device *hwdev, int index) ++static int hwmon_thermal_add_sensor(struct device *dev, int index) + { + struct hwmon_thermal_data *tdata; + struct thermal_zone_device *tzd; +@@ -147,10 +165,10 @@ static int hwmon_thermal_add_sensor(struct device *dev, + if (!tdata) + return -ENOMEM; + +- tdata->hwdev = hwdev; ++ tdata->dev = dev; + tdata->index = index; + +- tzd = devm_thermal_zone_of_sensor_register(&hwdev->dev, index, tdata, ++ tzd = devm_thermal_zone_of_sensor_register(dev, index, tdata, + &hwmon_thermal_ops); + /* + * If CONFIG_THERMAL_OF is disabled, this returns -ENODEV, +@@ -162,8 +180,7 @@ static int hwmon_thermal_add_sensor(struct device *dev, + return 0; + } + #else +-static int hwmon_thermal_add_sensor(struct device *dev, +- struct hwmon_device *hwdev, int index) ++static int hwmon_thermal_add_sensor(struct device *dev, int index) + { + return 0; + } +@@ -250,8 +267,7 @@ static bool is_string_attr(enum hwmon_sensor_types type, u32 attr) + (type == hwmon_fan && attr == hwmon_fan_label); + } + +-static struct attribute *hwmon_genattr(struct device *dev, +- const void *drvdata, ++static struct attribute *hwmon_genattr(const void *drvdata, + enum hwmon_sensor_types type, + u32 attr, + int index, +@@ -279,7 +295,7 @@ static struct attribute *hwmon_genattr(struct device *dev, + if ((mode & 0222) && !ops->write) + return ERR_PTR(-EINVAL); + +- hattr = devm_kzalloc(dev, sizeof(*hattr), GFP_KERNEL); ++ hattr = kzalloc(sizeof(*hattr), GFP_KERNEL); + if (!hattr) + return ERR_PTR(-ENOMEM); + +@@ -492,8 +508,7 @@ static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info) + return n; + } + +-static int hwmon_genattrs(struct device *dev, +- const void *drvdata, ++static int hwmon_genattrs(const void *drvdata, + struct attribute **attrs, + const struct hwmon_ops *ops, + const struct hwmon_channel_info *info) +@@ -519,7 +534,7 @@ static int hwmon_genattrs(struct device *dev, + attr_mask &= ~BIT(attr); + if (attr >= template_size) + return -EINVAL; +- a = hwmon_genattr(dev, drvdata, info->type, attr, i, ++ a = hwmon_genattr(drvdata, info->type, attr, i, + templates[attr], ops); + if (IS_ERR(a)) { + if (PTR_ERR(a) != -ENOENT) +@@ -533,8 +548,7 @@ static int hwmon_genattrs(struct device *dev, + } + + static struct attribute ** +-__hwmon_create_attrs(struct device *dev, const void *drvdata, +- const struct hwmon_chip_info *chip) ++__hwmon_create_attrs(const void *drvdata, const struct hwmon_chip_info *chip) + { + int ret, i, aindex = 0, nattrs = 0; + struct attribute **attrs; +@@ -545,15 +559,17 @@ __hwmon_create_attrs(struct device *dev, const void *drvdata, + if (nattrs == 0) + return ERR_PTR(-EINVAL); + +- attrs = devm_kcalloc(dev, nattrs + 1, sizeof(*attrs), GFP_KERNEL); ++ attrs = kcalloc(nattrs + 1, sizeof(*attrs), GFP_KERNEL); + if (!attrs) + return ERR_PTR(-ENOMEM); + + for (i = 0; chip->info[i]; i++) { +- ret = hwmon_genattrs(dev, drvdata, &attrs[aindex], chip->ops, ++ ret = hwmon_genattrs(drvdata, &attrs[aindex], chip->ops, + chip->info[i]); +- if (ret < 0) ++ if (ret < 0) { ++ hwmon_free_attrs(attrs); + return ERR_PTR(ret); ++ } + aindex += ret; + } + +@@ -595,14 +611,13 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, + for (i = 0; groups[i]; i++) + ngroups++; + +- hwdev->groups = devm_kcalloc(dev, ngroups, sizeof(*groups), +- GFP_KERNEL); ++ hwdev->groups = kcalloc(ngroups, sizeof(*groups), GFP_KERNEL); + if (!hwdev->groups) { + err = -ENOMEM; + goto free_hwmon; + } + +- attrs = __hwmon_create_attrs(dev, drvdata, chip); ++ attrs = __hwmon_create_attrs(drvdata, chip); + if (IS_ERR(attrs)) { + err = PTR_ERR(attrs); + goto free_hwmon; +@@ -647,8 +662,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, + hwmon_temp_input, j)) + continue; + if (info[i]->config[j] & HWMON_T_INPUT) { +- err = hwmon_thermal_add_sensor(dev, +- hwdev, j); ++ err = hwmon_thermal_add_sensor(hdev, j); + if (err) { + device_unregister(hdev); + /* +@@ -667,7 +681,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, + return hdev; + + free_hwmon: +- kfree(hwdev); ++ hwmon_dev_release(hdev); + ida_remove: + ida_simple_remove(&hwmon_ida, id); + return ERR_PTR(err); +diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c +index f3dd2a17bd42..2e97e56c72c7 100644 +--- a/drivers/hwmon/nct7802.c ++++ b/drivers/hwmon/nct7802.c +@@ -23,8 +23,8 @@ + static const u8 REG_VOLTAGE[5] = { 0x09, 0x0a, 0x0c, 0x0d, 0x0e }; + + static const u8 REG_VOLTAGE_LIMIT_LSB[2][5] = { +- { 0x40, 0x00, 0x42, 0x44, 0x46 }, +- { 0x3f, 0x00, 0x41, 0x43, 0x45 }, ++ { 0x46, 0x00, 0x40, 0x42, 0x44 }, ++ { 0x45, 0x00, 0x3f, 0x41, 0x43 }, + }; + + static const u8 REG_VOLTAGE_LIMIT_MSB[5] = { 0x48, 0x00, 0x47, 0x47, 0x48 }; +@@ -58,6 +58,8 @@ static const u8 REG_VOLTAGE_LIMIT_MSB_SHIFT[2][5] = { + struct nct7802_data { + struct regmap *regmap; + struct mutex access_lock; /* for multi-byte read and write operations */ ++ u8 in_status; ++ struct mutex in_alarm_lock; + }; + + static ssize_t temp_type_show(struct device *dev, +@@ -368,6 +370,66 @@ static ssize_t in_store(struct device *dev, struct device_attribute *attr, + return err ? : count; + } + ++static ssize_t in_alarm_show(struct device *dev, struct device_attribute *attr, ++ char *buf) ++{ ++ struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); ++ struct nct7802_data *data = dev_get_drvdata(dev); ++ int volt, min, max, ret; ++ unsigned int val; ++ ++ mutex_lock(&data->in_alarm_lock); ++ ++ /* ++ * The SMI Voltage status register is the only register giving a status ++ * for voltages. A bit is set for each input crossing a threshold, in ++ * both direction, but the "inside" or "outside" limits info is not ++ * available. Also this register is cleared on read. ++ * Note: this is not explicitly spelled out in the datasheet, but ++ * from experiment. ++ * To deal with this we use a status cache with one validity bit and ++ * one status bit for each input. Validity is cleared at startup and ++ * each time the register reports a change, and the status is processed ++ * by software based on current input value and limits. ++ */ ++ ret = regmap_read(data->regmap, 0x1e, &val); /* SMI Voltage status */ ++ if (ret < 0) ++ goto abort; ++ ++ /* invalidate cached status for all inputs crossing a threshold */ ++ data->in_status &= ~((val & 0x0f) << 4); ++ ++ /* if cached status for requested input is invalid, update it */ ++ if (!(data->in_status & (0x10 << sattr->index))) { ++ ret = nct7802_read_voltage(data, sattr->nr, 0); ++ if (ret < 0) ++ goto abort; ++ volt = ret; ++ ++ ret = nct7802_read_voltage(data, sattr->nr, 1); ++ if (ret < 0) ++ goto abort; ++ min = ret; ++ ++ ret = nct7802_read_voltage(data, sattr->nr, 2); ++ if (ret < 0) ++ goto abort; ++ max = ret; ++ ++ if (volt < min || volt > max) ++ data->in_status |= (1 << sattr->index); ++ else ++ data->in_status &= ~(1 << sattr->index); ++ ++ data->in_status |= 0x10 << sattr->index; ++ } ++ ++ ret = sprintf(buf, "%u\n", !!(data->in_status & (1 << sattr->index))); ++abort: ++ mutex_unlock(&data->in_alarm_lock); ++ return ret; ++} ++ + static ssize_t temp_show(struct device *dev, struct device_attribute *attr, + char *buf) + { +@@ -660,7 +722,7 @@ static const struct attribute_group nct7802_temp_group = { + static SENSOR_DEVICE_ATTR_2_RO(in0_input, in, 0, 0); + static SENSOR_DEVICE_ATTR_2_RW(in0_min, in, 0, 1); + static SENSOR_DEVICE_ATTR_2_RW(in0_max, in, 0, 2); +-static SENSOR_DEVICE_ATTR_2_RO(in0_alarm, alarm, 0x1e, 3); ++static SENSOR_DEVICE_ATTR_2_RO(in0_alarm, in_alarm, 0, 3); + static SENSOR_DEVICE_ATTR_2_RW(in0_beep, beep, 0x5a, 3); + + static SENSOR_DEVICE_ATTR_2_RO(in1_input, in, 1, 0); +@@ -668,19 +730,19 @@ static SENSOR_DEVICE_ATTR_2_RO(in1_input, in, 1, 0); + static SENSOR_DEVICE_ATTR_2_RO(in2_input, in, 2, 0); + static SENSOR_DEVICE_ATTR_2_RW(in2_min, in, 2, 1); + static SENSOR_DEVICE_ATTR_2_RW(in2_max, in, 2, 2); +-static SENSOR_DEVICE_ATTR_2_RO(in2_alarm, alarm, 0x1e, 0); ++static SENSOR_DEVICE_ATTR_2_RO(in2_alarm, in_alarm, 2, 0); + static SENSOR_DEVICE_ATTR_2_RW(in2_beep, beep, 0x5a, 0); + + static SENSOR_DEVICE_ATTR_2_RO(in3_input, in, 3, 0); + static SENSOR_DEVICE_ATTR_2_RW(in3_min, in, 3, 1); + static SENSOR_DEVICE_ATTR_2_RW(in3_max, in, 3, 2); +-static SENSOR_DEVICE_ATTR_2_RO(in3_alarm, alarm, 0x1e, 1); ++static SENSOR_DEVICE_ATTR_2_RO(in3_alarm, in_alarm, 3, 1); + static SENSOR_DEVICE_ATTR_2_RW(in3_beep, beep, 0x5a, 1); + + static SENSOR_DEVICE_ATTR_2_RO(in4_input, in, 4, 0); + static SENSOR_DEVICE_ATTR_2_RW(in4_min, in, 4, 1); + static SENSOR_DEVICE_ATTR_2_RW(in4_max, in, 4, 2); +-static SENSOR_DEVICE_ATTR_2_RO(in4_alarm, alarm, 0x1e, 2); ++static SENSOR_DEVICE_ATTR_2_RO(in4_alarm, in_alarm, 4, 2); + static SENSOR_DEVICE_ATTR_2_RW(in4_beep, beep, 0x5a, 2); + + static struct attribute *nct7802_in_attrs[] = { +@@ -1011,6 +1073,7 @@ static int nct7802_probe(struct i2c_client *client, + return PTR_ERR(data->regmap); + + mutex_init(&data->access_lock); ++ mutex_init(&data->in_alarm_lock); + + ret = nct7802_init_chip(data); + if (ret < 0) +diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c +index a1a035270cab..b273e421e910 100644 +--- a/drivers/infiniband/ulp/isert/ib_isert.c ++++ b/drivers/infiniband/ulp/isert/ib_isert.c +@@ -2575,17 +2575,6 @@ isert_wait4logout(struct isert_conn *isert_conn) + } + } + +-static void +-isert_wait4cmds(struct iscsi_conn *conn) +-{ +- isert_info("iscsi_conn %p\n", conn); +- +- if (conn->sess) { +- target_sess_cmd_list_set_waiting(conn->sess->se_sess); +- target_wait_for_sess_cmds(conn->sess->se_sess); +- } +-} +- + /** + * isert_put_unsol_pending_cmds() - Drop commands waiting for + * unsolicitate dataout +@@ -2633,7 +2622,6 @@ static void isert_wait_conn(struct iscsi_conn *conn) + + ib_drain_qp(isert_conn->qp); + isert_put_unsol_pending_cmds(conn); +- isert_wait4cmds(conn); + isert_wait4logout(isert_conn); + + queue_work(isert_release_wq, &isert_conn->release_work); +diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c +index 83368f1e7c4e..4650f4a94989 100644 +--- a/drivers/input/misc/keyspan_remote.c ++++ b/drivers/input/misc/keyspan_remote.c +@@ -336,7 +336,8 @@ static int keyspan_setup(struct usb_device* dev) + int retval = 0; + + retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), +- 0x11, 0x40, 0x5601, 0x0, NULL, 0, 0); ++ 0x11, 0x40, 0x5601, 0x0, NULL, 0, ++ USB_CTRL_SET_TIMEOUT); + if (retval) { + dev_dbg(&dev->dev, "%s - failed to set bit rate due to error: %d\n", + __func__, retval); +@@ -344,7 +345,8 @@ static int keyspan_setup(struct usb_device* dev) + } + + retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), +- 0x44, 0x40, 0x0, 0x0, NULL, 0, 0); ++ 0x44, 0x40, 0x0, 0x0, NULL, 0, ++ USB_CTRL_SET_TIMEOUT); + if (retval) { + dev_dbg(&dev->dev, "%s - failed to set resume sensitivity due to error: %d\n", + __func__, retval); +@@ -352,7 +354,8 @@ static int keyspan_setup(struct usb_device* dev) + } + + retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), +- 0x22, 0x40, 0x0, 0x0, NULL, 0, 0); ++ 0x22, 0x40, 0x0, 0x0, NULL, 0, ++ USB_CTRL_SET_TIMEOUT); + if (retval) { + dev_dbg(&dev->dev, "%s - failed to turn receive on due to error: %d\n", + __func__, retval); +diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c +index ecd762f93732..53ad25eaf1a2 100644 +--- a/drivers/input/misc/pm8xxx-vibrator.c ++++ b/drivers/input/misc/pm8xxx-vibrator.c +@@ -90,7 +90,7 @@ static int pm8xxx_vib_set(struct pm8xxx_vib *vib, bool on) + + if (regs->enable_mask) + rc = regmap_update_bits(vib->regmap, regs->enable_addr, +- on ? regs->enable_mask : 0, val); ++ regs->enable_mask, on ? ~0 : 0); + + return rc; + } +diff --git a/drivers/input/rmi4/rmi_smbus.c b/drivers/input/rmi4/rmi_smbus.c +index b313c579914f..2407ea43de59 100644 +--- a/drivers/input/rmi4/rmi_smbus.c ++++ b/drivers/input/rmi4/rmi_smbus.c +@@ -163,6 +163,7 @@ static int rmi_smb_write_block(struct rmi_transport_dev *xport, u16 rmiaddr, + /* prepare to write next block of bytes */ + cur_len -= SMB_MAX_COUNT; + databuff += SMB_MAX_COUNT; ++ rmiaddr += SMB_MAX_COUNT; + } + exit: + mutex_unlock(&rmi_smb->page_mutex); +@@ -214,6 +215,7 @@ static int rmi_smb_read_block(struct rmi_transport_dev *xport, u16 rmiaddr, + /* prepare to read next block of bytes */ + cur_len -= SMB_MAX_COUNT; + databuff += SMB_MAX_COUNT; ++ rmiaddr += SMB_MAX_COUNT; + } + + retval = 0; +diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c +index 2ca586fb914f..06d0ffef4a17 100644 +--- a/drivers/input/tablet/aiptek.c ++++ b/drivers/input/tablet/aiptek.c +@@ -1802,14 +1802,14 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) + input_set_abs_params(inputdev, ABS_WHEEL, AIPTEK_WHEEL_MIN, AIPTEK_WHEEL_MAX - 1, 0, 0); + + /* Verify that a device really has an endpoint */ +- if (intf->altsetting[0].desc.bNumEndpoints < 1) { ++ if (intf->cur_altsetting->desc.bNumEndpoints < 1) { + dev_err(&intf->dev, + "interface has %d endpoints, but must have minimum 1\n", +- intf->altsetting[0].desc.bNumEndpoints); ++ intf->cur_altsetting->desc.bNumEndpoints); + err = -EINVAL; + goto fail3; + } +- endpoint = &intf->altsetting[0].endpoint[0].desc; ++ endpoint = &intf->cur_altsetting->endpoint[0].desc; + + /* Go set up our URB, which is called when the tablet receives + * input. +diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c +index 35031228a6d0..799c94dda651 100644 +--- a/drivers/input/tablet/gtco.c ++++ b/drivers/input/tablet/gtco.c +@@ -875,18 +875,14 @@ static int gtco_probe(struct usb_interface *usbinterface, + } + + /* Sanity check that a device has an endpoint */ +- if (usbinterface->altsetting[0].desc.bNumEndpoints < 1) { ++ if (usbinterface->cur_altsetting->desc.bNumEndpoints < 1) { + dev_err(&usbinterface->dev, + "Invalid number of endpoints\n"); + error = -EINVAL; + goto err_free_urb; + } + +- /* +- * The endpoint is always altsetting 0, we know this since we know +- * this device only has one interrupt endpoint +- */ +- endpoint = &usbinterface->altsetting[0].endpoint[0].desc; ++ endpoint = &usbinterface->cur_altsetting->endpoint[0].desc; + + /* Some debug */ + dev_dbg(&usbinterface->dev, "gtco # interfaces: %d\n", usbinterface->num_altsetting); +@@ -973,7 +969,7 @@ static int gtco_probe(struct usb_interface *usbinterface, + input_dev->dev.parent = &usbinterface->dev; + + /* Setup the URB, it will be posted later on open of input device */ +- endpoint = &usbinterface->altsetting[0].endpoint[0].desc; ++ endpoint = &usbinterface->cur_altsetting->endpoint[0].desc; + + usb_fill_int_urb(gtco->urbinfo, + udev, +diff --git a/drivers/input/tablet/pegasus_notetaker.c b/drivers/input/tablet/pegasus_notetaker.c +index a1f3a0cb197e..38f087404f7a 100644 +--- a/drivers/input/tablet/pegasus_notetaker.c ++++ b/drivers/input/tablet/pegasus_notetaker.c +@@ -275,7 +275,7 @@ static int pegasus_probe(struct usb_interface *intf, + return -ENODEV; + + /* Sanity check that the device has an endpoint */ +- if (intf->altsetting[0].desc.bNumEndpoints < 1) { ++ if (intf->cur_altsetting->desc.bNumEndpoints < 1) { + dev_err(&intf->dev, "Invalid number of endpoints\n"); + return -EINVAL; + } +diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c +index 0af0fe8c40d7..742a7e96c1b5 100644 +--- a/drivers/input/touchscreen/sun4i-ts.c ++++ b/drivers/input/touchscreen/sun4i-ts.c +@@ -237,6 +237,7 @@ static int sun4i_ts_probe(struct platform_device *pdev) + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct device *hwmon; ++ struct thermal_zone_device *thermal; + int error; + u32 reg; + bool ts_attached; +@@ -355,7 +356,10 @@ static int sun4i_ts_probe(struct platform_device *pdev) + if (IS_ERR(hwmon)) + return PTR_ERR(hwmon); + +- devm_thermal_zone_of_sensor_register(ts->dev, 0, ts, &sun4i_ts_tz_ops); ++ thermal = devm_thermal_zone_of_sensor_register(ts->dev, 0, ts, ++ &sun4i_ts_tz_ops); ++ if (IS_ERR(thermal)) ++ return PTR_ERR(thermal); + + writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC); + +diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c +index 3fd3e862269b..2e2ea5719c90 100644 +--- a/drivers/input/touchscreen/sur40.c ++++ b/drivers/input/touchscreen/sur40.c +@@ -653,7 +653,7 @@ static int sur40_probe(struct usb_interface *interface, + int error; + + /* Check if we really have the right interface. */ +- iface_desc = &interface->altsetting[0]; ++ iface_desc = interface->cur_altsetting; + if (iface_desc->desc.bInterfaceClass != 0xFF) + return -ENODEV; + +diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c +index 568c52317757..483f7bc379fa 100644 +--- a/drivers/iommu/amd_iommu_init.c ++++ b/drivers/iommu/amd_iommu_init.c +@@ -1655,27 +1655,39 @@ static int iommu_pc_get_set_reg(struct amd_iommu *iommu, u8 bank, u8 cntr, + static void init_iommu_perf_ctr(struct amd_iommu *iommu) + { + struct pci_dev *pdev = iommu->dev; +- u64 val = 0xabcd, val2 = 0; ++ u64 val = 0xabcd, val2 = 0, save_reg = 0; + + if (!iommu_feature(iommu, FEATURE_PC)) + return; + + amd_iommu_pc_present = true; + ++ /* save the value to restore, if writable */ ++ if (iommu_pc_get_set_reg(iommu, 0, 0, 0, &save_reg, false)) ++ goto pc_false; ++ + /* Check if the performance counters can be written to */ + if ((iommu_pc_get_set_reg(iommu, 0, 0, 0, &val, true)) || + (iommu_pc_get_set_reg(iommu, 0, 0, 0, &val2, false)) || +- (val != val2)) { +- pci_err(pdev, "Unable to write to IOMMU perf counter.\n"); +- amd_iommu_pc_present = false; +- return; +- } ++ (val != val2)) ++ goto pc_false; ++ ++ /* restore */ ++ if (iommu_pc_get_set_reg(iommu, 0, 0, 0, &save_reg, true)) ++ goto pc_false; + + pci_info(pdev, "IOMMU performance counters supported\n"); + + val = readl(iommu->mmio_base + MMIO_CNTR_CONF_OFFSET); + iommu->max_banks = (u8) ((val >> 12) & 0x3f); + iommu->max_counters = (u8) ((val >> 7) & 0xf); ++ ++ return; ++ ++pc_false: ++ pci_err(pdev, "Unable to read/write to IOMMU perf counter.\n"); ++ amd_iommu_pc_present = false; ++ return; + } + + static ssize_t amd_iommu_show_cap(struct device *dev, +diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c +index e84c5dfe146f..dd5db856dcaf 100644 +--- a/drivers/iommu/intel-iommu.c ++++ b/drivers/iommu/intel-iommu.c +@@ -5132,7 +5132,8 @@ static void dmar_remove_one_dev_info(struct device *dev) + + spin_lock_irqsave(&device_domain_lock, flags); + info = dev->archdata.iommu; +- if (info) ++ if (info && info != DEFER_DEVICE_DOMAIN_INFO ++ && info != DUMMY_DEVICE_DOMAIN_INFO) + __dmar_remove_one_dev_info(info); + spin_unlock_irqrestore(&device_domain_lock, flags); + } +diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c +index a5c73f3d5f79..2bf74595610f 100644 +--- a/drivers/leds/leds-gpio.c ++++ b/drivers/leds/leds-gpio.c +@@ -151,9 +151,14 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) + struct gpio_led led = {}; + const char *state = NULL; + ++ /* ++ * Acquire gpiod from DT with uninitialized label, which ++ * will be updated after LED class device is registered, ++ * Only then the final LED name is known. ++ */ + led.gpiod = devm_fwnode_get_gpiod_from_child(dev, NULL, child, + GPIOD_ASIS, +- led.name); ++ NULL); + if (IS_ERR(led.gpiod)) { + fwnode_handle_put(child); + return ERR_CAST(led.gpiod); +@@ -186,6 +191,9 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) + fwnode_handle_put(child); + return ERR_PTR(ret); + } ++ /* Set gpiod label to match the corresponding LED name. */ ++ gpiod_set_consumer_name(led_dat->gpiod, ++ led_dat->cdev.dev->kobj.name); + priv->num_leds++; + } + +diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c +index 21bb96ce4cd6..58868d7129eb 100644 +--- a/drivers/media/v4l2-core/v4l2-ioctl.c ++++ b/drivers/media/v4l2-core/v4l2-ioctl.c +@@ -1605,12 +1605,12 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, + case V4L2_BUF_TYPE_VBI_CAPTURE: + if (unlikely(!ops->vidioc_s_fmt_vbi_cap)) + break; +- CLEAR_AFTER_FIELD(p, fmt.vbi); ++ CLEAR_AFTER_FIELD(p, fmt.vbi.flags); + return ops->vidioc_s_fmt_vbi_cap(file, fh, arg); + case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: + if (unlikely(!ops->vidioc_s_fmt_sliced_vbi_cap)) + break; +- CLEAR_AFTER_FIELD(p, fmt.sliced); ++ CLEAR_AFTER_FIELD(p, fmt.sliced.io_size); + return ops->vidioc_s_fmt_sliced_vbi_cap(file, fh, arg); + case V4L2_BUF_TYPE_VIDEO_OUTPUT: + if (unlikely(!ops->vidioc_s_fmt_vid_out)) +@@ -1636,22 +1636,22 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, + case V4L2_BUF_TYPE_VBI_OUTPUT: + if (unlikely(!ops->vidioc_s_fmt_vbi_out)) + break; +- CLEAR_AFTER_FIELD(p, fmt.vbi); ++ CLEAR_AFTER_FIELD(p, fmt.vbi.flags); + return ops->vidioc_s_fmt_vbi_out(file, fh, arg); + case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: + if (unlikely(!ops->vidioc_s_fmt_sliced_vbi_out)) + break; +- CLEAR_AFTER_FIELD(p, fmt.sliced); ++ CLEAR_AFTER_FIELD(p, fmt.sliced.io_size); + return ops->vidioc_s_fmt_sliced_vbi_out(file, fh, arg); + case V4L2_BUF_TYPE_SDR_CAPTURE: + if (unlikely(!ops->vidioc_s_fmt_sdr_cap)) + break; +- CLEAR_AFTER_FIELD(p, fmt.sdr); ++ CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize); + return ops->vidioc_s_fmt_sdr_cap(file, fh, arg); + case V4L2_BUF_TYPE_SDR_OUTPUT: + if (unlikely(!ops->vidioc_s_fmt_sdr_out)) + break; +- CLEAR_AFTER_FIELD(p, fmt.sdr); ++ CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize); + return ops->vidioc_s_fmt_sdr_out(file, fh, arg); + case V4L2_BUF_TYPE_META_CAPTURE: + if (unlikely(!ops->vidioc_s_fmt_meta_cap)) +@@ -1707,12 +1707,12 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, + case V4L2_BUF_TYPE_VBI_CAPTURE: + if (unlikely(!ops->vidioc_try_fmt_vbi_cap)) + break; +- CLEAR_AFTER_FIELD(p, fmt.vbi); ++ CLEAR_AFTER_FIELD(p, fmt.vbi.flags); + return ops->vidioc_try_fmt_vbi_cap(file, fh, arg); + case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: + if (unlikely(!ops->vidioc_try_fmt_sliced_vbi_cap)) + break; +- CLEAR_AFTER_FIELD(p, fmt.sliced); ++ CLEAR_AFTER_FIELD(p, fmt.sliced.io_size); + return ops->vidioc_try_fmt_sliced_vbi_cap(file, fh, arg); + case V4L2_BUF_TYPE_VIDEO_OUTPUT: + if (unlikely(!ops->vidioc_try_fmt_vid_out)) +@@ -1738,22 +1738,22 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, + case V4L2_BUF_TYPE_VBI_OUTPUT: + if (unlikely(!ops->vidioc_try_fmt_vbi_out)) + break; +- CLEAR_AFTER_FIELD(p, fmt.vbi); ++ CLEAR_AFTER_FIELD(p, fmt.vbi.flags); + return ops->vidioc_try_fmt_vbi_out(file, fh, arg); + case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: + if (unlikely(!ops->vidioc_try_fmt_sliced_vbi_out)) + break; +- CLEAR_AFTER_FIELD(p, fmt.sliced); ++ CLEAR_AFTER_FIELD(p, fmt.sliced.io_size); + return ops->vidioc_try_fmt_sliced_vbi_out(file, fh, arg); + case V4L2_BUF_TYPE_SDR_CAPTURE: + if (unlikely(!ops->vidioc_try_fmt_sdr_cap)) + break; +- CLEAR_AFTER_FIELD(p, fmt.sdr); ++ CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize); + return ops->vidioc_try_fmt_sdr_cap(file, fh, arg); + case V4L2_BUF_TYPE_SDR_OUTPUT: + if (unlikely(!ops->vidioc_try_fmt_sdr_out)) + break; +- CLEAR_AFTER_FIELD(p, fmt.sdr); ++ CLEAR_AFTER_FIELD(p, fmt.sdr.buffersize); + return ops->vidioc_try_fmt_sdr_out(file, fh, arg); + case V4L2_BUF_TYPE_META_CAPTURE: + if (unlikely(!ops->vidioc_try_fmt_meta_cap)) +diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c +index 7bc950520fd9..403ac44a7378 100644 +--- a/drivers/mmc/host/sdhci-tegra.c ++++ b/drivers/mmc/host/sdhci-tegra.c +@@ -386,7 +386,7 @@ static void tegra_sdhci_reset(struct sdhci_host *host, u8 mask) + misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_DDR50; + if (soc_data->nvquirks & NVQUIRK_ENABLE_SDR104) + misc_ctrl |= SDHCI_MISC_CTRL_ENABLE_SDR104; +- if (soc_data->nvquirks & SDHCI_MISC_CTRL_ENABLE_SDR50) ++ if (soc_data->nvquirks & NVQUIRK_ENABLE_SDR50) + clk_ctrl |= SDHCI_CLOCK_CTRL_SDR50_TUNING_OVERRIDE; + } + +diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c +index 5f9df2dbde06..4478b94d4791 100644 +--- a/drivers/mmc/host/sdhci.c ++++ b/drivers/mmc/host/sdhci.c +@@ -3902,11 +3902,13 @@ int sdhci_setup_host(struct sdhci_host *host) + if (host->ops->get_min_clock) + mmc->f_min = host->ops->get_min_clock(host); + else if (host->version >= SDHCI_SPEC_300) { +- if (host->clk_mul) { +- mmc->f_min = (host->max_clk * host->clk_mul) / 1024; ++ if (host->clk_mul) + max_clk = host->max_clk * host->clk_mul; +- } else +- mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300; ++ /* ++ * Divided Clock Mode minimum clock rate is always less than ++ * Programmable Clock Mode minimum clock rate. ++ */ ++ mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300; + } else + mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200; + +diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c +index bb90757ecace..4cbb764c9822 100644 +--- a/drivers/mmc/host/sdhci_am654.c ++++ b/drivers/mmc/host/sdhci_am654.c +@@ -236,6 +236,22 @@ static void sdhci_am654_write_b(struct sdhci_host *host, u8 val, int reg) + writeb(val, host->ioaddr + reg); + } + ++static int sdhci_am654_execute_tuning(struct mmc_host *mmc, u32 opcode) ++{ ++ struct sdhci_host *host = mmc_priv(mmc); ++ int err = sdhci_execute_tuning(mmc, opcode); ++ ++ if (err) ++ return err; ++ /* ++ * Tuning data remains in the buffer after tuning. ++ * Do a command and data reset to get rid of it ++ */ ++ sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA); ++ ++ return 0; ++} ++ + static struct sdhci_ops sdhci_am654_ops = { + .get_max_clock = sdhci_pltfm_clk_get_max_clock, + .get_timeout_clock = sdhci_pltfm_clk_get_max_clock, +@@ -249,8 +265,7 @@ static struct sdhci_ops sdhci_am654_ops = { + + static const struct sdhci_pltfm_data sdhci_am654_pdata = { + .ops = &sdhci_am654_ops, +- .quirks = SDHCI_QUIRK_INVERTED_WRITE_PROTECT | +- SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12, ++ .quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12, + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, + }; + +@@ -272,8 +287,7 @@ static struct sdhci_ops sdhci_j721e_8bit_ops = { + + static const struct sdhci_pltfm_data sdhci_j721e_8bit_pdata = { + .ops = &sdhci_j721e_8bit_ops, +- .quirks = SDHCI_QUIRK_INVERTED_WRITE_PROTECT | +- SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12, ++ .quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12, + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, + }; + +@@ -295,8 +309,7 @@ static struct sdhci_ops sdhci_j721e_4bit_ops = { + + static const struct sdhci_pltfm_data sdhci_j721e_4bit_pdata = { + .ops = &sdhci_j721e_4bit_ops, +- .quirks = SDHCI_QUIRK_INVERTED_WRITE_PROTECT | +- SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12, ++ .quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12, + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, + }; + +@@ -480,6 +493,8 @@ static int sdhci_am654_probe(struct platform_device *pdev) + goto pm_runtime_put; + } + ++ host->mmc_host_ops.execute_tuning = sdhci_am654_execute_tuning; ++ + ret = sdhci_am654_init(host); + if (ret) + goto pm_runtime_put; +diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c +index 2e57122f02fb..2f5c287eac95 100644 +--- a/drivers/net/can/slcan.c ++++ b/drivers/net/can/slcan.c +@@ -344,9 +344,16 @@ static void slcan_transmit(struct work_struct *work) + */ + static void slcan_write_wakeup(struct tty_struct *tty) + { +- struct slcan *sl = tty->disc_data; ++ struct slcan *sl; ++ ++ rcu_read_lock(); ++ sl = rcu_dereference(tty->disc_data); ++ if (!sl) ++ goto out; + + schedule_work(&sl->tx_work); ++out: ++ rcu_read_unlock(); + } + + /* Send a can_frame to a TTY queue. */ +@@ -644,10 +651,11 @@ static void slcan_close(struct tty_struct *tty) + return; + + spin_lock_bh(&sl->lock); +- tty->disc_data = NULL; ++ rcu_assign_pointer(tty->disc_data, NULL); + sl->tty = NULL; + spin_unlock_bh(&sl->lock); + ++ synchronize_rcu(); + flush_work(&sl->tx_work); + + /* Flush network side */ +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c +index 1de51811fcb4..8f909d57501f 100644 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c +@@ -2164,8 +2164,8 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv, + DMA_END_ADDR); + + /* Initialize Tx NAPI */ +- netif_napi_add(priv->dev, &ring->napi, bcmgenet_tx_poll, +- NAPI_POLL_WEIGHT); ++ netif_tx_napi_add(priv->dev, &ring->napi, bcmgenet_tx_poll, ++ NAPI_POLL_WEIGHT); + } + + /* Initialize a RDMA ring */ +diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +index 58f89f6a040f..97ff8608f0ab 100644 +--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c ++++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +@@ -2448,6 +2448,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) + + if (!is_offload(adapter)) + return -EOPNOTSUPP; ++ if (!capable(CAP_NET_ADMIN)) ++ return -EPERM; + if (!(adapter->flags & FULL_INIT_DONE)) + return -EIO; /* need the memory controllers */ + if (copy_from_user(&t, useraddr, sizeof(t))) +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c +index 778dab1af8fc..f260dd96873b 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c +@@ -180,7 +180,7 @@ mlx5e_ktls_tx_post_param_wqes(struct mlx5e_txqsq *sq, + + struct tx_sync_info { + u64 rcd_sn; +- s32 sync_len; ++ u32 sync_len; + int nr_frags; + skb_frag_t frags[MAX_SKB_FRAGS]; + }; +@@ -193,13 +193,14 @@ enum mlx5e_ktls_sync_retval { + + static enum mlx5e_ktls_sync_retval + tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx, +- u32 tcp_seq, struct tx_sync_info *info) ++ u32 tcp_seq, int datalen, struct tx_sync_info *info) + { + struct tls_offload_context_tx *tx_ctx = priv_tx->tx_ctx; + enum mlx5e_ktls_sync_retval ret = MLX5E_KTLS_SYNC_DONE; + struct tls_record_info *record; + int remaining, i = 0; + unsigned long flags; ++ bool ends_before; + + spin_lock_irqsave(&tx_ctx->lock, flags); + record = tls_get_record(tx_ctx, tcp_seq, &info->rcd_sn); +@@ -209,9 +210,21 @@ tx_sync_info_get(struct mlx5e_ktls_offload_context_tx *priv_tx, + goto out; + } + +- if (unlikely(tcp_seq < tls_record_start_seq(record))) { +- ret = tls_record_is_start_marker(record) ? +- MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL; ++ /* There are the following cases: ++ * 1. packet ends before start marker: bypass offload. ++ * 2. packet starts before start marker and ends after it: drop, ++ * not supported, breaks contract with kernel. ++ * 3. packet ends before tls record info starts: drop, ++ * this packet was already acknowledged and its record info ++ * was released. ++ */ ++ ends_before = before(tcp_seq + datalen, tls_record_start_seq(record)); ++ ++ if (unlikely(tls_record_is_start_marker(record))) { ++ ret = ends_before ? MLX5E_KTLS_SYNC_SKIP_NO_DATA : MLX5E_KTLS_SYNC_FAIL; ++ goto out; ++ } else if (ends_before) { ++ ret = MLX5E_KTLS_SYNC_FAIL; + goto out; + } + +@@ -337,7 +350,7 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx, + u8 num_wqebbs; + int i = 0; + +- ret = tx_sync_info_get(priv_tx, seq, &info); ++ ret = tx_sync_info_get(priv_tx, seq, datalen, &info); + if (unlikely(ret != MLX5E_KTLS_SYNC_DONE)) { + if (ret == MLX5E_KTLS_SYNC_SKIP_NO_DATA) { + stats->tls_skip_no_sync_data++; +@@ -351,14 +364,6 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx, + goto err_out; + } + +- if (unlikely(info.sync_len < 0)) { +- if (likely(datalen <= -info.sync_len)) +- return MLX5E_KTLS_SYNC_DONE; +- +- stats->tls_drop_bypass_req++; +- goto err_out; +- } +- + stats->tls_ooo++; + + tx_post_resync_params(sq, priv_tx, info.rcd_sn); +@@ -378,8 +383,6 @@ mlx5e_ktls_tx_handle_ooo(struct mlx5e_ktls_offload_context_tx *priv_tx, + if (unlikely(contig_wqebbs_room < num_wqebbs)) + mlx5e_fill_sq_frag_edge(sq, wq, pi, contig_wqebbs_room); + +- tx_post_resync_params(sq, priv_tx, info.rcd_sn); +- + for (; i < info.nr_frags; i++) { + unsigned int orig_fsz, frag_offset = 0, n = 0; + skb_frag_t *f = &info.frags[i]; +@@ -455,12 +458,18 @@ struct sk_buff *mlx5e_ktls_handle_tx_skb(struct net_device *netdev, + enum mlx5e_ktls_sync_retval ret = + mlx5e_ktls_tx_handle_ooo(priv_tx, sq, datalen, seq); + +- if (likely(ret == MLX5E_KTLS_SYNC_DONE)) ++ switch (ret) { ++ case MLX5E_KTLS_SYNC_DONE: + *wqe = mlx5e_sq_fetch_wqe(sq, sizeof(**wqe), pi); +- else if (ret == MLX5E_KTLS_SYNC_FAIL) ++ break; ++ case MLX5E_KTLS_SYNC_SKIP_NO_DATA: ++ if (likely(!skb->decrypted)) ++ goto out; ++ WARN_ON_ONCE(1); ++ /* fall-through */ ++ default: /* MLX5E_KTLS_SYNC_FAIL */ + goto err_out; +- else /* ret == MLX5E_KTLS_SYNC_SKIP_NO_DATA */ +- goto out; ++ } + } + + priv_tx->expected_seq = seq + datalen; +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +index 96711e34d248..1f9107d83848 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +@@ -3951,6 +3951,13 @@ static int apply_police_params(struct mlx5e_priv *priv, u32 rate, + u32 rate_mbps; + int err; + ++ vport_num = rpriv->rep->vport; ++ if (vport_num >= MLX5_VPORT_ECPF) { ++ NL_SET_ERR_MSG_MOD(extack, ++ "Ingress rate limit is supported only for Eswitch ports connected to VFs"); ++ return -EOPNOTSUPP; ++ } ++ + esw = priv->mdev->priv.eswitch; + /* rate is given in bytes/sec. + * First convert to bits/sec and then round to the nearest mbit/secs. +@@ -3959,8 +3966,6 @@ static int apply_police_params(struct mlx5e_priv *priv, u32 rate, + * 1 mbit/sec. + */ + rate_mbps = rate ? max_t(u32, (rate * 8 + 500000) / 1000000, 1) : 0; +- vport_num = rpriv->rep->vport; +- + err = mlx5_esw_modify_vport_rate(esw, vport_num, rate_mbps); + if (err) + NL_SET_ERR_MSG_MOD(extack, "failed applying action to hardware"); +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +index 9004a07e457a..5acfdea3a75a 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +@@ -858,7 +858,7 @@ out: + */ + #define ESW_SIZE (16 * 1024 * 1024) + const unsigned int ESW_POOLS[4] = { 4 * 1024 * 1024, 1 * 1024 * 1024, +- 64 * 1024, 4 * 1024 }; ++ 64 * 1024, 128 }; + + static int + get_sz_from_pool(struct mlx5_eswitch *esw) +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c +index 051ab845b501..c96a0e501007 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c +@@ -1569,6 +1569,7 @@ static const struct pci_device_id mlx5_core_pci_table[] = { + { PCI_VDEVICE(MELLANOX, 0x101d) }, /* ConnectX-6 Dx */ + { PCI_VDEVICE(MELLANOX, 0x101e), MLX5_PCI_DEV_IS_VF}, /* ConnectX Family mlx5Gen Virtual Function */ + { PCI_VDEVICE(MELLANOX, 0x101f) }, /* ConnectX-6 LX */ ++ { PCI_VDEVICE(MELLANOX, 0x1021) }, /* ConnectX-7 */ + { PCI_VDEVICE(MELLANOX, 0xa2d2) }, /* BlueField integrated ConnectX-5 network controller */ + { PCI_VDEVICE(MELLANOX, 0xa2d3), MLX5_PCI_DEV_IS_VF}, /* BlueField integrated ConnectX-5 network controller VF */ + { PCI_VDEVICE(MELLANOX, 0xa2d6) }, /* BlueField-2 integrated ConnectX-6 Dx network controller */ +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c +index 51803eef13dd..c7f10d4f8f8d 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c +@@ -1,6 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB + /* Copyright (c) 2019 Mellanox Technologies. */ + ++#include + #include "dr_types.h" + + #define QUEUE_SIZE 128 +@@ -729,7 +730,7 @@ static struct mlx5dr_cq *dr_create_cq(struct mlx5_core_dev *mdev, + if (!in) + goto err_cqwq; + +- vector = smp_processor_id() % mlx5_comp_vectors_count(mdev); ++ vector = raw_smp_processor_id() % mlx5_comp_vectors_count(mdev); + err = mlx5_vector2eqn(mdev, vector, &eqn, &irqn); + if (err) { + kvfree(in); +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c +index 3d587d0bdbbe..1e32e2443f73 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c +@@ -352,26 +352,16 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, + if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) { + list_for_each_entry(dst, &fte->node.children, node.list) { + enum mlx5_flow_destination_type type = dst->dest_attr.type; +- u32 id; + + if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) { + err = -ENOSPC; + goto free_actions; + } + +- switch (type) { +- case MLX5_FLOW_DESTINATION_TYPE_COUNTER: +- id = dst->dest_attr.counter_id; ++ if (type == MLX5_FLOW_DESTINATION_TYPE_COUNTER) ++ continue; + +- tmp_action = +- mlx5dr_action_create_flow_counter(id); +- if (!tmp_action) { +- err = -ENOMEM; +- goto free_actions; +- } +- fs_dr_actions[fs_dr_num_actions++] = tmp_action; +- actions[num_actions++] = tmp_action; +- break; ++ switch (type) { + case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE: + tmp_action = create_ft_action(dev, dst); + if (!tmp_action) { +@@ -397,6 +387,32 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, + } + } + ++ if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_COUNT) { ++ list_for_each_entry(dst, &fte->node.children, node.list) { ++ u32 id; ++ ++ if (dst->dest_attr.type != ++ MLX5_FLOW_DESTINATION_TYPE_COUNTER) ++ continue; ++ ++ if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) { ++ err = -ENOSPC; ++ goto free_actions; ++ } ++ ++ id = dst->dest_attr.counter_id; ++ tmp_action = ++ mlx5dr_action_create_flow_counter(id); ++ if (!tmp_action) { ++ err = -ENOMEM; ++ goto free_actions; ++ } ++ ++ fs_dr_actions[fs_dr_num_actions++] = tmp_action; ++ actions[num_actions++] = tmp_action; ++ } ++ } ++ + params.match_sz = match_sz; + params.match_buf = (u64 *)fte->val; + +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c +index 150b3a144b83..3d3cca596116 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c +@@ -8,6 +8,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -25,6 +26,7 @@ struct mlxsw_sp_acl { + struct mlxsw_sp_fid *dummy_fid; + struct rhashtable ruleset_ht; + struct list_head rules; ++ struct mutex rules_lock; /* Protects rules list */ + struct { + struct delayed_work dw; + unsigned long interval; /* ms */ +@@ -701,7 +703,9 @@ int mlxsw_sp_acl_rule_add(struct mlxsw_sp *mlxsw_sp, + goto err_ruleset_block_bind; + } + ++ mutex_lock(&mlxsw_sp->acl->rules_lock); + list_add_tail(&rule->list, &mlxsw_sp->acl->rules); ++ mutex_unlock(&mlxsw_sp->acl->rules_lock); + block->rule_count++; + block->egress_blocker_rule_count += rule->rulei->egress_bind_blocker; + return 0; +@@ -723,7 +727,9 @@ void mlxsw_sp_acl_rule_del(struct mlxsw_sp *mlxsw_sp, + + block->egress_blocker_rule_count -= rule->rulei->egress_bind_blocker; + ruleset->ht_key.block->rule_count--; ++ mutex_lock(&mlxsw_sp->acl->rules_lock); + list_del(&rule->list); ++ mutex_unlock(&mlxsw_sp->acl->rules_lock); + if (!ruleset->ht_key.chain_index && + mlxsw_sp_acl_ruleset_is_singular(ruleset)) + mlxsw_sp_acl_ruleset_block_unbind(mlxsw_sp, ruleset, +@@ -783,19 +789,18 @@ static int mlxsw_sp_acl_rules_activity_update(struct mlxsw_sp_acl *acl) + struct mlxsw_sp_acl_rule *rule; + int err; + +- /* Protect internal structures from changes */ +- rtnl_lock(); ++ mutex_lock(&acl->rules_lock); + list_for_each_entry(rule, &acl->rules, list) { + err = mlxsw_sp_acl_rule_activity_update(acl->mlxsw_sp, + rule); + if (err) + goto err_rule_update; + } +- rtnl_unlock(); ++ mutex_unlock(&acl->rules_lock); + return 0; + + err_rule_update: +- rtnl_unlock(); ++ mutex_unlock(&acl->rules_lock); + return err; + } + +@@ -880,6 +885,7 @@ int mlxsw_sp_acl_init(struct mlxsw_sp *mlxsw_sp) + acl->dummy_fid = fid; + + INIT_LIST_HEAD(&acl->rules); ++ mutex_init(&acl->rules_lock); + err = mlxsw_sp_acl_tcam_init(mlxsw_sp, &acl->tcam); + if (err) + goto err_acl_ops_init; +@@ -892,6 +898,7 @@ int mlxsw_sp_acl_init(struct mlxsw_sp *mlxsw_sp) + return 0; + + err_acl_ops_init: ++ mutex_destroy(&acl->rules_lock); + mlxsw_sp_fid_put(fid); + err_fid_get: + rhashtable_destroy(&acl->ruleset_ht); +@@ -908,6 +915,7 @@ void mlxsw_sp_acl_fini(struct mlxsw_sp *mlxsw_sp) + + cancel_delayed_work_sync(&mlxsw_sp->acl->rule_activity_update.dw); + mlxsw_sp_acl_tcam_fini(mlxsw_sp, &acl->tcam); ++ mutex_destroy(&acl->rules_lock); + WARN_ON(!list_empty(&acl->rules)); + mlxsw_sp_fid_put(acl->dummy_fid); + rhashtable_destroy(&acl->ruleset_ht); +diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c +index 1c14c051ee52..63e7a058b7c6 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c +@@ -299,22 +299,17 @@ static netdev_tx_t mlxsw_sx_port_xmit(struct sk_buff *skb, + u64 len; + int err; + ++ if (skb_cow_head(skb, MLXSW_TXHDR_LEN)) { ++ this_cpu_inc(mlxsw_sx_port->pcpu_stats->tx_dropped); ++ dev_kfree_skb_any(skb); ++ return NETDEV_TX_OK; ++ } ++ + memset(skb->cb, 0, sizeof(struct mlxsw_skb_cb)); + + if (mlxsw_core_skb_transmit_busy(mlxsw_sx->core, &tx_info)) + return NETDEV_TX_BUSY; + +- if (unlikely(skb_headroom(skb) < MLXSW_TXHDR_LEN)) { +- struct sk_buff *skb_orig = skb; +- +- skb = skb_realloc_headroom(skb, MLXSW_TXHDR_LEN); +- if (!skb) { +- this_cpu_inc(mlxsw_sx_port->pcpu_stats->tx_dropped); +- dev_kfree_skb_any(skb_orig); +- return NETDEV_TX_OK; +- } +- dev_consume_skb_any(skb_orig); +- } + mlxsw_sx_txhdr_construct(skb, &tx_info); + /* TX header is consumed by HW on the way so we shouldn't count its + * bytes as being sent. +diff --git a/drivers/net/ethernet/natsemi/sonic.c b/drivers/net/ethernet/natsemi/sonic.c +index b339125b2f09..05e760444a92 100644 +--- a/drivers/net/ethernet/natsemi/sonic.c ++++ b/drivers/net/ethernet/natsemi/sonic.c +@@ -64,6 +64,8 @@ static int sonic_open(struct net_device *dev) + + netif_dbg(lp, ifup, dev, "%s: initializing sonic driver\n", __func__); + ++ spin_lock_init(&lp->lock); ++ + for (i = 0; i < SONIC_NUM_RRS; i++) { + struct sk_buff *skb = netdev_alloc_skb(dev, SONIC_RBSIZE + 2); + if (skb == NULL) { +@@ -114,6 +116,24 @@ static int sonic_open(struct net_device *dev) + return 0; + } + ++/* Wait for the SONIC to become idle. */ ++static void sonic_quiesce(struct net_device *dev, u16 mask) ++{ ++ struct sonic_local * __maybe_unused lp = netdev_priv(dev); ++ int i; ++ u16 bits; ++ ++ for (i = 0; i < 1000; ++i) { ++ bits = SONIC_READ(SONIC_CMD) & mask; ++ if (!bits) ++ return; ++ if (irqs_disabled() || in_interrupt()) ++ udelay(20); ++ else ++ usleep_range(100, 200); ++ } ++ WARN_ONCE(1, "command deadline expired! 0x%04x\n", bits); ++} + + /* + * Close the SONIC device +@@ -130,6 +150,9 @@ static int sonic_close(struct net_device *dev) + /* + * stop the SONIC, disable interrupts + */ ++ SONIC_WRITE(SONIC_CMD, SONIC_CR_RXDIS); ++ sonic_quiesce(dev, SONIC_CR_ALL); ++ + SONIC_WRITE(SONIC_IMR, 0); + SONIC_WRITE(SONIC_ISR, 0x7fff); + SONIC_WRITE(SONIC_CMD, SONIC_CR_RST); +@@ -169,6 +192,9 @@ static void sonic_tx_timeout(struct net_device *dev) + * put the Sonic into software-reset mode and + * disable all interrupts before releasing DMA buffers + */ ++ SONIC_WRITE(SONIC_CMD, SONIC_CR_RXDIS); ++ sonic_quiesce(dev, SONIC_CR_ALL); ++ + SONIC_WRITE(SONIC_IMR, 0); + SONIC_WRITE(SONIC_ISR, 0x7fff); + SONIC_WRITE(SONIC_CMD, SONIC_CR_RST); +@@ -206,8 +232,6 @@ static void sonic_tx_timeout(struct net_device *dev) + * wake the tx queue + * Concurrently with all of this, the SONIC is potentially writing to + * the status flags of the TDs. +- * Until some mutual exclusion is added, this code will not work with SMP. However, +- * MIPS Jazz machines and m68k Macs were all uni-processor machines. + */ + + static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev) +@@ -215,7 +239,8 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev) + struct sonic_local *lp = netdev_priv(dev); + dma_addr_t laddr; + int length; +- int entry = lp->next_tx; ++ int entry; ++ unsigned long flags; + + netif_dbg(lp, tx_queued, dev, "%s: skb=%p\n", __func__, skb); + +@@ -237,6 +262,10 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev) + return NETDEV_TX_OK; + } + ++ spin_lock_irqsave(&lp->lock, flags); ++ ++ entry = lp->next_tx; ++ + sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0); /* clear status */ + sonic_tda_put(dev, entry, SONIC_TD_FRAG_COUNT, 1); /* single fragment */ + sonic_tda_put(dev, entry, SONIC_TD_PKTSIZE, length); /* length of packet */ +@@ -246,10 +275,6 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev) + sonic_tda_put(dev, entry, SONIC_TD_LINK, + sonic_tda_get(dev, entry, SONIC_TD_LINK) | SONIC_EOL); + +- /* +- * Must set tx_skb[entry] only after clearing status, and +- * before clearing EOL and before stopping queue +- */ + wmb(); + lp->tx_len[entry] = length; + lp->tx_laddr[entry] = laddr; +@@ -272,6 +297,8 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev) + + SONIC_WRITE(SONIC_CMD, SONIC_CR_TXP); + ++ spin_unlock_irqrestore(&lp->lock, flags); ++ + return NETDEV_TX_OK; + } + +@@ -284,15 +311,28 @@ static irqreturn_t sonic_interrupt(int irq, void *dev_id) + struct net_device *dev = dev_id; + struct sonic_local *lp = netdev_priv(dev); + int status; ++ unsigned long flags; ++ ++ /* The lock has two purposes. Firstly, it synchronizes sonic_interrupt() ++ * with sonic_send_packet() so that the two functions can share state. ++ * Secondly, it makes sonic_interrupt() re-entrant, as that is required ++ * by macsonic which must use two IRQs with different priority levels. ++ */ ++ spin_lock_irqsave(&lp->lock, flags); ++ ++ status = SONIC_READ(SONIC_ISR) & SONIC_IMR_DEFAULT; ++ if (!status) { ++ spin_unlock_irqrestore(&lp->lock, flags); + +- if (!(status = SONIC_READ(SONIC_ISR) & SONIC_IMR_DEFAULT)) + return IRQ_NONE; ++ } + + do { ++ SONIC_WRITE(SONIC_ISR, status); /* clear the interrupt(s) */ ++ + if (status & SONIC_INT_PKTRX) { + netif_dbg(lp, intr, dev, "%s: packet rx\n", __func__); + sonic_rx(dev); /* got packet(s) */ +- SONIC_WRITE(SONIC_ISR, SONIC_INT_PKTRX); /* clear the interrupt */ + } + + if (status & SONIC_INT_TXDN) { +@@ -300,11 +340,12 @@ static irqreturn_t sonic_interrupt(int irq, void *dev_id) + int td_status; + int freed_some = 0; + +- /* At this point, cur_tx is the index of a TD that is one of: +- * unallocated/freed (status set & tx_skb[entry] clear) +- * allocated and sent (status set & tx_skb[entry] set ) +- * allocated and not yet sent (status clear & tx_skb[entry] set ) +- * still being allocated by sonic_send_packet (status clear & tx_skb[entry] clear) ++ /* The state of a Transmit Descriptor may be inferred ++ * from { tx_skb[entry], td_status } as follows. ++ * { clear, clear } => the TD has never been used ++ * { set, clear } => the TD was handed to SONIC ++ * { set, set } => the TD was handed back ++ * { clear, set } => the TD is available for re-use + */ + + netif_dbg(lp, intr, dev, "%s: tx done\n", __func__); +@@ -313,18 +354,19 @@ static irqreturn_t sonic_interrupt(int irq, void *dev_id) + if ((td_status = sonic_tda_get(dev, entry, SONIC_TD_STATUS)) == 0) + break; + +- if (td_status & 0x0001) { ++ if (td_status & SONIC_TCR_PTX) { + lp->stats.tx_packets++; + lp->stats.tx_bytes += sonic_tda_get(dev, entry, SONIC_TD_PKTSIZE); + } else { +- lp->stats.tx_errors++; +- if (td_status & 0x0642) ++ if (td_status & (SONIC_TCR_EXD | ++ SONIC_TCR_EXC | SONIC_TCR_BCM)) + lp->stats.tx_aborted_errors++; +- if (td_status & 0x0180) ++ if (td_status & ++ (SONIC_TCR_NCRS | SONIC_TCR_CRLS)) + lp->stats.tx_carrier_errors++; +- if (td_status & 0x0020) ++ if (td_status & SONIC_TCR_OWC) + lp->stats.tx_window_errors++; +- if (td_status & 0x0004) ++ if (td_status & SONIC_TCR_FU) + lp->stats.tx_fifo_errors++; + } + +@@ -346,7 +388,6 @@ static irqreturn_t sonic_interrupt(int irq, void *dev_id) + if (freed_some || lp->tx_skb[entry] == NULL) + netif_wake_queue(dev); /* The ring is no longer full */ + lp->cur_tx = entry; +- SONIC_WRITE(SONIC_ISR, SONIC_INT_TXDN); /* clear the interrupt */ + } + + /* +@@ -355,42 +396,37 @@ static irqreturn_t sonic_interrupt(int irq, void *dev_id) + if (status & SONIC_INT_RFO) { + netif_dbg(lp, rx_err, dev, "%s: rx fifo overrun\n", + __func__); +- lp->stats.rx_fifo_errors++; +- SONIC_WRITE(SONIC_ISR, SONIC_INT_RFO); /* clear the interrupt */ + } + if (status & SONIC_INT_RDE) { + netif_dbg(lp, rx_err, dev, "%s: rx descriptors exhausted\n", + __func__); +- lp->stats.rx_dropped++; +- SONIC_WRITE(SONIC_ISR, SONIC_INT_RDE); /* clear the interrupt */ + } + if (status & SONIC_INT_RBAE) { + netif_dbg(lp, rx_err, dev, "%s: rx buffer area exceeded\n", + __func__); +- lp->stats.rx_dropped++; +- SONIC_WRITE(SONIC_ISR, SONIC_INT_RBAE); /* clear the interrupt */ + } + + /* counter overruns; all counters are 16bit wide */ +- if (status & SONIC_INT_FAE) { ++ if (status & SONIC_INT_FAE) + lp->stats.rx_frame_errors += 65536; +- SONIC_WRITE(SONIC_ISR, SONIC_INT_FAE); /* clear the interrupt */ +- } +- if (status & SONIC_INT_CRC) { ++ if (status & SONIC_INT_CRC) + lp->stats.rx_crc_errors += 65536; +- SONIC_WRITE(SONIC_ISR, SONIC_INT_CRC); /* clear the interrupt */ +- } +- if (status & SONIC_INT_MP) { ++ if (status & SONIC_INT_MP) + lp->stats.rx_missed_errors += 65536; +- SONIC_WRITE(SONIC_ISR, SONIC_INT_MP); /* clear the interrupt */ +- } + + /* transmit error */ + if (status & SONIC_INT_TXER) { +- if (SONIC_READ(SONIC_TCR) & SONIC_TCR_FU) +- netif_dbg(lp, tx_err, dev, "%s: tx fifo underrun\n", +- __func__); +- SONIC_WRITE(SONIC_ISR, SONIC_INT_TXER); /* clear the interrupt */ ++ u16 tcr = SONIC_READ(SONIC_TCR); ++ ++ netif_dbg(lp, tx_err, dev, "%s: TXER intr, TCR %04x\n", ++ __func__, tcr); ++ ++ if (tcr & (SONIC_TCR_EXD | SONIC_TCR_EXC | ++ SONIC_TCR_FU | SONIC_TCR_BCM)) { ++ /* Aborted transmission. Try again. */ ++ netif_stop_queue(dev); ++ SONIC_WRITE(SONIC_CMD, SONIC_CR_TXP); ++ } + } + + /* bus retry */ +@@ -400,107 +436,164 @@ static irqreturn_t sonic_interrupt(int irq, void *dev_id) + /* ... to help debug DMA problems causing endless interrupts. */ + /* Bounce the eth interface to turn on the interrupt again. */ + SONIC_WRITE(SONIC_IMR, 0); +- SONIC_WRITE(SONIC_ISR, SONIC_INT_BR); /* clear the interrupt */ + } + +- /* load CAM done */ +- if (status & SONIC_INT_LCD) +- SONIC_WRITE(SONIC_ISR, SONIC_INT_LCD); /* clear the interrupt */ +- } while((status = SONIC_READ(SONIC_ISR) & SONIC_IMR_DEFAULT)); ++ status = SONIC_READ(SONIC_ISR) & SONIC_IMR_DEFAULT; ++ } while (status); ++ ++ spin_unlock_irqrestore(&lp->lock, flags); ++ + return IRQ_HANDLED; + } + ++/* Return the array index corresponding to a given Receive Buffer pointer. */ ++static int index_from_addr(struct sonic_local *lp, dma_addr_t addr, ++ unsigned int last) ++{ ++ unsigned int i = last; ++ ++ do { ++ i = (i + 1) & SONIC_RRS_MASK; ++ if (addr == lp->rx_laddr[i]) ++ return i; ++ } while (i != last); ++ ++ return -ENOENT; ++} ++ ++/* Allocate and map a new skb to be used as a receive buffer. */ ++static bool sonic_alloc_rb(struct net_device *dev, struct sonic_local *lp, ++ struct sk_buff **new_skb, dma_addr_t *new_addr) ++{ ++ *new_skb = netdev_alloc_skb(dev, SONIC_RBSIZE + 2); ++ if (!*new_skb) ++ return false; ++ ++ if (SONIC_BUS_SCALE(lp->dma_bitmode) == 2) ++ skb_reserve(*new_skb, 2); ++ ++ *new_addr = dma_map_single(lp->device, skb_put(*new_skb, SONIC_RBSIZE), ++ SONIC_RBSIZE, DMA_FROM_DEVICE); ++ if (!*new_addr) { ++ dev_kfree_skb(*new_skb); ++ *new_skb = NULL; ++ return false; ++ } ++ ++ return true; ++} ++ ++/* Place a new receive resource in the Receive Resource Area and update RWP. */ ++static void sonic_update_rra(struct net_device *dev, struct sonic_local *lp, ++ dma_addr_t old_addr, dma_addr_t new_addr) ++{ ++ unsigned int entry = sonic_rr_entry(dev, SONIC_READ(SONIC_RWP)); ++ unsigned int end = sonic_rr_entry(dev, SONIC_READ(SONIC_RRP)); ++ u32 buf; ++ ++ /* The resources in the range [RRP, RWP) belong to the SONIC. This loop ++ * scans the other resources in the RRA, those in the range [RWP, RRP). ++ */ ++ do { ++ buf = (sonic_rra_get(dev, entry, SONIC_RR_BUFADR_H) << 16) | ++ sonic_rra_get(dev, entry, SONIC_RR_BUFADR_L); ++ ++ if (buf == old_addr) ++ break; ++ ++ entry = (entry + 1) & SONIC_RRS_MASK; ++ } while (entry != end); ++ ++ WARN_ONCE(buf != old_addr, "failed to find resource!\n"); ++ ++ sonic_rra_put(dev, entry, SONIC_RR_BUFADR_H, new_addr >> 16); ++ sonic_rra_put(dev, entry, SONIC_RR_BUFADR_L, new_addr & 0xffff); ++ ++ entry = (entry + 1) & SONIC_RRS_MASK; ++ ++ SONIC_WRITE(SONIC_RWP, sonic_rr_addr(dev, entry)); ++} ++ + /* + * We have a good packet(s), pass it/them up the network stack. + */ + static void sonic_rx(struct net_device *dev) + { + struct sonic_local *lp = netdev_priv(dev); +- int status; + int entry = lp->cur_rx; ++ int prev_entry = lp->eol_rx; ++ bool rbe = false; + + while (sonic_rda_get(dev, entry, SONIC_RD_IN_USE) == 0) { +- struct sk_buff *used_skb; +- struct sk_buff *new_skb; +- dma_addr_t new_laddr; +- u16 bufadr_l; +- u16 bufadr_h; +- int pkt_len; +- +- status = sonic_rda_get(dev, entry, SONIC_RD_STATUS); +- if (status & SONIC_RCR_PRX) { +- /* Malloc up new buffer. */ +- new_skb = netdev_alloc_skb(dev, SONIC_RBSIZE + 2); +- if (new_skb == NULL) { +- lp->stats.rx_dropped++; ++ u16 status = sonic_rda_get(dev, entry, SONIC_RD_STATUS); ++ ++ /* If the RD has LPKT set, the chip has finished with the RB */ ++ if ((status & SONIC_RCR_PRX) && (status & SONIC_RCR_LPKT)) { ++ struct sk_buff *new_skb; ++ dma_addr_t new_laddr; ++ u32 addr = (sonic_rda_get(dev, entry, ++ SONIC_RD_PKTPTR_H) << 16) | ++ sonic_rda_get(dev, entry, SONIC_RD_PKTPTR_L); ++ int i = index_from_addr(lp, addr, entry); ++ ++ if (i < 0) { ++ WARN_ONCE(1, "failed to find buffer!\n"); + break; + } +- /* provide 16 byte IP header alignment unless DMA requires otherwise */ +- if(SONIC_BUS_SCALE(lp->dma_bitmode) == 2) +- skb_reserve(new_skb, 2); +- +- new_laddr = dma_map_single(lp->device, skb_put(new_skb, SONIC_RBSIZE), +- SONIC_RBSIZE, DMA_FROM_DEVICE); +- if (!new_laddr) { +- dev_kfree_skb(new_skb); +- printk(KERN_ERR "%s: Failed to map rx buffer, dropping packet.\n", dev->name); ++ ++ if (sonic_alloc_rb(dev, lp, &new_skb, &new_laddr)) { ++ struct sk_buff *used_skb = lp->rx_skb[i]; ++ int pkt_len; ++ ++ /* Pass the used buffer up the stack */ ++ dma_unmap_single(lp->device, addr, SONIC_RBSIZE, ++ DMA_FROM_DEVICE); ++ ++ pkt_len = sonic_rda_get(dev, entry, ++ SONIC_RD_PKTLEN); ++ skb_trim(used_skb, pkt_len); ++ used_skb->protocol = eth_type_trans(used_skb, ++ dev); ++ netif_rx(used_skb); ++ lp->stats.rx_packets++; ++ lp->stats.rx_bytes += pkt_len; ++ ++ lp->rx_skb[i] = new_skb; ++ lp->rx_laddr[i] = new_laddr; ++ } else { ++ /* Failed to obtain a new buffer so re-use it */ ++ new_laddr = addr; + lp->stats.rx_dropped++; +- break; + } +- +- /* now we have a new skb to replace it, pass the used one up the stack */ +- dma_unmap_single(lp->device, lp->rx_laddr[entry], SONIC_RBSIZE, DMA_FROM_DEVICE); +- used_skb = lp->rx_skb[entry]; +- pkt_len = sonic_rda_get(dev, entry, SONIC_RD_PKTLEN); +- skb_trim(used_skb, pkt_len); +- used_skb->protocol = eth_type_trans(used_skb, dev); +- netif_rx(used_skb); +- lp->stats.rx_packets++; +- lp->stats.rx_bytes += pkt_len; +- +- /* and insert the new skb */ +- lp->rx_laddr[entry] = new_laddr; +- lp->rx_skb[entry] = new_skb; +- +- bufadr_l = (unsigned long)new_laddr & 0xffff; +- bufadr_h = (unsigned long)new_laddr >> 16; +- sonic_rra_put(dev, entry, SONIC_RR_BUFADR_L, bufadr_l); +- sonic_rra_put(dev, entry, SONIC_RR_BUFADR_H, bufadr_h); +- } else { +- /* This should only happen, if we enable accepting broken packets. */ +- lp->stats.rx_errors++; +- if (status & SONIC_RCR_FAER) +- lp->stats.rx_frame_errors++; +- if (status & SONIC_RCR_CRCR) +- lp->stats.rx_crc_errors++; +- } +- if (status & SONIC_RCR_LPKT) { +- /* +- * this was the last packet out of the current receive buffer +- * give the buffer back to the SONIC ++ /* If RBE is already asserted when RWP advances then ++ * it's safe to clear RBE after processing this packet. + */ +- lp->cur_rwp += SIZEOF_SONIC_RR * SONIC_BUS_SCALE(lp->dma_bitmode); +- if (lp->cur_rwp >= lp->rra_end) lp->cur_rwp = lp->rra_laddr & 0xffff; +- SONIC_WRITE(SONIC_RWP, lp->cur_rwp); +- if (SONIC_READ(SONIC_ISR) & SONIC_INT_RBE) { +- netif_dbg(lp, rx_err, dev, "%s: rx buffer exhausted\n", +- __func__); +- SONIC_WRITE(SONIC_ISR, SONIC_INT_RBE); /* clear the flag */ +- } +- } else +- printk(KERN_ERR "%s: rx desc without RCR_LPKT. Shouldn't happen !?\n", +- dev->name); ++ rbe = rbe || SONIC_READ(SONIC_ISR) & SONIC_INT_RBE; ++ sonic_update_rra(dev, lp, addr, new_laddr); ++ } + /* + * give back the descriptor + */ +- sonic_rda_put(dev, entry, SONIC_RD_LINK, +- sonic_rda_get(dev, entry, SONIC_RD_LINK) | SONIC_EOL); ++ sonic_rda_put(dev, entry, SONIC_RD_STATUS, 0); + sonic_rda_put(dev, entry, SONIC_RD_IN_USE, 1); +- sonic_rda_put(dev, lp->eol_rx, SONIC_RD_LINK, +- sonic_rda_get(dev, lp->eol_rx, SONIC_RD_LINK) & ~SONIC_EOL); +- lp->eol_rx = entry; +- lp->cur_rx = entry = (entry + 1) & SONIC_RDS_MASK; ++ ++ prev_entry = entry; ++ entry = (entry + 1) & SONIC_RDS_MASK; ++ } ++ ++ lp->cur_rx = entry; ++ ++ if (prev_entry != lp->eol_rx) { ++ /* Advance the EOL flag to put descriptors back into service */ ++ sonic_rda_put(dev, prev_entry, SONIC_RD_LINK, SONIC_EOL | ++ sonic_rda_get(dev, prev_entry, SONIC_RD_LINK)); ++ sonic_rda_put(dev, lp->eol_rx, SONIC_RD_LINK, ~SONIC_EOL & ++ sonic_rda_get(dev, lp->eol_rx, SONIC_RD_LINK)); ++ lp->eol_rx = prev_entry; + } ++ ++ if (rbe) ++ SONIC_WRITE(SONIC_ISR, SONIC_INT_RBE); + /* + * If any worth-while packets have been received, netif_rx() + * has done a mark_bh(NET_BH) for us and will work on them +@@ -550,6 +643,8 @@ static void sonic_multicast_list(struct net_device *dev) + (netdev_mc_count(dev) > 15)) { + rcr |= SONIC_RCR_AMC; + } else { ++ unsigned long flags; ++ + netif_dbg(lp, ifup, dev, "%s: mc_count %d\n", __func__, + netdev_mc_count(dev)); + sonic_set_cam_enable(dev, 1); /* always enable our own address */ +@@ -563,9 +658,14 @@ static void sonic_multicast_list(struct net_device *dev) + i++; + } + SONIC_WRITE(SONIC_CDC, 16); +- /* issue Load CAM command */ + SONIC_WRITE(SONIC_CDP, lp->cda_laddr & 0xffff); ++ ++ /* LCAM and TXP commands can't be used simultaneously */ ++ spin_lock_irqsave(&lp->lock, flags); ++ sonic_quiesce(dev, SONIC_CR_TXP); + SONIC_WRITE(SONIC_CMD, SONIC_CR_LCAM); ++ sonic_quiesce(dev, SONIC_CR_LCAM); ++ spin_unlock_irqrestore(&lp->lock, flags); + } + } + +@@ -580,7 +680,6 @@ static void sonic_multicast_list(struct net_device *dev) + */ + static int sonic_init(struct net_device *dev) + { +- unsigned int cmd; + struct sonic_local *lp = netdev_priv(dev); + int i; + +@@ -592,12 +691,16 @@ static int sonic_init(struct net_device *dev) + SONIC_WRITE(SONIC_ISR, 0x7fff); + SONIC_WRITE(SONIC_CMD, SONIC_CR_RST); + ++ /* While in reset mode, clear CAM Enable register */ ++ SONIC_WRITE(SONIC_CE, 0); ++ + /* + * clear software reset flag, disable receiver, clear and + * enable interrupts, then completely initialize the SONIC + */ + SONIC_WRITE(SONIC_CMD, 0); +- SONIC_WRITE(SONIC_CMD, SONIC_CR_RXDIS); ++ SONIC_WRITE(SONIC_CMD, SONIC_CR_RXDIS | SONIC_CR_STP); ++ sonic_quiesce(dev, SONIC_CR_ALL); + + /* + * initialize the receive resource area +@@ -615,15 +718,10 @@ static int sonic_init(struct net_device *dev) + } + + /* initialize all RRA registers */ +- lp->rra_end = (lp->rra_laddr + SONIC_NUM_RRS * SIZEOF_SONIC_RR * +- SONIC_BUS_SCALE(lp->dma_bitmode)) & 0xffff; +- lp->cur_rwp = (lp->rra_laddr + (SONIC_NUM_RRS - 1) * SIZEOF_SONIC_RR * +- SONIC_BUS_SCALE(lp->dma_bitmode)) & 0xffff; +- +- SONIC_WRITE(SONIC_RSA, lp->rra_laddr & 0xffff); +- SONIC_WRITE(SONIC_REA, lp->rra_end); +- SONIC_WRITE(SONIC_RRP, lp->rra_laddr & 0xffff); +- SONIC_WRITE(SONIC_RWP, lp->cur_rwp); ++ SONIC_WRITE(SONIC_RSA, sonic_rr_addr(dev, 0)); ++ SONIC_WRITE(SONIC_REA, sonic_rr_addr(dev, SONIC_NUM_RRS)); ++ SONIC_WRITE(SONIC_RRP, sonic_rr_addr(dev, 0)); ++ SONIC_WRITE(SONIC_RWP, sonic_rr_addr(dev, SONIC_NUM_RRS - 1)); + SONIC_WRITE(SONIC_URRA, lp->rra_laddr >> 16); + SONIC_WRITE(SONIC_EOBC, (SONIC_RBSIZE >> 1) - (lp->dma_bitmode ? 2 : 1)); + +@@ -631,14 +729,7 @@ static int sonic_init(struct net_device *dev) + netif_dbg(lp, ifup, dev, "%s: issuing RRRA command\n", __func__); + + SONIC_WRITE(SONIC_CMD, SONIC_CR_RRRA); +- i = 0; +- while (i++ < 100) { +- if (SONIC_READ(SONIC_CMD) & SONIC_CR_RRRA) +- break; +- } +- +- netif_dbg(lp, ifup, dev, "%s: status=%x, i=%d\n", __func__, +- SONIC_READ(SONIC_CMD), i); ++ sonic_quiesce(dev, SONIC_CR_RRRA); + + /* + * Initialize the receive descriptors so that they +@@ -713,28 +804,17 @@ static int sonic_init(struct net_device *dev) + * load the CAM + */ + SONIC_WRITE(SONIC_CMD, SONIC_CR_LCAM); +- +- i = 0; +- while (i++ < 100) { +- if (SONIC_READ(SONIC_ISR) & SONIC_INT_LCD) +- break; +- } +- netif_dbg(lp, ifup, dev, "%s: CMD=%x, ISR=%x, i=%d\n", __func__, +- SONIC_READ(SONIC_CMD), SONIC_READ(SONIC_ISR), i); ++ sonic_quiesce(dev, SONIC_CR_LCAM); + + /* + * enable receiver, disable loopback + * and enable all interrupts + */ +- SONIC_WRITE(SONIC_CMD, SONIC_CR_RXEN | SONIC_CR_STP); + SONIC_WRITE(SONIC_RCR, SONIC_RCR_DEFAULT); + SONIC_WRITE(SONIC_TCR, SONIC_TCR_DEFAULT); + SONIC_WRITE(SONIC_ISR, 0x7fff); + SONIC_WRITE(SONIC_IMR, SONIC_IMR_DEFAULT); +- +- cmd = SONIC_READ(SONIC_CMD); +- if ((cmd & SONIC_CR_RXEN) == 0 || (cmd & SONIC_CR_STP) == 0) +- printk(KERN_ERR "sonic_init: failed, status=%x\n", cmd); ++ SONIC_WRITE(SONIC_CMD, SONIC_CR_RXEN); + + netif_dbg(lp, ifup, dev, "%s: new status=%x\n", __func__, + SONIC_READ(SONIC_CMD)); +diff --git a/drivers/net/ethernet/natsemi/sonic.h b/drivers/net/ethernet/natsemi/sonic.h +index 2b27f7049acb..1df6d2f06cc4 100644 +--- a/drivers/net/ethernet/natsemi/sonic.h ++++ b/drivers/net/ethernet/natsemi/sonic.h +@@ -110,6 +110,9 @@ + #define SONIC_CR_TXP 0x0002 + #define SONIC_CR_HTX 0x0001 + ++#define SONIC_CR_ALL (SONIC_CR_LCAM | SONIC_CR_RRRA | \ ++ SONIC_CR_RXEN | SONIC_CR_TXP) ++ + /* + * SONIC data configuration bits + */ +@@ -175,6 +178,7 @@ + #define SONIC_TCR_NCRS 0x0100 + #define SONIC_TCR_CRLS 0x0080 + #define SONIC_TCR_EXC 0x0040 ++#define SONIC_TCR_OWC 0x0020 + #define SONIC_TCR_PMB 0x0008 + #define SONIC_TCR_FU 0x0004 + #define SONIC_TCR_BCM 0x0002 +@@ -274,8 +278,9 @@ + #define SONIC_NUM_RDS SONIC_NUM_RRS /* number of receive descriptors */ + #define SONIC_NUM_TDS 16 /* number of transmit descriptors */ + +-#define SONIC_RDS_MASK (SONIC_NUM_RDS-1) +-#define SONIC_TDS_MASK (SONIC_NUM_TDS-1) ++#define SONIC_RRS_MASK (SONIC_NUM_RRS - 1) ++#define SONIC_RDS_MASK (SONIC_NUM_RDS - 1) ++#define SONIC_TDS_MASK (SONIC_NUM_TDS - 1) + + #define SONIC_RBSIZE 1520 /* size of one resource buffer */ + +@@ -312,8 +317,6 @@ struct sonic_local { + u32 rda_laddr; /* logical DMA address of RDA */ + dma_addr_t rx_laddr[SONIC_NUM_RRS]; /* logical DMA addresses of rx skbuffs */ + dma_addr_t tx_laddr[SONIC_NUM_TDS]; /* logical DMA addresses of tx skbuffs */ +- unsigned int rra_end; +- unsigned int cur_rwp; + unsigned int cur_rx; + unsigned int cur_tx; /* first unacked transmit packet */ + unsigned int eol_rx; +@@ -322,6 +325,7 @@ struct sonic_local { + int msg_enable; + struct device *device; /* generic device */ + struct net_device_stats stats; ++ spinlock_t lock; + }; + + #define TX_TIMEOUT (3 * HZ) +@@ -344,30 +348,30 @@ static void sonic_msg_init(struct net_device *dev); + as far as we can tell. */ + /* OpenBSD calls this "SWO". I'd like to think that sonic_buf_put() + is a much better name. */ +-static inline void sonic_buf_put(void* base, int bitmode, ++static inline void sonic_buf_put(u16 *base, int bitmode, + int offset, __u16 val) + { + if (bitmode) + #ifdef __BIG_ENDIAN +- ((__u16 *) base + (offset*2))[1] = val; ++ __raw_writew(val, base + (offset * 2) + 1); + #else +- ((__u16 *) base + (offset*2))[0] = val; ++ __raw_writew(val, base + (offset * 2) + 0); + #endif + else +- ((__u16 *) base)[offset] = val; ++ __raw_writew(val, base + (offset * 1) + 0); + } + +-static inline __u16 sonic_buf_get(void* base, int bitmode, ++static inline __u16 sonic_buf_get(u16 *base, int bitmode, + int offset) + { + if (bitmode) + #ifdef __BIG_ENDIAN +- return ((volatile __u16 *) base + (offset*2))[1]; ++ return __raw_readw(base + (offset * 2) + 1); + #else +- return ((volatile __u16 *) base + (offset*2))[0]; ++ return __raw_readw(base + (offset * 2) + 0); + #endif + else +- return ((volatile __u16 *) base)[offset]; ++ return __raw_readw(base + (offset * 1) + 0); + } + + /* Inlines that you should actually use for reading/writing DMA buffers */ +@@ -447,6 +451,22 @@ static inline __u16 sonic_rra_get(struct net_device* dev, int entry, + (entry * SIZEOF_SONIC_RR) + offset); + } + ++static inline u16 sonic_rr_addr(struct net_device *dev, int entry) ++{ ++ struct sonic_local *lp = netdev_priv(dev); ++ ++ return lp->rra_laddr + ++ entry * SIZEOF_SONIC_RR * SONIC_BUS_SCALE(lp->dma_bitmode); ++} ++ ++static inline u16 sonic_rr_entry(struct net_device *dev, u16 addr) ++{ ++ struct sonic_local *lp = netdev_priv(dev); ++ ++ return (addr - (u16)lp->rra_laddr) / (SIZEOF_SONIC_RR * ++ SONIC_BUS_SCALE(lp->dma_bitmode)); ++} ++ + static const char version[] = + "sonic.c:v0.92 20.9.98 tsbogend@alpha.franken.de\n"; + +diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c +index f6222ada6818..9b3ba98726d7 100644 +--- a/drivers/net/gtp.c ++++ b/drivers/net/gtp.c +@@ -804,19 +804,21 @@ static struct sock *gtp_encap_enable_socket(int fd, int type, + return NULL; + } + +- if (sock->sk->sk_protocol != IPPROTO_UDP) { ++ sk = sock->sk; ++ if (sk->sk_protocol != IPPROTO_UDP || ++ sk->sk_type != SOCK_DGRAM || ++ (sk->sk_family != AF_INET && sk->sk_family != AF_INET6)) { + pr_debug("socket fd=%d not UDP\n", fd); + sk = ERR_PTR(-EINVAL); + goto out_sock; + } + +- lock_sock(sock->sk); +- if (sock->sk->sk_user_data) { ++ lock_sock(sk); ++ if (sk->sk_user_data) { + sk = ERR_PTR(-EBUSY); + goto out_rel_sock; + } + +- sk = sock->sk; + sock_hold(sk); + + tuncfg.sk_user_data = gtp; +diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c +index 2a91c192659f..61d7e0d1d77d 100644 +--- a/drivers/net/slip/slip.c ++++ b/drivers/net/slip/slip.c +@@ -452,9 +452,16 @@ static void slip_transmit(struct work_struct *work) + */ + static void slip_write_wakeup(struct tty_struct *tty) + { +- struct slip *sl = tty->disc_data; ++ struct slip *sl; ++ ++ rcu_read_lock(); ++ sl = rcu_dereference(tty->disc_data); ++ if (!sl) ++ goto out; + + schedule_work(&sl->tx_work); ++out: ++ rcu_read_unlock(); + } + + static void sl_tx_timeout(struct net_device *dev) +@@ -882,10 +889,11 @@ static void slip_close(struct tty_struct *tty) + return; + + spin_lock_bh(&sl->lock); +- tty->disc_data = NULL; ++ rcu_assign_pointer(tty->disc_data, NULL); + sl->tty = NULL; + spin_unlock_bh(&sl->lock); + ++ synchronize_rcu(); + flush_work(&sl->tx_work); + + /* VSV = very important to remove timers */ +diff --git a/drivers/net/tun.c b/drivers/net/tun.c +index 16564ebcde50..69f553a028ee 100644 +--- a/drivers/net/tun.c ++++ b/drivers/net/tun.c +@@ -1936,6 +1936,10 @@ drop: + if (ret != XDP_PASS) { + rcu_read_unlock(); + local_bh_enable(); ++ if (frags) { ++ tfile->napi.skb = NULL; ++ mutex_unlock(&tfile->napi_mutex); ++ } + return total_len; + } + } +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c +index c232f1612083..0170a441208a 100644 +--- a/drivers/net/usb/lan78xx.c ++++ b/drivers/net/usb/lan78xx.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -3668,6 +3669,19 @@ static void lan78xx_tx_timeout(struct net_device *net) + tasklet_schedule(&dev->bh); + } + ++static netdev_features_t lan78xx_features_check(struct sk_buff *skb, ++ struct net_device *netdev, ++ netdev_features_t features) ++{ ++ if (skb->len + TX_OVERHEAD > MAX_SINGLE_PACKET_SIZE) ++ features &= ~NETIF_F_GSO_MASK; ++ ++ features = vlan_features_check(skb, features); ++ features = vxlan_features_check(skb, features); ++ ++ return features; ++} ++ + static const struct net_device_ops lan78xx_netdev_ops = { + .ndo_open = lan78xx_open, + .ndo_stop = lan78xx_stop, +@@ -3681,6 +3695,7 @@ static const struct net_device_ops lan78xx_netdev_ops = { + .ndo_set_features = lan78xx_set_features, + .ndo_vlan_rx_add_vid = lan78xx_vlan_rx_add_vid, + .ndo_vlan_rx_kill_vid = lan78xx_vlan_rx_kill_vid, ++ .ndo_features_check = lan78xx_features_check, + }; + + static void lan78xx_stat_monitor(struct timer_list *t) +diff --git a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c +index f43c06569ea1..c4c8f1b62e1e 100644 +--- a/drivers/net/wireless/cisco/airo.c ++++ b/drivers/net/wireless/cisco/airo.c +@@ -7790,16 +7790,8 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) { + case AIROGVLIST: ridcode = RID_APLIST; break; + case AIROGDRVNAM: ridcode = RID_DRVNAME; break; + case AIROGEHTENC: ridcode = RID_ETHERENCAP; break; +- case AIROGWEPKTMP: ridcode = RID_WEP_TEMP; +- /* Only super-user can read WEP keys */ +- if (!capable(CAP_NET_ADMIN)) +- return -EPERM; +- break; +- case AIROGWEPKNV: ridcode = RID_WEP_PERM; +- /* Only super-user can read WEP keys */ +- if (!capable(CAP_NET_ADMIN)) +- return -EPERM; +- break; ++ case AIROGWEPKTMP: ridcode = RID_WEP_TEMP; break; ++ case AIROGWEPKNV: ridcode = RID_WEP_PERM; break; + case AIROGSTAT: ridcode = RID_STATUS; break; + case AIROGSTATSD32: ridcode = RID_STATSDELTA; break; + case AIROGSTATSC32: ridcode = RID_STATS; break; +@@ -7813,7 +7805,13 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) { + return -EINVAL; + } + +- if ((iobuf = kmalloc(RIDSIZE, GFP_KERNEL)) == NULL) ++ if (ridcode == RID_WEP_TEMP || ridcode == RID_WEP_PERM) { ++ /* Only super-user can read WEP keys */ ++ if (!capable(CAP_NET_ADMIN)) ++ return -EPERM; ++ } ++ ++ if ((iobuf = kzalloc(RIDSIZE, GFP_KERNEL)) == NULL) + return -ENOMEM; + + PC4500_readrid(ai,ridcode,iobuf,RIDSIZE, 1); +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/constants.h b/drivers/net/wireless/intel/iwlwifi/mvm/constants.h +index 60aff2ecec12..58df25e2fb32 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/constants.h ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/constants.h +@@ -154,5 +154,6 @@ + #define IWL_MVM_D3_DEBUG false + #define IWL_MVM_USE_TWT false + #define IWL_MVM_AMPDU_CONSEC_DROPS_DELBA 10 ++#define IWL_MVM_USE_NSSN_SYNC 0 + + #endif /* __MVM_CONSTANTS_H */ +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +index d31f96c3f925..49aeab7c27a2 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +@@ -742,6 +742,20 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) + return ret; + } + ++static void iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb, ++ struct ieee80211_sta *sta) ++{ ++ if (likely(sta)) { ++ if (likely(iwl_mvm_tx_skb_sta(mvm, skb, sta) == 0)) ++ return; ++ } else { ++ if (likely(iwl_mvm_tx_skb_non_sta(mvm, skb) == 0)) ++ return; ++ } ++ ++ ieee80211_free_txskb(mvm->hw, skb); ++} ++ + static void iwl_mvm_mac_tx(struct ieee80211_hw *hw, + struct ieee80211_tx_control *control, + struct sk_buff *skb) +@@ -785,14 +799,7 @@ static void iwl_mvm_mac_tx(struct ieee80211_hw *hw, + } + } + +- if (sta) { +- if (iwl_mvm_tx_skb(mvm, skb, sta)) +- goto drop; +- return; +- } +- +- if (iwl_mvm_tx_skb_non_sta(mvm, skb)) +- goto drop; ++ iwl_mvm_tx_skb(mvm, skb, sta); + return; + drop: + ieee80211_free_txskb(hw, skb); +@@ -842,10 +849,7 @@ void iwl_mvm_mac_itxq_xmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq) + break; + } + +- if (!txq->sta) +- iwl_mvm_tx_skb_non_sta(mvm, skb); +- else +- iwl_mvm_tx_skb(mvm, skb, txq->sta); ++ iwl_mvm_tx_skb(mvm, skb, txq->sta); + } + } while (atomic_dec_return(&mvmtxq->tx_request)); + rcu_read_unlock(); +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +index 5ca50f39a023..5f1ecbb6fb71 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +@@ -1508,8 +1508,8 @@ int __must_check iwl_mvm_send_cmd_status(struct iwl_mvm *mvm, + int __must_check iwl_mvm_send_cmd_pdu_status(struct iwl_mvm *mvm, u32 id, + u16 len, const void *data, + u32 *status); +-int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb, +- struct ieee80211_sta *sta); ++int iwl_mvm_tx_skb_sta(struct iwl_mvm *mvm, struct sk_buff *skb, ++ struct ieee80211_sta *sta); + int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb); + void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb, + struct iwl_tx_cmd *tx_cmd, +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +index 77b03b757193..a6e2a30eb310 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +@@ -514,14 +514,17 @@ static bool iwl_mvm_is_sn_less(u16 sn1, u16 sn2, u16 buffer_size) + + static void iwl_mvm_sync_nssn(struct iwl_mvm *mvm, u8 baid, u16 nssn) + { +- struct iwl_mvm_rss_sync_notif notif = { +- .metadata.type = IWL_MVM_RXQ_NSSN_SYNC, +- .metadata.sync = 0, +- .nssn_sync.baid = baid, +- .nssn_sync.nssn = nssn, +- }; +- +- iwl_mvm_sync_rx_queues_internal(mvm, (void *)¬if, sizeof(notif)); ++ if (IWL_MVM_USE_NSSN_SYNC) { ++ struct iwl_mvm_rss_sync_notif notif = { ++ .metadata.type = IWL_MVM_RXQ_NSSN_SYNC, ++ .metadata.sync = 0, ++ .nssn_sync.baid = baid, ++ .nssn_sync.nssn = nssn, ++ }; ++ ++ iwl_mvm_sync_rx_queues_internal(mvm, (void *)¬if, ++ sizeof(notif)); ++ } + } + + #define RX_REORDER_BUF_TIMEOUT_MQ (HZ / 10) +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +index fcafa22ec6ce..8aa567d7912c 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +@@ -1220,7 +1220,7 @@ static int iwl_mvm_legacy_config_scan(struct iwl_mvm *mvm) + cmd_size = sizeof(struct iwl_scan_config_v2); + else + cmd_size = sizeof(struct iwl_scan_config_v1); +- cmd_size += num_channels; ++ cmd_size += mvm->fw->ucode_capa.n_scan_channels; + + cfg = kzalloc(cmd_size, GFP_KERNEL); + if (!cfg) +diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +index e3b2a2bf3863..d9d82f6b5e87 100644 +--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +@@ -1151,7 +1151,7 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb, + if (WARN_ONCE(txq_id == IWL_MVM_INVALID_QUEUE, "Invalid TXQ id")) { + iwl_trans_free_tx_cmd(mvm->trans, dev_cmd); + spin_unlock(&mvmsta->lock); +- return 0; ++ return -1; + } + + if (!iwl_mvm_has_new_tx_api(mvm)) { +@@ -1203,8 +1203,8 @@ drop: + return -1; + } + +-int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb, +- struct ieee80211_sta *sta) ++int iwl_mvm_tx_skb_sta(struct iwl_mvm *mvm, struct sk_buff *skb, ++ struct ieee80211_sta *sta) + { + struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); + struct ieee80211_tx_info info; +diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c +index 041dd75ac72b..64c74acadb99 100644 +--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c ++++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c +@@ -1537,13 +1537,13 @@ out: + + napi = &rxq->napi; + if (napi->poll) { ++ napi_gro_flush(napi, false); ++ + if (napi->rx_count) { + netif_receive_skb_list(&napi->rx_list); + INIT_LIST_HEAD(&napi->rx_list); + napi->rx_count = 0; + } +- +- napi_gro_flush(napi, false); + } + + iwl_pcie_rxq_restock(trans, rxq); +diff --git a/drivers/net/wireless/marvell/libertas/cfg.c b/drivers/net/wireless/marvell/libertas/cfg.c +index 57edfada0665..c9401c121a14 100644 +--- a/drivers/net/wireless/marvell/libertas/cfg.c ++++ b/drivers/net/wireless/marvell/libertas/cfg.c +@@ -273,6 +273,10 @@ add_ie_rates(u8 *tlv, const u8 *ie, int *nrates) + int hw, ap, ap_max = ie[1]; + u8 hw_rate; + ++ if (ap_max > MAX_RATES) { ++ lbs_deb_assoc("invalid rates\n"); ++ return tlv; ++ } + /* Advance past IE header */ + ie += 2; + +@@ -1717,6 +1721,9 @@ static int lbs_ibss_join_existing(struct lbs_private *priv, + struct cmd_ds_802_11_ad_hoc_join cmd; + u8 preamble = RADIO_PREAMBLE_SHORT; + int ret = 0; ++ int hw, i; ++ u8 rates_max; ++ u8 *rates; + + /* TODO: set preamble based on scan result */ + ret = lbs_set_radio(priv, preamble, 1); +@@ -1775,9 +1782,12 @@ static int lbs_ibss_join_existing(struct lbs_private *priv, + if (!rates_eid) { + lbs_add_rates(cmd.bss.rates); + } else { +- int hw, i; +- u8 rates_max = rates_eid[1]; +- u8 *rates = cmd.bss.rates; ++ rates_max = rates_eid[1]; ++ if (rates_max > MAX_RATES) { ++ lbs_deb_join("invalid rates"); ++ goto out; ++ } ++ rates = cmd.bss.rates; + for (hw = 0; hw < ARRAY_SIZE(lbs_rates); hw++) { + u8 hw_rate = lbs_rates[hw].bitrate / 5; + for (i = 0; i < rates_max; i++) { +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c +index 308f744393eb..1593b8494ebb 100644 +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -5021,18 +5021,25 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, 0x0422, quirk_no_ext_tags); + + #ifdef CONFIG_PCI_ATS + /* +- * Some devices have a broken ATS implementation causing IOMMU stalls. +- * Don't use ATS for those devices. ++ * Some devices require additional driver setup to enable ATS. Don't use ++ * ATS for those devices as ATS will be enabled before the driver has had a ++ * chance to load and configure the device. + */ +-static void quirk_no_ats(struct pci_dev *pdev) ++static void quirk_amd_harvest_no_ats(struct pci_dev *pdev) + { +- pci_info(pdev, "disabling ATS (broken on this device)\n"); ++ if (pdev->device == 0x7340 && pdev->revision != 0xc5) ++ return; ++ ++ pci_info(pdev, "disabling ATS\n"); + pdev->ats_cap = 0; + } + + /* AMD Stoney platform GPU */ +-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x98e4, quirk_no_ats); +-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x6900, quirk_no_ats); ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x98e4, quirk_amd_harvest_no_ats); ++/* AMD Iceland dGPU */ ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x6900, quirk_amd_harvest_no_ats); ++/* AMD Navi14 dGPU */ ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7340, quirk_amd_harvest_no_ats); + #endif /* CONFIG_PCI_ATS */ + + /* Freescale PCIe doesn't support MSI in RC mode */ +diff --git a/drivers/pinctrl/intel/pinctrl-sunrisepoint.c b/drivers/pinctrl/intel/pinctrl-sunrisepoint.c +index 44d7f50bbc82..d936e7aa74c4 100644 +--- a/drivers/pinctrl/intel/pinctrl-sunrisepoint.c ++++ b/drivers/pinctrl/intel/pinctrl-sunrisepoint.c +@@ -49,6 +49,7 @@ + .padown_offset = SPT_PAD_OWN, \ + .padcfglock_offset = SPT_PADCFGLOCK, \ + .hostown_offset = SPT_HOSTSW_OWN, \ ++ .is_offset = SPT_GPI_IS, \ + .ie_offset = SPT_GPI_IE, \ + .pin_base = (s), \ + .npins = ((e) - (s) + 1), \ +diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c +index f194ffc4699e..c070cb2a6a5b 100644 +--- a/drivers/target/iscsi/iscsi_target.c ++++ b/drivers/target/iscsi/iscsi_target.c +@@ -4151,9 +4151,6 @@ int iscsit_close_connection( + iscsit_stop_nopin_response_timer(conn); + iscsit_stop_nopin_timer(conn); + +- if (conn->conn_transport->iscsit_wait_conn) +- conn->conn_transport->iscsit_wait_conn(conn); +- + /* + * During Connection recovery drop unacknowledged out of order + * commands for this connection, and prepare the other commands +@@ -4239,6 +4236,9 @@ int iscsit_close_connection( + target_sess_cmd_list_set_waiting(sess->se_sess); + target_wait_for_sess_cmds(sess->se_sess); + ++ if (conn->conn_transport->iscsit_wait_conn) ++ conn->conn_transport->iscsit_wait_conn(conn); ++ + ahash_request_free(conn->conn_tx_hash); + if (conn->conn_rx_hash) { + struct crypto_ahash *tfm; +diff --git a/fs/afs/cell.c b/fs/afs/cell.c +index fd5133e26a38..78ba5f932287 100644 +--- a/fs/afs/cell.c ++++ b/fs/afs/cell.c +@@ -134,8 +134,17 @@ static struct afs_cell *afs_alloc_cell(struct afs_net *net, + _leave(" = -ENAMETOOLONG"); + return ERR_PTR(-ENAMETOOLONG); + } +- if (namelen == 5 && memcmp(name, "@cell", 5) == 0) ++ ++ /* Prohibit cell names that contain unprintable chars, '/' and '@' or ++ * that begin with a dot. This also precludes "@cell". ++ */ ++ if (name[0] == '.') + return ERR_PTR(-EINVAL); ++ for (i = 0; i < namelen; i++) { ++ char ch = name[i]; ++ if (!isprint(ch) || ch == '/' || ch == '@') ++ return ERR_PTR(-EINVAL); ++ } + + _enter("%*.*s,%s", namelen, namelen, name, addresses); + +diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c +index a5163296d9d9..ee02a742fff5 100644 +--- a/fs/ceph/mds_client.c ++++ b/fs/ceph/mds_client.c +@@ -708,8 +708,10 @@ void ceph_mdsc_release_request(struct kref *kref) + /* avoid calling iput_final() in mds dispatch threads */ + ceph_async_iput(req->r_inode); + } +- if (req->r_parent) ++ if (req->r_parent) { + ceph_put_cap_refs(ceph_inode(req->r_parent), CEPH_CAP_PIN); ++ ceph_async_iput(req->r_parent); ++ } + ceph_async_iput(req->r_target_inode); + if (req->r_dentry) + dput(req->r_dentry); +@@ -2670,8 +2672,10 @@ int ceph_mdsc_submit_request(struct ceph_mds_client *mdsc, struct inode *dir, + /* take CAP_PIN refs for r_inode, r_parent, r_old_dentry */ + if (req->r_inode) + ceph_get_cap_refs(ceph_inode(req->r_inode), CEPH_CAP_PIN); +- if (req->r_parent) ++ if (req->r_parent) { + ceph_get_cap_refs(ceph_inode(req->r_parent), CEPH_CAP_PIN); ++ ihold(req->r_parent); ++ } + if (req->r_old_dentry_dir) + ceph_get_cap_refs(ceph_inode(req->r_old_dentry_dir), + CEPH_CAP_PIN); +diff --git a/fs/io_uring.c b/fs/io_uring.c +index b1c9ad1fb9e1..709671faaed6 100644 +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -3716,12 +3716,6 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, + wake_up(&ctx->sqo_wait); + submitted = to_submit; + } else if (to_submit) { +- if (current->mm != ctx->sqo_mm || +- current_cred() != ctx->creds) { +- ret = -EPERM; +- goto out; +- } +- + to_submit = min(to_submit, ctx->sq_entries); + + mutex_lock(&ctx->uring_lock); +diff --git a/fs/namei.c b/fs/namei.c +index 671c3c1a3425..e81521c87f98 100644 +--- a/fs/namei.c ++++ b/fs/namei.c +@@ -1001,7 +1001,8 @@ static int may_linkat(struct path *link) + * may_create_in_sticky - Check whether an O_CREAT open in a sticky directory + * should be allowed, or not, on files that already + * exist. +- * @dir: the sticky parent directory ++ * @dir_mode: mode bits of directory ++ * @dir_uid: owner of directory + * @inode: the inode of the file to open + * + * Block an O_CREAT open of a FIFO (or a regular file) when: +@@ -1017,18 +1018,18 @@ static int may_linkat(struct path *link) + * + * Returns 0 if the open is allowed, -ve on error. + */ +-static int may_create_in_sticky(struct dentry * const dir, ++static int may_create_in_sticky(umode_t dir_mode, kuid_t dir_uid, + struct inode * const inode) + { + if ((!sysctl_protected_fifos && S_ISFIFO(inode->i_mode)) || + (!sysctl_protected_regular && S_ISREG(inode->i_mode)) || +- likely(!(dir->d_inode->i_mode & S_ISVTX)) || +- uid_eq(inode->i_uid, dir->d_inode->i_uid) || ++ likely(!(dir_mode & S_ISVTX)) || ++ uid_eq(inode->i_uid, dir_uid) || + uid_eq(current_fsuid(), inode->i_uid)) + return 0; + +- if (likely(dir->d_inode->i_mode & 0002) || +- (dir->d_inode->i_mode & 0020 && ++ if (likely(dir_mode & 0002) || ++ (dir_mode & 0020 && + ((sysctl_protected_fifos >= 2 && S_ISFIFO(inode->i_mode)) || + (sysctl_protected_regular >= 2 && S_ISREG(inode->i_mode))))) { + return -EACCES; +@@ -3248,6 +3249,8 @@ static int do_last(struct nameidata *nd, + struct file *file, const struct open_flags *op) + { + struct dentry *dir = nd->path.dentry; ++ kuid_t dir_uid = dir->d_inode->i_uid; ++ umode_t dir_mode = dir->d_inode->i_mode; + int open_flag = op->open_flag; + bool will_truncate = (open_flag & O_TRUNC) != 0; + bool got_write = false; +@@ -3383,7 +3386,7 @@ finish_open: + error = -EISDIR; + if (d_is_dir(nd->path.dentry)) + goto out; +- error = may_create_in_sticky(dir, ++ error = may_create_in_sticky(dir_mode, dir_uid, + d_backing_inode(nd->path.dentry)); + if (unlikely(error)) + goto out; +diff --git a/fs/readdir.c b/fs/readdir.c +index d26d5ea4de7b..de2eceffdee8 100644 +--- a/fs/readdir.c ++++ b/fs/readdir.c +@@ -102,10 +102,14 @@ EXPORT_SYMBOL(iterate_dir); + * filename length, and the above "soft error" worry means + * that it's probably better left alone until we have that + * issue clarified. ++ * ++ * Note the PATH_MAX check - it's arbitrary but the real ++ * kernel limit on a possible path component, not NAME_MAX, ++ * which is the technical standard limit. + */ + static int verify_dirent_name(const char *name, int len) + { +- if (!len) ++ if (len <= 0 || len >= PATH_MAX) + return -EIO; + if (memchr(name, '/', len)) + return -EIO; +@@ -206,7 +210,7 @@ struct linux_dirent { + struct getdents_callback { + struct dir_context ctx; + struct linux_dirent __user * current_dir; +- struct linux_dirent __user * previous; ++ int prev_reclen; + int count; + int error; + }; +@@ -214,12 +218,13 @@ struct getdents_callback { + static int filldir(struct dir_context *ctx, const char *name, int namlen, + loff_t offset, u64 ino, unsigned int d_type) + { +- struct linux_dirent __user * dirent; ++ struct linux_dirent __user *dirent, *prev; + struct getdents_callback *buf = + container_of(ctx, struct getdents_callback, ctx); + unsigned long d_ino; + int reclen = ALIGN(offsetof(struct linux_dirent, d_name) + namlen + 2, + sizeof(long)); ++ int prev_reclen; + + buf->error = verify_dirent_name(name, namlen); + if (unlikely(buf->error)) +@@ -232,28 +237,24 @@ static int filldir(struct dir_context *ctx, const char *name, int namlen, + buf->error = -EOVERFLOW; + return -EOVERFLOW; + } +- dirent = buf->previous; +- if (dirent && signal_pending(current)) ++ prev_reclen = buf->prev_reclen; ++ if (prev_reclen && signal_pending(current)) + return -EINTR; +- +- /* +- * Note! This range-checks 'previous' (which may be NULL). +- * The real range was checked in getdents +- */ +- if (!user_access_begin(dirent, sizeof(*dirent))) +- goto efault; +- if (dirent) +- unsafe_put_user(offset, &dirent->d_off, efault_end); + dirent = buf->current_dir; ++ prev = (void __user *) dirent - prev_reclen; ++ if (!user_access_begin(prev, reclen + prev_reclen)) ++ goto efault; ++ ++ /* This might be 'dirent->d_off', but if so it will get overwritten */ ++ unsafe_put_user(offset, &prev->d_off, efault_end); + unsafe_put_user(d_ino, &dirent->d_ino, efault_end); + unsafe_put_user(reclen, &dirent->d_reclen, efault_end); + unsafe_put_user(d_type, (char __user *) dirent + reclen - 1, efault_end); + unsafe_copy_dirent_name(dirent->d_name, name, namlen, efault_end); + user_access_end(); + +- buf->previous = dirent; +- dirent = (void __user *)dirent + reclen; +- buf->current_dir = dirent; ++ buf->current_dir = (void __user *)dirent + reclen; ++ buf->prev_reclen = reclen; + buf->count -= reclen; + return 0; + efault_end: +@@ -267,7 +268,6 @@ SYSCALL_DEFINE3(getdents, unsigned int, fd, + struct linux_dirent __user *, dirent, unsigned int, count) + { + struct fd f; +- struct linux_dirent __user * lastdirent; + struct getdents_callback buf = { + .ctx.actor = filldir, + .count = count, +@@ -285,8 +285,10 @@ SYSCALL_DEFINE3(getdents, unsigned int, fd, + error = iterate_dir(f.file, &buf.ctx); + if (error >= 0) + error = buf.error; +- lastdirent = buf.previous; +- if (lastdirent) { ++ if (buf.prev_reclen) { ++ struct linux_dirent __user * lastdirent; ++ lastdirent = (void __user *)buf.current_dir - buf.prev_reclen; ++ + if (put_user(buf.ctx.pos, &lastdirent->d_off)) + error = -EFAULT; + else +@@ -299,7 +301,7 @@ SYSCALL_DEFINE3(getdents, unsigned int, fd, + struct getdents_callback64 { + struct dir_context ctx; + struct linux_dirent64 __user * current_dir; +- struct linux_dirent64 __user * previous; ++ int prev_reclen; + int count; + int error; + }; +@@ -307,11 +309,12 @@ struct getdents_callback64 { + static int filldir64(struct dir_context *ctx, const char *name, int namlen, + loff_t offset, u64 ino, unsigned int d_type) + { +- struct linux_dirent64 __user *dirent; ++ struct linux_dirent64 __user *dirent, *prev; + struct getdents_callback64 *buf = + container_of(ctx, struct getdents_callback64, ctx); + int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1, + sizeof(u64)); ++ int prev_reclen; + + buf->error = verify_dirent_name(name, namlen); + if (unlikely(buf->error)) +@@ -319,30 +322,27 @@ static int filldir64(struct dir_context *ctx, const char *name, int namlen, + buf->error = -EINVAL; /* only used if we fail.. */ + if (reclen > buf->count) + return -EINVAL; +- dirent = buf->previous; +- if (dirent && signal_pending(current)) ++ prev_reclen = buf->prev_reclen; ++ if (prev_reclen && signal_pending(current)) + return -EINTR; +- +- /* +- * Note! This range-checks 'previous' (which may be NULL). +- * The real range was checked in getdents +- */ +- if (!user_access_begin(dirent, sizeof(*dirent))) +- goto efault; +- if (dirent) +- unsafe_put_user(offset, &dirent->d_off, efault_end); + dirent = buf->current_dir; ++ prev = (void __user *)dirent - prev_reclen; ++ if (!user_access_begin(prev, reclen + prev_reclen)) ++ goto efault; ++ ++ /* This might be 'dirent->d_off', but if so it will get overwritten */ ++ unsafe_put_user(offset, &prev->d_off, efault_end); + unsafe_put_user(ino, &dirent->d_ino, efault_end); + unsafe_put_user(reclen, &dirent->d_reclen, efault_end); + unsafe_put_user(d_type, &dirent->d_type, efault_end); + unsafe_copy_dirent_name(dirent->d_name, name, namlen, efault_end); + user_access_end(); + +- buf->previous = dirent; +- dirent = (void __user *)dirent + reclen; +- buf->current_dir = dirent; ++ buf->prev_reclen = reclen; ++ buf->current_dir = (void __user *)dirent + reclen; + buf->count -= reclen; + return 0; ++ + efault_end: + user_access_end(); + efault: +@@ -354,7 +354,6 @@ int ksys_getdents64(unsigned int fd, struct linux_dirent64 __user *dirent, + unsigned int count) + { + struct fd f; +- struct linux_dirent64 __user * lastdirent; + struct getdents_callback64 buf = { + .ctx.actor = filldir64, + .count = count, +@@ -372,9 +371,11 @@ int ksys_getdents64(unsigned int fd, struct linux_dirent64 __user *dirent, + error = iterate_dir(f.file, &buf.ctx); + if (error >= 0) + error = buf.error; +- lastdirent = buf.previous; +- if (lastdirent) { ++ if (buf.prev_reclen) { ++ struct linux_dirent64 __user * lastdirent; + typeof(lastdirent->d_off) d_off = buf.ctx.pos; ++ ++ lastdirent = (void __user *) buf.current_dir - buf.prev_reclen; + if (__put_user(d_off, &lastdirent->d_off)) + error = -EFAULT; + else +diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h +index 13f09706033a..f8fde9fa479c 100644 +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -3666,6 +3666,8 @@ int dev_set_alias(struct net_device *, const char *, size_t); + int dev_get_alias(const struct net_device *, char *, size_t); + int dev_change_net_namespace(struct net_device *, struct net *, const char *); + int __dev_set_mtu(struct net_device *, int); ++int dev_validate_mtu(struct net_device *dev, int mtu, ++ struct netlink_ext_ack *extack); + int dev_set_mtu_ext(struct net_device *dev, int mtu, + struct netlink_ext_ack *extack); + int dev_set_mtu(struct net_device *, int); +diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h +index 9bc255a8461b..77336f4c4b1c 100644 +--- a/include/linux/netfilter/ipset/ip_set.h ++++ b/include/linux/netfilter/ipset/ip_set.h +@@ -445,13 +445,6 @@ ip6addrptr(const struct sk_buff *skb, bool src, struct in6_addr *addr) + sizeof(*addr)); + } + +-/* Calculate the bytes required to store the inclusive range of a-b */ +-static inline int +-bitmap_bytes(u32 a, u32 b) +-{ +- return 4 * ((((b - a + 8) / 8) + 3) / 4); +-} +- + /* How often should the gc be run by default */ + #define IPSET_GC_TIME (3 * 60) + +diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h +index cf09ab37b45b..851425c3178f 100644 +--- a/include/linux/netfilter/nfnetlink.h ++++ b/include/linux/netfilter/nfnetlink.h +@@ -31,7 +31,7 @@ struct nfnetlink_subsystem { + const struct nfnl_callback *cb; /* callback for individual types */ + struct module *owner; + int (*commit)(struct net *net, struct sk_buff *skb); +- int (*abort)(struct net *net, struct sk_buff *skb); ++ int (*abort)(struct net *net, struct sk_buff *skb, bool autoload); + void (*cleanup)(struct net *net); + bool (*valid_genid)(struct net *net, u32 genid); + }; +diff --git a/include/net/netns/nftables.h b/include/net/netns/nftables.h +index 286fd960896f..a1a8d45adb42 100644 +--- a/include/net/netns/nftables.h ++++ b/include/net/netns/nftables.h +@@ -7,6 +7,7 @@ + struct netns_nftables { + struct list_head tables; + struct list_head commit_list; ++ struct list_head module_list; + struct mutex commit_mutex; + unsigned int base_seq; + u8 gencursor; +diff --git a/include/trace/events/xen.h b/include/trace/events/xen.h +index 9a0e8af21310..a5ccfa67bc5c 100644 +--- a/include/trace/events/xen.h ++++ b/include/trace/events/xen.h +@@ -66,7 +66,11 @@ TRACE_EVENT(xen_mc_callback, + TP_PROTO(xen_mc_callback_fn_t fn, void *data), + TP_ARGS(fn, data), + TP_STRUCT__entry( +- __field(xen_mc_callback_fn_t, fn) ++ /* ++ * Use field_struct to avoid is_signed_type() ++ * comparison of a function pointer. ++ */ ++ __field_struct(xen_mc_callback_fn_t, fn) + __field(void *, data) + ), + TP_fast_assign( +diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c +index 26b9168321e7..d65f2d5ab694 100644 +--- a/kernel/power/snapshot.c ++++ b/kernel/power/snapshot.c +@@ -1147,24 +1147,24 @@ void free_basic_memory_bitmaps(void) + + void clear_free_pages(void) + { +-#ifdef CONFIG_PAGE_POISONING_ZERO + struct memory_bitmap *bm = free_pages_map; + unsigned long pfn; + + if (WARN_ON(!(free_pages_map))) + return; + +- memory_bm_position_reset(bm); +- pfn = memory_bm_next_pfn(bm); +- while (pfn != BM_END_OF_MAP) { +- if (pfn_valid(pfn)) +- clear_highpage(pfn_to_page(pfn)); +- ++ if (IS_ENABLED(CONFIG_PAGE_POISONING_ZERO) || want_init_on_free()) { ++ memory_bm_position_reset(bm); + pfn = memory_bm_next_pfn(bm); ++ while (pfn != BM_END_OF_MAP) { ++ if (pfn_valid(pfn)) ++ clear_highpage(pfn_to_page(pfn)); ++ ++ pfn = memory_bm_next_pfn(bm); ++ } ++ memory_bm_position_reset(bm); ++ pr_info("free pages cleared after restore\n"); + } +- memory_bm_position_reset(bm); +- pr_info("free pages cleared after restore\n"); +-#endif /* PAGE_POISONING_ZERO */ + } + + /** +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c +index bcb72f102613..341aab32c946 100644 +--- a/kernel/trace/trace.c ++++ b/kernel/trace/trace.c +@@ -9270,6 +9270,11 @@ __init static int tracing_set_default_clock(void) + { + /* sched_clock_stable() is determined in late_initcall */ + if (!trace_boot_clock && !sched_clock_stable()) { ++ if (security_locked_down(LOCKDOWN_TRACEFS)) { ++ pr_warn("Can not set tracing clock due to lockdown\n"); ++ return -EPERM; ++ } ++ + printk(KERN_WARNING + "Unstable clock detected, switching default tracing clock to \"global\"\n" + "If you want to keep using the local clock, then add:\n" +diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c +index c2783915600c..205692181e7b 100644 +--- a/kernel/trace/trace_events_hist.c ++++ b/kernel/trace/trace_events_hist.c +@@ -116,6 +116,7 @@ struct hist_field { + struct ftrace_event_field *field; + unsigned long flags; + hist_field_fn_t fn; ++ unsigned int ref; + unsigned int size; + unsigned int offset; + unsigned int is_signed; +@@ -1766,11 +1767,13 @@ static struct hist_field *find_var(struct hist_trigger_data *hist_data, + struct event_trigger_data *test; + struct hist_field *hist_field; + ++ lockdep_assert_held(&event_mutex); ++ + hist_field = find_var_field(hist_data, var_name); + if (hist_field) + return hist_field; + +- list_for_each_entry_rcu(test, &file->triggers, list) { ++ list_for_each_entry(test, &file->triggers, list) { + if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) { + test_data = test->private_data; + hist_field = find_var_field(test_data, var_name); +@@ -1820,7 +1823,9 @@ static struct hist_field *find_file_var(struct trace_event_file *file, + struct event_trigger_data *test; + struct hist_field *hist_field; + +- list_for_each_entry_rcu(test, &file->triggers, list) { ++ lockdep_assert_held(&event_mutex); ++ ++ list_for_each_entry(test, &file->triggers, list) { + if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) { + test_data = test->private_data; + hist_field = find_var_field(test_data, var_name); +@@ -2423,8 +2428,16 @@ static int contains_operator(char *str) + return field_op; + } + ++static void get_hist_field(struct hist_field *hist_field) ++{ ++ hist_field->ref++; ++} ++ + static void __destroy_hist_field(struct hist_field *hist_field) + { ++ if (--hist_field->ref > 1) ++ return; ++ + kfree(hist_field->var.name); + kfree(hist_field->name); + kfree(hist_field->type); +@@ -2466,6 +2479,8 @@ static struct hist_field *create_hist_field(struct hist_trigger_data *hist_data, + if (!hist_field) + return NULL; + ++ hist_field->ref = 1; ++ + hist_field->hist_data = hist_data; + + if (flags & HIST_FIELD_FL_EXPR || flags & HIST_FIELD_FL_ALIAS) +@@ -2661,6 +2676,17 @@ static struct hist_field *create_var_ref(struct hist_trigger_data *hist_data, + { + unsigned long flags = HIST_FIELD_FL_VAR_REF; + struct hist_field *ref_field; ++ int i; ++ ++ /* Check if the variable already exists */ ++ for (i = 0; i < hist_data->n_var_refs; i++) { ++ ref_field = hist_data->var_refs[i]; ++ if (ref_field->var.idx == var_field->var.idx && ++ ref_field->var.hist_data == var_field->hist_data) { ++ get_hist_field(ref_field); ++ return ref_field; ++ } ++ } + + ref_field = create_hist_field(var_field->hist_data, NULL, flags, NULL); + if (ref_field) { +@@ -3115,7 +3141,9 @@ static char *find_trigger_filter(struct hist_trigger_data *hist_data, + { + struct event_trigger_data *test; + +- list_for_each_entry_rcu(test, &file->triggers, list) { ++ lockdep_assert_held(&event_mutex); ++ ++ list_for_each_entry(test, &file->triggers, list) { + if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) { + if (test->private_data == hist_data) + return test->filter_str; +@@ -3166,9 +3194,11 @@ find_compatible_hist(struct hist_trigger_data *target_hist_data, + struct event_trigger_data *test; + unsigned int n_keys; + ++ lockdep_assert_held(&event_mutex); ++ + n_keys = target_hist_data->n_fields - target_hist_data->n_vals; + +- list_for_each_entry_rcu(test, &file->triggers, list) { ++ list_for_each_entry(test, &file->triggers, list) { + if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) { + hist_data = test->private_data; + +@@ -5528,7 +5558,7 @@ static int hist_show(struct seq_file *m, void *v) + goto out_unlock; + } + +- list_for_each_entry_rcu(data, &event_file->triggers, list) { ++ list_for_each_entry(data, &event_file->triggers, list) { + if (data->cmd_ops->trigger_type == ETT_EVENT_HIST) + hist_trigger_show(m, data, n++); + } +@@ -5921,7 +5951,9 @@ static int hist_register_trigger(char *glob, struct event_trigger_ops *ops, + if (hist_data->attrs->name && !named_data) + goto new; + +- list_for_each_entry_rcu(test, &file->triggers, list) { ++ lockdep_assert_held(&event_mutex); ++ ++ list_for_each_entry(test, &file->triggers, list) { + if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) { + if (!hist_trigger_match(data, test, named_data, false)) + continue; +@@ -6005,10 +6037,12 @@ static bool have_hist_trigger_match(struct event_trigger_data *data, + struct event_trigger_data *test, *named_data = NULL; + bool match = false; + ++ lockdep_assert_held(&event_mutex); ++ + if (hist_data->attrs->name) + named_data = find_named_trigger(hist_data->attrs->name); + +- list_for_each_entry_rcu(test, &file->triggers, list) { ++ list_for_each_entry(test, &file->triggers, list) { + if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) { + if (hist_trigger_match(data, test, named_data, false)) { + match = true; +@@ -6026,10 +6060,12 @@ static bool hist_trigger_check_refs(struct event_trigger_data *data, + struct hist_trigger_data *hist_data = data->private_data; + struct event_trigger_data *test, *named_data = NULL; + ++ lockdep_assert_held(&event_mutex); ++ + if (hist_data->attrs->name) + named_data = find_named_trigger(hist_data->attrs->name); + +- list_for_each_entry_rcu(test, &file->triggers, list) { ++ list_for_each_entry(test, &file->triggers, list) { + if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) { + if (!hist_trigger_match(data, test, named_data, false)) + continue; +@@ -6051,10 +6087,12 @@ static void hist_unregister_trigger(char *glob, struct event_trigger_ops *ops, + struct event_trigger_data *test, *named_data = NULL; + bool unregistered = false; + ++ lockdep_assert_held(&event_mutex); ++ + if (hist_data->attrs->name) + named_data = find_named_trigger(hist_data->attrs->name); + +- list_for_each_entry_rcu(test, &file->triggers, list) { ++ list_for_each_entry(test, &file->triggers, list) { + if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) { + if (!hist_trigger_match(data, test, named_data, false)) + continue; +@@ -6080,7 +6118,9 @@ static bool hist_file_check_refs(struct trace_event_file *file) + struct hist_trigger_data *hist_data; + struct event_trigger_data *test; + +- list_for_each_entry_rcu(test, &file->triggers, list) { ++ lockdep_assert_held(&event_mutex); ++ ++ list_for_each_entry(test, &file->triggers, list) { + if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) { + hist_data = test->private_data; + if (check_var_refs(hist_data)) +@@ -6323,7 +6363,8 @@ hist_enable_trigger(struct event_trigger_data *data, void *rec, + struct enable_trigger_data *enable_data = data->private_data; + struct event_trigger_data *test; + +- list_for_each_entry_rcu(test, &enable_data->file->triggers, list) { ++ list_for_each_entry_rcu(test, &enable_data->file->triggers, list, ++ lockdep_is_held(&event_mutex)) { + if (test->cmd_ops->trigger_type == ETT_EVENT_HIST) { + if (enable_data->enable) + test->paused = false; +diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c +index 2cd53ca21b51..40106fff06a4 100644 +--- a/kernel/trace/trace_events_trigger.c ++++ b/kernel/trace/trace_events_trigger.c +@@ -501,7 +501,9 @@ void update_cond_flag(struct trace_event_file *file) + struct event_trigger_data *data; + bool set_cond = false; + +- list_for_each_entry_rcu(data, &file->triggers, list) { ++ lockdep_assert_held(&event_mutex); ++ ++ list_for_each_entry(data, &file->triggers, list) { + if (data->filter || event_command_post_trigger(data->cmd_ops) || + event_command_needs_rec(data->cmd_ops)) { + set_cond = true; +@@ -536,7 +538,9 @@ static int register_trigger(char *glob, struct event_trigger_ops *ops, + struct event_trigger_data *test; + int ret = 0; + +- list_for_each_entry_rcu(test, &file->triggers, list) { ++ lockdep_assert_held(&event_mutex); ++ ++ list_for_each_entry(test, &file->triggers, list) { + if (test->cmd_ops->trigger_type == data->cmd_ops->trigger_type) { + ret = -EEXIST; + goto out; +@@ -581,7 +585,9 @@ static void unregister_trigger(char *glob, struct event_trigger_ops *ops, + struct event_trigger_data *data; + bool unregistered = false; + +- list_for_each_entry_rcu(data, &file->triggers, list) { ++ lockdep_assert_held(&event_mutex); ++ ++ list_for_each_entry(data, &file->triggers, list) { + if (data->cmd_ops->trigger_type == test->cmd_ops->trigger_type) { + unregistered = true; + list_del_rcu(&data->list); +@@ -1497,7 +1503,9 @@ int event_enable_register_trigger(char *glob, + struct event_trigger_data *test; + int ret = 0; + +- list_for_each_entry_rcu(test, &file->triggers, list) { ++ lockdep_assert_held(&event_mutex); ++ ++ list_for_each_entry(test, &file->triggers, list) { + test_enable_data = test->private_data; + if (test_enable_data && + (test->cmd_ops->trigger_type == +@@ -1537,7 +1545,9 @@ void event_enable_unregister_trigger(char *glob, + struct event_trigger_data *data; + bool unregistered = false; + +- list_for_each_entry_rcu(data, &file->triggers, list) { ++ lockdep_assert_held(&event_mutex); ++ ++ list_for_each_entry(data, &file->triggers, list) { + enable_data = data->private_data; + if (enable_data && + (data->cmd_ops->trigger_type == +diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c +index 7f890262c8a3..3e5f9c7d939c 100644 +--- a/kernel/trace/trace_kprobe.c ++++ b/kernel/trace/trace_kprobe.c +@@ -290,7 +290,7 @@ static struct trace_kprobe *alloc_trace_kprobe(const char *group, + INIT_HLIST_NODE(&tk->rp.kp.hlist); + INIT_LIST_HEAD(&tk->rp.kp.list); + +- ret = trace_probe_init(&tk->tp, event, group); ++ ret = trace_probe_init(&tk->tp, event, group, 0); + if (ret < 0) + goto error; + +diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c +index 905b10af5d5c..bba18cf44a30 100644 +--- a/kernel/trace/trace_probe.c ++++ b/kernel/trace/trace_probe.c +@@ -984,7 +984,7 @@ void trace_probe_cleanup(struct trace_probe *tp) + } + + int trace_probe_init(struct trace_probe *tp, const char *event, +- const char *group) ++ const char *group, size_t event_data_size) + { + struct trace_event_call *call; + int ret = 0; +@@ -992,7 +992,8 @@ int trace_probe_init(struct trace_probe *tp, const char *event, + if (!event || !group) + return -EINVAL; + +- tp->event = kzalloc(sizeof(struct trace_probe_event), GFP_KERNEL); ++ tp->event = kzalloc(sizeof(struct trace_probe_event) + event_data_size, ++ GFP_KERNEL); + if (!tp->event) + return -ENOMEM; + +diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h +index 4ee703728aec..03e4e180058d 100644 +--- a/kernel/trace/trace_probe.h ++++ b/kernel/trace/trace_probe.h +@@ -230,6 +230,7 @@ struct trace_probe_event { + struct trace_event_call call; + struct list_head files; + struct list_head probes; ++ char data[0]; + }; + + struct trace_probe { +@@ -322,7 +323,7 @@ static inline bool trace_probe_has_single_file(struct trace_probe *tp) + } + + int trace_probe_init(struct trace_probe *tp, const char *event, +- const char *group); ++ const char *group, size_t event_data_size); + void trace_probe_cleanup(struct trace_probe *tp); + int trace_probe_append(struct trace_probe *tp, struct trace_probe *to); + void trace_probe_unlink(struct trace_probe *tp); +diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c +index 352073d36585..f66e202fec13 100644 +--- a/kernel/trace/trace_uprobe.c ++++ b/kernel/trace/trace_uprobe.c +@@ -60,7 +60,6 @@ static struct dyn_event_operations trace_uprobe_ops = { + */ + struct trace_uprobe { + struct dyn_event devent; +- struct trace_uprobe_filter filter; + struct uprobe_consumer consumer; + struct path path; + struct inode *inode; +@@ -264,6 +263,14 @@ process_fetch_insn(struct fetch_insn *code, struct pt_regs *regs, void *dest, + } + NOKPROBE_SYMBOL(process_fetch_insn) + ++static struct trace_uprobe_filter * ++trace_uprobe_get_filter(struct trace_uprobe *tu) ++{ ++ struct trace_probe_event *event = tu->tp.event; ++ ++ return (struct trace_uprobe_filter *)&event->data[0]; ++} ++ + static inline void init_trace_uprobe_filter(struct trace_uprobe_filter *filter) + { + rwlock_init(&filter->rwlock); +@@ -351,7 +358,8 @@ alloc_trace_uprobe(const char *group, const char *event, int nargs, bool is_ret) + if (!tu) + return ERR_PTR(-ENOMEM); + +- ret = trace_probe_init(&tu->tp, event, group); ++ ret = trace_probe_init(&tu->tp, event, group, ++ sizeof(struct trace_uprobe_filter)); + if (ret < 0) + goto error; + +@@ -359,7 +367,7 @@ alloc_trace_uprobe(const char *group, const char *event, int nargs, bool is_ret) + tu->consumer.handler = uprobe_dispatcher; + if (is_ret) + tu->consumer.ret_handler = uretprobe_dispatcher; +- init_trace_uprobe_filter(&tu->filter); ++ init_trace_uprobe_filter(trace_uprobe_get_filter(tu)); + return tu; + + error: +@@ -1067,13 +1075,14 @@ static void __probe_event_disable(struct trace_probe *tp) + struct trace_probe *pos; + struct trace_uprobe *tu; + ++ tu = container_of(tp, struct trace_uprobe, tp); ++ WARN_ON(!uprobe_filter_is_empty(trace_uprobe_get_filter(tu))); ++ + list_for_each_entry(pos, trace_probe_probe_list(tp), list) { + tu = container_of(pos, struct trace_uprobe, tp); + if (!tu->inode) + continue; + +- WARN_ON(!uprobe_filter_is_empty(&tu->filter)); +- + uprobe_unregister(tu->inode, tu->offset, &tu->consumer); + tu->inode = NULL; + } +@@ -1108,7 +1117,7 @@ static int probe_event_enable(struct trace_event_call *call, + } + + tu = container_of(tp, struct trace_uprobe, tp); +- WARN_ON(!uprobe_filter_is_empty(&tu->filter)); ++ WARN_ON(!uprobe_filter_is_empty(trace_uprobe_get_filter(tu))); + + if (enabled) + return 0; +@@ -1205,39 +1214,39 @@ __uprobe_perf_filter(struct trace_uprobe_filter *filter, struct mm_struct *mm) + } + + static inline bool +-uprobe_filter_event(struct trace_uprobe *tu, struct perf_event *event) ++trace_uprobe_filter_event(struct trace_uprobe_filter *filter, ++ struct perf_event *event) + { +- return __uprobe_perf_filter(&tu->filter, event->hw.target->mm); ++ return __uprobe_perf_filter(filter, event->hw.target->mm); + } + +-static int uprobe_perf_close(struct trace_uprobe *tu, struct perf_event *event) ++static bool trace_uprobe_filter_remove(struct trace_uprobe_filter *filter, ++ struct perf_event *event) + { + bool done; + +- write_lock(&tu->filter.rwlock); ++ write_lock(&filter->rwlock); + if (event->hw.target) { + list_del(&event->hw.tp_list); +- done = tu->filter.nr_systemwide || ++ done = filter->nr_systemwide || + (event->hw.target->flags & PF_EXITING) || +- uprobe_filter_event(tu, event); ++ trace_uprobe_filter_event(filter, event); + } else { +- tu->filter.nr_systemwide--; +- done = tu->filter.nr_systemwide; ++ filter->nr_systemwide--; ++ done = filter->nr_systemwide; + } +- write_unlock(&tu->filter.rwlock); +- +- if (!done) +- return uprobe_apply(tu->inode, tu->offset, &tu->consumer, false); ++ write_unlock(&filter->rwlock); + +- return 0; ++ return done; + } + +-static int uprobe_perf_open(struct trace_uprobe *tu, struct perf_event *event) ++/* This returns true if the filter always covers target mm */ ++static bool trace_uprobe_filter_add(struct trace_uprobe_filter *filter, ++ struct perf_event *event) + { + bool done; +- int err; + +- write_lock(&tu->filter.rwlock); ++ write_lock(&filter->rwlock); + if (event->hw.target) { + /* + * event->parent != NULL means copy_process(), we can avoid +@@ -1247,28 +1256,21 @@ static int uprobe_perf_open(struct trace_uprobe *tu, struct perf_event *event) + * attr.enable_on_exec means that exec/mmap will install the + * breakpoints we need. + */ +- done = tu->filter.nr_systemwide || ++ done = filter->nr_systemwide || + event->parent || event->attr.enable_on_exec || +- uprobe_filter_event(tu, event); +- list_add(&event->hw.tp_list, &tu->filter.perf_events); ++ trace_uprobe_filter_event(filter, event); ++ list_add(&event->hw.tp_list, &filter->perf_events); + } else { +- done = tu->filter.nr_systemwide; +- tu->filter.nr_systemwide++; ++ done = filter->nr_systemwide; ++ filter->nr_systemwide++; + } +- write_unlock(&tu->filter.rwlock); ++ write_unlock(&filter->rwlock); + +- err = 0; +- if (!done) { +- err = uprobe_apply(tu->inode, tu->offset, &tu->consumer, true); +- if (err) +- uprobe_perf_close(tu, event); +- } +- return err; ++ return done; + } + +-static int uprobe_perf_multi_call(struct trace_event_call *call, +- struct perf_event *event, +- int (*op)(struct trace_uprobe *tu, struct perf_event *event)) ++static int uprobe_perf_close(struct trace_event_call *call, ++ struct perf_event *event) + { + struct trace_probe *pos, *tp; + struct trace_uprobe *tu; +@@ -1278,25 +1280,59 @@ static int uprobe_perf_multi_call(struct trace_event_call *call, + if (WARN_ON_ONCE(!tp)) + return -ENODEV; + ++ tu = container_of(tp, struct trace_uprobe, tp); ++ if (trace_uprobe_filter_remove(trace_uprobe_get_filter(tu), event)) ++ return 0; ++ + list_for_each_entry(pos, trace_probe_probe_list(tp), list) { + tu = container_of(pos, struct trace_uprobe, tp); +- ret = op(tu, event); ++ ret = uprobe_apply(tu->inode, tu->offset, &tu->consumer, false); + if (ret) + break; + } + + return ret; + } ++ ++static int uprobe_perf_open(struct trace_event_call *call, ++ struct perf_event *event) ++{ ++ struct trace_probe *pos, *tp; ++ struct trace_uprobe *tu; ++ int err = 0; ++ ++ tp = trace_probe_primary_from_call(call); ++ if (WARN_ON_ONCE(!tp)) ++ return -ENODEV; ++ ++ tu = container_of(tp, struct trace_uprobe, tp); ++ if (trace_uprobe_filter_add(trace_uprobe_get_filter(tu), event)) ++ return 0; ++ ++ list_for_each_entry(pos, trace_probe_probe_list(tp), list) { ++ err = uprobe_apply(tu->inode, tu->offset, &tu->consumer, true); ++ if (err) { ++ uprobe_perf_close(call, event); ++ break; ++ } ++ } ++ ++ return err; ++} ++ + static bool uprobe_perf_filter(struct uprobe_consumer *uc, + enum uprobe_filter_ctx ctx, struct mm_struct *mm) + { ++ struct trace_uprobe_filter *filter; + struct trace_uprobe *tu; + int ret; + + tu = container_of(uc, struct trace_uprobe, consumer); +- read_lock(&tu->filter.rwlock); +- ret = __uprobe_perf_filter(&tu->filter, mm); +- read_unlock(&tu->filter.rwlock); ++ filter = trace_uprobe_get_filter(tu); ++ ++ read_lock(&filter->rwlock); ++ ret = __uprobe_perf_filter(filter, mm); ++ read_unlock(&filter->rwlock); + + return ret; + } +@@ -1419,10 +1455,10 @@ trace_uprobe_register(struct trace_event_call *event, enum trace_reg type, + return 0; + + case TRACE_REG_PERF_OPEN: +- return uprobe_perf_multi_call(event, data, uprobe_perf_open); ++ return uprobe_perf_open(event, data); + + case TRACE_REG_PERF_CLOSE: +- return uprobe_perf_multi_call(event, data, uprobe_perf_close); ++ return uprobe_perf_close(event, data); + + #endif + default: +diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c +index dccb95af6003..706020b06617 100644 +--- a/lib/strncpy_from_user.c ++++ b/lib/strncpy_from_user.c +@@ -30,13 +30,6 @@ static inline long do_strncpy_from_user(char *dst, const char __user *src, + const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; + unsigned long res = 0; + +- /* +- * Truncate 'max' to the user-specified limit, so that +- * we only have one limit we need to check in the loop +- */ +- if (max > count) +- max = count; +- + if (IS_UNALIGNED(src, dst)) + goto byte_at_a_time; + +@@ -114,6 +107,13 @@ long strncpy_from_user(char *dst, const char __user *src, long count) + unsigned long max = max_addr - src_addr; + long retval; + ++ /* ++ * Truncate 'max' to the user-specified limit, so that ++ * we only have one limit we need to check in the loop ++ */ ++ if (max > count) ++ max = count; ++ + kasan_check_write(dst, count); + check_object_size(dst, count, false); + if (user_access_begin(src, max)) { +diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c +index 6c0005d5dd5c..41670d4a5816 100644 +--- a/lib/strnlen_user.c ++++ b/lib/strnlen_user.c +@@ -26,13 +26,6 @@ static inline long do_strnlen_user(const char __user *src, unsigned long count, + unsigned long align, res = 0; + unsigned long c; + +- /* +- * Truncate 'max' to the user-specified limit, so that +- * we only have one limit we need to check in the loop +- */ +- if (max > count) +- max = count; +- + /* + * Do everything aligned. But that means that we + * need to also expand the maximum.. +@@ -109,6 +102,13 @@ long strnlen_user(const char __user *str, long count) + unsigned long max = max_addr - src_addr; + long retval; + ++ /* ++ * Truncate 'max' to the user-specified limit, so that ++ * we only have one limit we need to check in the loop ++ */ ++ if (max > count) ++ max = count; ++ + if (user_access_begin(str, max)) { + retval = do_strnlen_user(str, count, max); + user_access_end(); +diff --git a/lib/test_xarray.c b/lib/test_xarray.c +index 7df4f7f395bf..03c3f42966ce 100644 +--- a/lib/test_xarray.c ++++ b/lib/test_xarray.c +@@ -2,6 +2,7 @@ + /* + * test_xarray.c: Test the XArray API + * Copyright (c) 2017-2018 Microsoft Corporation ++ * Copyright (c) 2019-2020 Oracle + * Author: Matthew Wilcox + */ + +@@ -902,28 +903,34 @@ static noinline void check_store_iter(struct xarray *xa) + XA_BUG_ON(xa, !xa_empty(xa)); + } + +-static noinline void check_multi_find(struct xarray *xa) ++static noinline void check_multi_find_1(struct xarray *xa, unsigned order) + { + #ifdef CONFIG_XARRAY_MULTI ++ unsigned long multi = 3 << order; ++ unsigned long next = 4 << order; + unsigned long index; + +- xa_store_order(xa, 12, 2, xa_mk_value(12), GFP_KERNEL); +- XA_BUG_ON(xa, xa_store_index(xa, 16, GFP_KERNEL) != NULL); ++ xa_store_order(xa, multi, order, xa_mk_value(multi), GFP_KERNEL); ++ XA_BUG_ON(xa, xa_store_index(xa, next, GFP_KERNEL) != NULL); ++ XA_BUG_ON(xa, xa_store_index(xa, next + 1, GFP_KERNEL) != NULL); + + index = 0; + XA_BUG_ON(xa, xa_find(xa, &index, ULONG_MAX, XA_PRESENT) != +- xa_mk_value(12)); +- XA_BUG_ON(xa, index != 12); +- index = 13; ++ xa_mk_value(multi)); ++ XA_BUG_ON(xa, index != multi); ++ index = multi + 1; + XA_BUG_ON(xa, xa_find(xa, &index, ULONG_MAX, XA_PRESENT) != +- xa_mk_value(12)); +- XA_BUG_ON(xa, (index < 12) || (index >= 16)); ++ xa_mk_value(multi)); ++ XA_BUG_ON(xa, (index < multi) || (index >= next)); + XA_BUG_ON(xa, xa_find_after(xa, &index, ULONG_MAX, XA_PRESENT) != +- xa_mk_value(16)); +- XA_BUG_ON(xa, index != 16); +- +- xa_erase_index(xa, 12); +- xa_erase_index(xa, 16); ++ xa_mk_value(next)); ++ XA_BUG_ON(xa, index != next); ++ XA_BUG_ON(xa, xa_find_after(xa, &index, next, XA_PRESENT) != NULL); ++ XA_BUG_ON(xa, index != next); ++ ++ xa_erase_index(xa, multi); ++ xa_erase_index(xa, next); ++ xa_erase_index(xa, next + 1); + XA_BUG_ON(xa, !xa_empty(xa)); + #endif + } +@@ -1046,12 +1053,33 @@ static noinline void check_find_3(struct xarray *xa) + xa_destroy(xa); + } + ++static noinline void check_find_4(struct xarray *xa) ++{ ++ unsigned long index = 0; ++ void *entry; ++ ++ xa_store_index(xa, ULONG_MAX, GFP_KERNEL); ++ ++ entry = xa_find_after(xa, &index, ULONG_MAX, XA_PRESENT); ++ XA_BUG_ON(xa, entry != xa_mk_index(ULONG_MAX)); ++ ++ entry = xa_find_after(xa, &index, ULONG_MAX, XA_PRESENT); ++ XA_BUG_ON(xa, entry); ++ ++ xa_erase_index(xa, ULONG_MAX); ++} ++ + static noinline void check_find(struct xarray *xa) + { ++ unsigned i; ++ + check_find_1(xa); + check_find_2(xa); + check_find_3(xa); +- check_multi_find(xa); ++ check_find_4(xa); ++ ++ for (i = 2; i < 10; i++) ++ check_multi_find_1(xa, i); + check_multi_find_2(xa); + } + +diff --git a/lib/xarray.c b/lib/xarray.c +index 1237c213f52b..47e17d46e5f8 100644 +--- a/lib/xarray.c ++++ b/lib/xarray.c +@@ -1,7 +1,8 @@ + // SPDX-License-Identifier: GPL-2.0+ + /* + * XArray implementation +- * Copyright (c) 2017 Microsoft Corporation ++ * Copyright (c) 2017-2018 Microsoft Corporation ++ * Copyright (c) 2018-2020 Oracle + * Author: Matthew Wilcox + */ + +@@ -1081,6 +1082,8 @@ void *xas_find(struct xa_state *xas, unsigned long max) + + if (xas_error(xas)) + return NULL; ++ if (xas->xa_index > max) ++ return set_bounds(xas); + + if (!xas->xa_node) { + xas->xa_index = 1; +@@ -1150,6 +1153,8 @@ void *xas_find_marked(struct xa_state *xas, unsigned long max, xa_mark_t mark) + + if (xas_error(xas)) + return NULL; ++ if (xas->xa_index > max) ++ goto max; + + if (!xas->xa_node) { + xas->xa_index = 1; +@@ -1824,6 +1829,17 @@ void *xa_find(struct xarray *xa, unsigned long *indexp, + } + EXPORT_SYMBOL(xa_find); + ++static bool xas_sibling(struct xa_state *xas) ++{ ++ struct xa_node *node = xas->xa_node; ++ unsigned long mask; ++ ++ if (!node) ++ return false; ++ mask = (XA_CHUNK_SIZE << node->shift) - 1; ++ return (xas->xa_index & mask) > (xas->xa_offset << node->shift); ++} ++ + /** + * xa_find_after() - Search the XArray for a present entry. + * @xa: XArray. +@@ -1847,21 +1863,20 @@ void *xa_find_after(struct xarray *xa, unsigned long *indexp, + XA_STATE(xas, xa, *indexp + 1); + void *entry; + ++ if (xas.xa_index == 0) ++ return NULL; ++ + rcu_read_lock(); + for (;;) { + if ((__force unsigned int)filter < XA_MAX_MARKS) + entry = xas_find_marked(&xas, max, filter); + else + entry = xas_find(&xas, max); +- if (xas.xa_node == XAS_BOUNDS) ++ ++ if (xas_invalid(&xas)) + break; +- if (xas.xa_shift) { +- if (xas.xa_index & ((1UL << xas.xa_shift) - 1)) +- continue; +- } else { +- if (xas.xa_offset < (xas.xa_index & XA_CHUNK_MASK)) +- continue; +- } ++ if (xas_sibling(&xas)) ++ continue; + if (!xas_retry(&xas, entry)) + break; + } +diff --git a/net/core/dev.c b/net/core/dev.c +index 3098c90d60e2..82325d3d1371 100644 +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -5270,9 +5270,29 @@ static void flush_all_backlogs(void) + put_online_cpus(); + } + ++/* Pass the currently batched GRO_NORMAL SKBs up to the stack. */ ++static void gro_normal_list(struct napi_struct *napi) ++{ ++ if (!napi->rx_count) ++ return; ++ netif_receive_skb_list_internal(&napi->rx_list); ++ INIT_LIST_HEAD(&napi->rx_list); ++ napi->rx_count = 0; ++} ++ ++/* Queue one GRO_NORMAL SKB up for list processing. If batch size exceeded, ++ * pass the whole batch up to the stack. ++ */ ++static void gro_normal_one(struct napi_struct *napi, struct sk_buff *skb) ++{ ++ list_add_tail(&skb->list, &napi->rx_list); ++ if (++napi->rx_count >= gro_normal_batch) ++ gro_normal_list(napi); ++} ++ + INDIRECT_CALLABLE_DECLARE(int inet_gro_complete(struct sk_buff *, int)); + INDIRECT_CALLABLE_DECLARE(int ipv6_gro_complete(struct sk_buff *, int)); +-static int napi_gro_complete(struct sk_buff *skb) ++static int napi_gro_complete(struct napi_struct *napi, struct sk_buff *skb) + { + struct packet_offload *ptype; + __be16 type = skb->protocol; +@@ -5305,7 +5325,8 @@ static int napi_gro_complete(struct sk_buff *skb) + } + + out: +- return netif_receive_skb_internal(skb); ++ gro_normal_one(napi, skb); ++ return NET_RX_SUCCESS; + } + + static void __napi_gro_flush_chain(struct napi_struct *napi, u32 index, +@@ -5318,7 +5339,7 @@ static void __napi_gro_flush_chain(struct napi_struct *napi, u32 index, + if (flush_old && NAPI_GRO_CB(skb)->age == jiffies) + return; + skb_list_del_init(skb); +- napi_gro_complete(skb); ++ napi_gro_complete(napi, skb); + napi->gro_hash[index].count--; + } + +@@ -5421,7 +5442,7 @@ static void gro_pull_from_frag0(struct sk_buff *skb, int grow) + } + } + +-static void gro_flush_oldest(struct list_head *head) ++static void gro_flush_oldest(struct napi_struct *napi, struct list_head *head) + { + struct sk_buff *oldest; + +@@ -5437,7 +5458,7 @@ static void gro_flush_oldest(struct list_head *head) + * SKB to the chain. + */ + skb_list_del_init(oldest); +- napi_gro_complete(oldest); ++ napi_gro_complete(napi, oldest); + } + + INDIRECT_CALLABLE_DECLARE(struct sk_buff *inet_gro_receive(struct list_head *, +@@ -5513,7 +5534,7 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff + + if (pp) { + skb_list_del_init(pp); +- napi_gro_complete(pp); ++ napi_gro_complete(napi, pp); + napi->gro_hash[hash].count--; + } + +@@ -5524,7 +5545,7 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff + goto normal; + + if (unlikely(napi->gro_hash[hash].count >= MAX_GRO_SKBS)) { +- gro_flush_oldest(gro_head); ++ gro_flush_oldest(napi, gro_head); + } else { + napi->gro_hash[hash].count++; + } +@@ -5672,26 +5693,6 @@ struct sk_buff *napi_get_frags(struct napi_struct *napi) + } + EXPORT_SYMBOL(napi_get_frags); + +-/* Pass the currently batched GRO_NORMAL SKBs up to the stack. */ +-static void gro_normal_list(struct napi_struct *napi) +-{ +- if (!napi->rx_count) +- return; +- netif_receive_skb_list_internal(&napi->rx_list); +- INIT_LIST_HEAD(&napi->rx_list); +- napi->rx_count = 0; +-} +- +-/* Queue one GRO_NORMAL SKB up for list processing. If batch size exceeded, +- * pass the whole batch up to the stack. +- */ +-static void gro_normal_one(struct napi_struct *napi, struct sk_buff *skb) +-{ +- list_add_tail(&skb->list, &napi->rx_list); +- if (++napi->rx_count >= gro_normal_batch) +- gro_normal_list(napi); +-} +- + static gro_result_t napi_frags_finish(struct napi_struct *napi, + struct sk_buff *skb, + gro_result_t ret) +@@ -5979,8 +5980,6 @@ bool napi_complete_done(struct napi_struct *n, int work_done) + NAPIF_STATE_IN_BUSY_POLL))) + return false; + +- gro_normal_list(n); +- + if (n->gro_bitmask) { + unsigned long timeout = 0; + +@@ -5996,6 +5995,9 @@ bool napi_complete_done(struct napi_struct *n, int work_done) + hrtimer_start(&n->timer, ns_to_ktime(timeout), + HRTIMER_MODE_REL_PINNED); + } ++ ++ gro_normal_list(n); ++ + if (unlikely(!list_empty(&n->poll_list))) { + /* If n->poll_list is not empty, we need to mask irqs */ + local_irq_save(flags); +@@ -6327,8 +6329,6 @@ static int napi_poll(struct napi_struct *n, struct list_head *repoll) + goto out_unlock; + } + +- gro_normal_list(n); +- + if (n->gro_bitmask) { + /* flush too old packets + * If HZ < 1000, flush all packets. +@@ -6336,6 +6336,8 @@ static int napi_poll(struct napi_struct *n, struct list_head *repoll) + napi_gro_flush(n, HZ >= 1000); + } + ++ gro_normal_list(n); ++ + /* Some drivers may have called napi_schedule + * prior to exhausting their budget. + */ +@@ -7973,6 +7975,22 @@ int __dev_set_mtu(struct net_device *dev, int new_mtu) + } + EXPORT_SYMBOL(__dev_set_mtu); + ++int dev_validate_mtu(struct net_device *dev, int new_mtu, ++ struct netlink_ext_ack *extack) ++{ ++ /* MTU must be positive, and in range */ ++ if (new_mtu < 0 || new_mtu < dev->min_mtu) { ++ NL_SET_ERR_MSG(extack, "mtu less than device minimum"); ++ return -EINVAL; ++ } ++ ++ if (dev->max_mtu > 0 && new_mtu > dev->max_mtu) { ++ NL_SET_ERR_MSG(extack, "mtu greater than device maximum"); ++ return -EINVAL; ++ } ++ return 0; ++} ++ + /** + * dev_set_mtu_ext - Change maximum transfer unit + * @dev: device +@@ -7989,16 +8007,9 @@ int dev_set_mtu_ext(struct net_device *dev, int new_mtu, + if (new_mtu == dev->mtu) + return 0; + +- /* MTU must be positive, and in range */ +- if (new_mtu < 0 || new_mtu < dev->min_mtu) { +- NL_SET_ERR_MSG(extack, "mtu less than device minimum"); +- return -EINVAL; +- } +- +- if (dev->max_mtu > 0 && new_mtu > dev->max_mtu) { +- NL_SET_ERR_MSG(extack, "mtu greater than device maximum"); +- return -EINVAL; +- } ++ err = dev_validate_mtu(dev, new_mtu, extack); ++ if (err) ++ return err; + + if (!netif_device_present(dev)) + return -ENODEV; +@@ -9073,8 +9084,10 @@ int register_netdevice(struct net_device *dev) + goto err_uninit; + + ret = netdev_register_kobject(dev); +- if (ret) ++ if (ret) { ++ dev->reg_state = NETREG_UNREGISTERED; + goto err_uninit; ++ } + dev->reg_state = NETREG_REGISTERED; + + __netdev_update_features(dev); +diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c +index e4ec575c1fba..944acb1a9f29 100644 +--- a/net/core/rtnetlink.c ++++ b/net/core/rtnetlink.c +@@ -2959,8 +2959,17 @@ struct net_device *rtnl_create_link(struct net *net, const char *ifname, + dev->rtnl_link_ops = ops; + dev->rtnl_link_state = RTNL_LINK_INITIALIZING; + +- if (tb[IFLA_MTU]) +- dev->mtu = nla_get_u32(tb[IFLA_MTU]); ++ if (tb[IFLA_MTU]) { ++ u32 mtu = nla_get_u32(tb[IFLA_MTU]); ++ int err; ++ ++ err = dev_validate_mtu(dev, mtu, extack); ++ if (err) { ++ free_netdev(dev); ++ return ERR_PTR(err); ++ } ++ dev->mtu = mtu; ++ } + if (tb[IFLA_ADDRESS]) { + memcpy(dev->dev_addr, nla_data(tb[IFLA_ADDRESS]), + nla_len(tb[IFLA_ADDRESS])); +diff --git a/net/core/skmsg.c b/net/core/skmsg.c +index 3866d7e20c07..ded2d5227678 100644 +--- a/net/core/skmsg.c ++++ b/net/core/skmsg.c +@@ -594,8 +594,6 @@ EXPORT_SYMBOL_GPL(sk_psock_destroy); + + void sk_psock_drop(struct sock *sk, struct sk_psock *psock) + { +- sock_owned_by_me(sk); +- + sk_psock_cork_free(psock); + sk_psock_zap_ingress(psock); + +diff --git a/net/hsr/hsr_main.h b/net/hsr/hsr_main.h +index d40de84a637f..754d84b217f0 100644 +--- a/net/hsr/hsr_main.h ++++ b/net/hsr/hsr_main.h +@@ -191,7 +191,7 @@ void hsr_debugfs_term(struct hsr_priv *priv); + void hsr_debugfs_create_root(void); + void hsr_debugfs_remove_root(void); + #else +-static inline void void hsr_debugfs_rename(struct net_device *dev) ++static inline void hsr_debugfs_rename(struct net_device *dev) + { + } + static inline void hsr_debugfs_init(struct hsr_priv *priv, +diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c +index 0e4a7cf6bc87..e2e219c7854a 100644 +--- a/net/ipv4/esp4_offload.c ++++ b/net/ipv4/esp4_offload.c +@@ -57,6 +57,8 @@ static struct sk_buff *esp4_gro_receive(struct list_head *head, + if (!x) + goto out_reset; + ++ skb->mark = xfrm_smark_get(skb->mark, x); ++ + sp->xvec[sp->len++] = x; + sp->olen++; + +diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c +index 1ab2fb6bb37d..f12fa8da6127 100644 +--- a/net/ipv4/fib_trie.c ++++ b/net/ipv4/fib_trie.c +@@ -2175,6 +2175,12 @@ int fib_table_dump(struct fib_table *tb, struct sk_buff *skb, + int count = cb->args[2]; + t_key key = cb->args[3]; + ++ /* First time here, count and key are both always 0. Count > 0 ++ * and key == 0 means the dump has wrapped around and we are done. ++ */ ++ if (count && !key) ++ return skb->len; ++ + while ((l = leaf_walk_rcu(&tp, key)) != NULL) { + int err; + +diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c +index 30fa771d382a..dcc79ff54b41 100644 +--- a/net/ipv4/fou.c ++++ b/net/ipv4/fou.c +@@ -662,8 +662,8 @@ static const struct nla_policy fou_nl_policy[FOU_ATTR_MAX + 1] = { + [FOU_ATTR_REMCSUM_NOPARTIAL] = { .type = NLA_FLAG, }, + [FOU_ATTR_LOCAL_V4] = { .type = NLA_U32, }, + [FOU_ATTR_PEER_V4] = { .type = NLA_U32, }, +- [FOU_ATTR_LOCAL_V6] = { .type = sizeof(struct in6_addr), }, +- [FOU_ATTR_PEER_V6] = { .type = sizeof(struct in6_addr), }, ++ [FOU_ATTR_LOCAL_V6] = { .len = sizeof(struct in6_addr), }, ++ [FOU_ATTR_PEER_V6] = { .len = sizeof(struct in6_addr), }, + [FOU_ATTR_PEER_PORT] = { .type = NLA_U16, }, + [FOU_ATTR_IFINDEX] = { .type = NLA_S32, }, + }; +diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c +index 0fe2a5d3e258..74e1d964a615 100644 +--- a/net/ipv4/ip_tunnel.c ++++ b/net/ipv4/ip_tunnel.c +@@ -1236,10 +1236,8 @@ int ip_tunnel_init(struct net_device *dev) + iph->version = 4; + iph->ihl = 5; + +- if (tunnel->collect_md) { +- dev->features |= NETIF_F_NETNS_LOCAL; ++ if (tunnel->collect_md) + netif_keep_dst(dev); +- } + return 0; + } + EXPORT_SYMBOL_GPL(ip_tunnel_init); +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c +index 84115577d3dc..3640e8563a10 100644 +--- a/net/ipv4/tcp.c ++++ b/net/ipv4/tcp.c +@@ -2520,6 +2520,7 @@ static void tcp_rtx_queue_purge(struct sock *sk) + { + struct rb_node *p = rb_first(&sk->tcp_rtx_queue); + ++ tcp_sk(sk)->highest_sack = NULL; + while (p) { + struct sk_buff *skb = rb_to_skb(p); + +diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c +index a6545ef0d27b..6c4d79baff26 100644 +--- a/net/ipv4/tcp_bbr.c ++++ b/net/ipv4/tcp_bbr.c +@@ -779,8 +779,7 @@ static void bbr_update_bw(struct sock *sk, const struct rate_sample *rs) + * bandwidth sample. Delivered is in packets and interval_us in uS and + * ratio will be <<1 for most connections. So delivered is first scaled. + */ +- bw = (u64)rs->delivered * BW_UNIT; +- do_div(bw, rs->interval_us); ++ bw = div64_long((u64)rs->delivered * BW_UNIT, rs->interval_us); + + /* If this sample is application-limited, it is likely to have a very + * low delivered count that represents application behavior rather than +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c +index 59b78ce2ce2e..6f7155d91313 100644 +--- a/net/ipv4/tcp_input.c ++++ b/net/ipv4/tcp_input.c +@@ -3164,6 +3164,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, u32 prior_fack, + tp->retransmit_skb_hint = NULL; + if (unlikely(skb == tp->lost_skb_hint)) + tp->lost_skb_hint = NULL; ++ tcp_highest_sack_replace(sk, skb, next); + tcp_rtx_queue_unlink_and_free(skb, sk); + } + +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c +index e4ba915c4bb5..660b24fe041e 100644 +--- a/net/ipv4/tcp_output.c ++++ b/net/ipv4/tcp_output.c +@@ -3231,6 +3231,7 @@ int tcp_send_synack(struct sock *sk) + if (!nskb) + return -ENOMEM; + INIT_LIST_HEAD(&nskb->tcp_tsorted_anchor); ++ tcp_highest_sack_replace(sk, skb, nskb); + tcp_rtx_queue_unlink_and_free(skb, sk); + __skb_header_release(nskb); + tcp_rbtree_insert(&sk->tcp_rtx_queue, nskb); +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c +index 7aa4e77161f6..7ae7065758bd 100644 +--- a/net/ipv4/udp.c ++++ b/net/ipv4/udp.c +@@ -1368,7 +1368,8 @@ static void udp_rmem_release(struct sock *sk, int size, int partial, + if (likely(partial)) { + up->forward_deficit += size; + size = up->forward_deficit; +- if (size < (sk->sk_rcvbuf >> 2)) ++ if (size < (sk->sk_rcvbuf >> 2) && ++ !skb_queue_empty(&up->reader_queue)) + return; + } else { + size += up->forward_deficit; +diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c +index e31626ffccd1..fd535053245b 100644 +--- a/net/ipv6/esp6_offload.c ++++ b/net/ipv6/esp6_offload.c +@@ -79,6 +79,8 @@ static struct sk_buff *esp6_gro_receive(struct list_head *head, + if (!x) + goto out_reset; + ++ skb->mark = xfrm_smark_get(skb->mark, x); ++ + sp->xvec[sp->len++] = x; + sp->olen++; + +diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c +index 189de56f5e36..9ec05a1df5e1 100644 +--- a/net/ipv6/ip6_gre.c ++++ b/net/ipv6/ip6_gre.c +@@ -1466,7 +1466,6 @@ static int ip6gre_tunnel_init_common(struct net_device *dev) + dev->mtu -= 8; + + if (tunnel->parms.collect_md) { +- dev->features |= NETIF_F_NETNS_LOCAL; + netif_keep_dst(dev); + } + ip6gre_tnl_init_features(dev); +@@ -1894,7 +1893,6 @@ static void ip6gre_tap_setup(struct net_device *dev) + dev->needs_free_netdev = true; + dev->priv_destructor = ip6gre_dev_free; + +- dev->features |= NETIF_F_NETNS_LOCAL; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; + netif_keep_dst(dev); +@@ -2197,7 +2195,6 @@ static void ip6erspan_tap_setup(struct net_device *dev) + dev->needs_free_netdev = true; + dev->priv_destructor = ip6gre_dev_free; + +- dev->features |= NETIF_F_NETNS_LOCAL; + dev->priv_flags &= ~IFF_TX_SKB_SHARING; + dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; + netif_keep_dst(dev); +diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c +index 2f376dbc37d5..b5dd20c4599b 100644 +--- a/net/ipv6/ip6_tunnel.c ++++ b/net/ipv6/ip6_tunnel.c +@@ -1877,10 +1877,8 @@ static int ip6_tnl_dev_init(struct net_device *dev) + if (err) + return err; + ip6_tnl_link_config(t); +- if (t->parms.collect_md) { +- dev->features |= NETIF_F_NETNS_LOCAL; ++ if (t->parms.collect_md) + netif_keep_dst(dev); +- } + return 0; + } + +diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c +index e70567446f28..802eebf8ac4b 100644 +--- a/net/ipv6/seg6_local.c ++++ b/net/ipv6/seg6_local.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #ifdef CONFIG_IPV6_SEG6_HMAC + #include + #endif +@@ -135,7 +136,8 @@ static bool decap_and_validate(struct sk_buff *skb, int proto) + + skb_reset_network_header(skb); + skb_reset_transport_header(skb); +- skb->encapsulation = 0; ++ if (iptunnel_pull_offloads(skb)) ++ return false; + + return true; + } +diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h b/net/netfilter/ipset/ip_set_bitmap_gen.h +index e1f271a1b2c1..bfd4b42ba305 100644 +--- a/net/netfilter/ipset/ip_set_bitmap_gen.h ++++ b/net/netfilter/ipset/ip_set_bitmap_gen.h +@@ -75,7 +75,7 @@ mtype_flush(struct ip_set *set) + + if (set->extensions & IPSET_EXT_DESTROY) + mtype_ext_cleanup(set); +- memset(map->members, 0, map->memsize); ++ bitmap_zero(map->members, map->elements); + set->elements = 0; + set->ext_size = 0; + } +diff --git a/net/netfilter/ipset/ip_set_bitmap_ip.c b/net/netfilter/ipset/ip_set_bitmap_ip.c +index 11ff9d4a7006..d934384f31ad 100644 +--- a/net/netfilter/ipset/ip_set_bitmap_ip.c ++++ b/net/netfilter/ipset/ip_set_bitmap_ip.c +@@ -37,7 +37,7 @@ MODULE_ALIAS("ip_set_bitmap:ip"); + + /* Type structure */ + struct bitmap_ip { +- void *members; /* the set members */ ++ unsigned long *members; /* the set members */ + u32 first_ip; /* host byte order, included in range */ + u32 last_ip; /* host byte order, included in range */ + u32 elements; /* number of max elements in the set */ +@@ -220,7 +220,7 @@ init_map_ip(struct ip_set *set, struct bitmap_ip *map, + u32 first_ip, u32 last_ip, + u32 elements, u32 hosts, u8 netmask) + { +- map->members = ip_set_alloc(map->memsize); ++ map->members = bitmap_zalloc(elements, GFP_KERNEL | __GFP_NOWARN); + if (!map->members) + return false; + map->first_ip = first_ip; +@@ -310,7 +310,7 @@ bitmap_ip_create(struct net *net, struct ip_set *set, struct nlattr *tb[], + if (!map) + return -ENOMEM; + +- map->memsize = bitmap_bytes(0, elements - 1); ++ map->memsize = BITS_TO_LONGS(elements) * sizeof(unsigned long); + set->variant = &bitmap_ip; + if (!init_map_ip(set, map, first_ip, last_ip, + elements, hosts, netmask)) { +diff --git a/net/netfilter/ipset/ip_set_bitmap_ipmac.c b/net/netfilter/ipset/ip_set_bitmap_ipmac.c +index 1d4e63326e68..e8532783b43a 100644 +--- a/net/netfilter/ipset/ip_set_bitmap_ipmac.c ++++ b/net/netfilter/ipset/ip_set_bitmap_ipmac.c +@@ -42,7 +42,7 @@ enum { + + /* Type structure */ + struct bitmap_ipmac { +- void *members; /* the set members */ ++ unsigned long *members; /* the set members */ + u32 first_ip; /* host byte order, included in range */ + u32 last_ip; /* host byte order, included in range */ + u32 elements; /* number of max elements in the set */ +@@ -299,7 +299,7 @@ static bool + init_map_ipmac(struct ip_set *set, struct bitmap_ipmac *map, + u32 first_ip, u32 last_ip, u32 elements) + { +- map->members = ip_set_alloc(map->memsize); ++ map->members = bitmap_zalloc(elements, GFP_KERNEL | __GFP_NOWARN); + if (!map->members) + return false; + map->first_ip = first_ip; +@@ -360,7 +360,7 @@ bitmap_ipmac_create(struct net *net, struct ip_set *set, struct nlattr *tb[], + if (!map) + return -ENOMEM; + +- map->memsize = bitmap_bytes(0, elements - 1); ++ map->memsize = BITS_TO_LONGS(elements) * sizeof(unsigned long); + set->variant = &bitmap_ipmac; + if (!init_map_ipmac(set, map, first_ip, last_ip, elements)) { + kfree(map); +diff --git a/net/netfilter/ipset/ip_set_bitmap_port.c b/net/netfilter/ipset/ip_set_bitmap_port.c +index 704a0dda1609..e3ac914fff1a 100644 +--- a/net/netfilter/ipset/ip_set_bitmap_port.c ++++ b/net/netfilter/ipset/ip_set_bitmap_port.c +@@ -30,7 +30,7 @@ MODULE_ALIAS("ip_set_bitmap:port"); + + /* Type structure */ + struct bitmap_port { +- void *members; /* the set members */ ++ unsigned long *members; /* the set members */ + u16 first_port; /* host byte order, included in range */ + u16 last_port; /* host byte order, included in range */ + u32 elements; /* number of max elements in the set */ +@@ -204,7 +204,7 @@ static bool + init_map_port(struct ip_set *set, struct bitmap_port *map, + u16 first_port, u16 last_port) + { +- map->members = ip_set_alloc(map->memsize); ++ map->members = bitmap_zalloc(map->elements, GFP_KERNEL | __GFP_NOWARN); + if (!map->members) + return false; + map->first_port = first_port; +@@ -244,7 +244,7 @@ bitmap_port_create(struct net *net, struct ip_set *set, struct nlattr *tb[], + return -ENOMEM; + + map->elements = elements; +- map->memsize = bitmap_bytes(0, map->elements); ++ map->memsize = BITS_TO_LONGS(elements) * sizeof(unsigned long); + set->variant = &bitmap_port; + if (!init_map_port(set, map, first_port, last_port)) { + kfree(map); +diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c +index 9fefd0150091..23544842b692 100644 +--- a/net/netfilter/nf_tables_api.c ++++ b/net/netfilter/nf_tables_api.c +@@ -488,48 +488,71 @@ static inline u64 nf_tables_alloc_handle(struct nft_table *table) + + static const struct nft_chain_type *chain_type[NFPROTO_NUMPROTO][NFT_CHAIN_T_MAX]; + ++static const struct nft_chain_type * ++__nft_chain_type_get(u8 family, enum nft_chain_types type) ++{ ++ if (family >= NFPROTO_NUMPROTO || ++ type >= NFT_CHAIN_T_MAX) ++ return NULL; ++ ++ return chain_type[family][type]; ++} ++ + static const struct nft_chain_type * + __nf_tables_chain_type_lookup(const struct nlattr *nla, u8 family) + { ++ const struct nft_chain_type *type; + int i; + + for (i = 0; i < NFT_CHAIN_T_MAX; i++) { +- if (chain_type[family][i] != NULL && +- !nla_strcmp(nla, chain_type[family][i]->name)) +- return chain_type[family][i]; ++ type = __nft_chain_type_get(family, i); ++ if (!type) ++ continue; ++ if (!nla_strcmp(nla, type->name)) ++ return type; + } + return NULL; + } + +-/* +- * Loading a module requires dropping mutex that guards the transaction. +- * A different client might race to start a new transaction meanwhile. Zap the +- * list of pending transaction and then restore it once the mutex is grabbed +- * again. Users of this function return EAGAIN which implicitly triggers the +- * transaction abort path to clean up the list of pending transactions. +- */ ++struct nft_module_request { ++ struct list_head list; ++ char module[MODULE_NAME_LEN]; ++ bool done; ++}; ++ + #ifdef CONFIG_MODULES +-static void nft_request_module(struct net *net, const char *fmt, ...) ++static int nft_request_module(struct net *net, const char *fmt, ...) + { + char module_name[MODULE_NAME_LEN]; +- LIST_HEAD(commit_list); ++ struct nft_module_request *req; + va_list args; + int ret; + +- list_splice_init(&net->nft.commit_list, &commit_list); +- + va_start(args, fmt); + ret = vsnprintf(module_name, MODULE_NAME_LEN, fmt, args); + va_end(args); + if (ret >= MODULE_NAME_LEN) +- return; ++ return 0; + +- mutex_unlock(&net->nft.commit_mutex); +- request_module("%s", module_name); +- mutex_lock(&net->nft.commit_mutex); ++ list_for_each_entry(req, &net->nft.module_list, list) { ++ if (!strcmp(req->module, module_name)) { ++ if (req->done) ++ return 0; + +- WARN_ON_ONCE(!list_empty(&net->nft.commit_list)); +- list_splice(&commit_list, &net->nft.commit_list); ++ /* A request to load this module already exists. */ ++ return -EAGAIN; ++ } ++ } ++ ++ req = kmalloc(sizeof(*req), GFP_KERNEL); ++ if (!req) ++ return -ENOMEM; ++ ++ req->done = false; ++ strlcpy(req->module, module_name, MODULE_NAME_LEN); ++ list_add_tail(&req->list, &net->nft.module_list); ++ ++ return -EAGAIN; + } + #endif + +@@ -553,10 +576,9 @@ nf_tables_chain_type_lookup(struct net *net, const struct nlattr *nla, + lockdep_nfnl_nft_mutex_not_held(); + #ifdef CONFIG_MODULES + if (autoload) { +- nft_request_module(net, "nft-chain-%u-%.*s", family, +- nla_len(nla), (const char *)nla_data(nla)); +- type = __nf_tables_chain_type_lookup(nla, family); +- if (type != NULL) ++ if (nft_request_module(net, "nft-chain-%u-%.*s", family, ++ nla_len(nla), ++ (const char *)nla_data(nla)) == -EAGAIN) + return ERR_PTR(-EAGAIN); + } + #endif +@@ -1095,11 +1117,8 @@ static void nf_tables_table_destroy(struct nft_ctx *ctx) + + void nft_register_chain_type(const struct nft_chain_type *ctype) + { +- if (WARN_ON(ctype->family >= NFPROTO_NUMPROTO)) +- return; +- + nfnl_lock(NFNL_SUBSYS_NFTABLES); +- if (WARN_ON(chain_type[ctype->family][ctype->type] != NULL)) { ++ if (WARN_ON(__nft_chain_type_get(ctype->family, ctype->type))) { + nfnl_unlock(NFNL_SUBSYS_NFTABLES); + return; + } +@@ -1551,7 +1570,10 @@ static int nft_chain_parse_hook(struct net *net, + hook->num = ntohl(nla_get_be32(ha[NFTA_HOOK_HOOKNUM])); + hook->priority = ntohl(nla_get_be32(ha[NFTA_HOOK_PRIORITY])); + +- type = chain_type[family][NFT_CHAIN_T_DEFAULT]; ++ type = __nft_chain_type_get(family, NFT_CHAIN_T_DEFAULT); ++ if (!type) ++ return -EOPNOTSUPP; ++ + if (nla[NFTA_CHAIN_TYPE]) { + type = nf_tables_chain_type_lookup(net, nla[NFTA_CHAIN_TYPE], + family, autoload); +@@ -2060,9 +2082,8 @@ static const struct nft_expr_type *__nft_expr_type_get(u8 family, + static int nft_expr_type_request_module(struct net *net, u8 family, + struct nlattr *nla) + { +- nft_request_module(net, "nft-expr-%u-%.*s", family, +- nla_len(nla), (char *)nla_data(nla)); +- if (__nft_expr_type_get(family, nla)) ++ if (nft_request_module(net, "nft-expr-%u-%.*s", family, ++ nla_len(nla), (char *)nla_data(nla)) == -EAGAIN) + return -EAGAIN; + + return 0; +@@ -2088,9 +2109,9 @@ static const struct nft_expr_type *nft_expr_type_get(struct net *net, + if (nft_expr_type_request_module(net, family, nla) == -EAGAIN) + return ERR_PTR(-EAGAIN); + +- nft_request_module(net, "nft-expr-%.*s", +- nla_len(nla), (char *)nla_data(nla)); +- if (__nft_expr_type_get(family, nla)) ++ if (nft_request_module(net, "nft-expr-%.*s", ++ nla_len(nla), ++ (char *)nla_data(nla)) == -EAGAIN) + return ERR_PTR(-EAGAIN); + } + #endif +@@ -2181,9 +2202,10 @@ static int nf_tables_expr_parse(const struct nft_ctx *ctx, + err = PTR_ERR(ops); + #ifdef CONFIG_MODULES + if (err == -EAGAIN) +- nft_expr_type_request_module(ctx->net, +- ctx->family, +- tb[NFTA_EXPR_NAME]); ++ if (nft_expr_type_request_module(ctx->net, ++ ctx->family, ++ tb[NFTA_EXPR_NAME]) != -EAGAIN) ++ err = -ENOENT; + #endif + goto err1; + } +@@ -3020,8 +3042,7 @@ nft_select_set_ops(const struct nft_ctx *ctx, + lockdep_nfnl_nft_mutex_not_held(); + #ifdef CONFIG_MODULES + if (list_empty(&nf_tables_set_types)) { +- nft_request_module(ctx->net, "nft-set"); +- if (!list_empty(&nf_tables_set_types)) ++ if (nft_request_module(ctx->net, "nft-set") == -EAGAIN) + return ERR_PTR(-EAGAIN); + } + #endif +@@ -5147,8 +5168,7 @@ nft_obj_type_get(struct net *net, u32 objtype) + lockdep_nfnl_nft_mutex_not_held(); + #ifdef CONFIG_MODULES + if (type == NULL) { +- nft_request_module(net, "nft-obj-%u", objtype); +- if (__nft_obj_type_get(objtype)) ++ if (nft_request_module(net, "nft-obj-%u", objtype) == -EAGAIN) + return ERR_PTR(-EAGAIN); + } + #endif +@@ -5764,8 +5784,7 @@ nft_flowtable_type_get(struct net *net, u8 family) + lockdep_nfnl_nft_mutex_not_held(); + #ifdef CONFIG_MODULES + if (type == NULL) { +- nft_request_module(net, "nf-flowtable-%u", family); +- if (__nft_flowtable_type_get(family)) ++ if (nft_request_module(net, "nf-flowtable-%u", family) == -EAGAIN) + return ERR_PTR(-EAGAIN); + } + #endif +@@ -6712,6 +6731,18 @@ static void nft_chain_del(struct nft_chain *chain) + list_del_rcu(&chain->list); + } + ++static void nf_tables_module_autoload_cleanup(struct net *net) ++{ ++ struct nft_module_request *req, *next; ++ ++ WARN_ON_ONCE(!list_empty(&net->nft.commit_list)); ++ list_for_each_entry_safe(req, next, &net->nft.module_list, list) { ++ WARN_ON_ONCE(!req->done); ++ list_del(&req->list); ++ kfree(req); ++ } ++} ++ + static void nf_tables_commit_release(struct net *net) + { + struct nft_trans *trans; +@@ -6724,6 +6755,7 @@ static void nf_tables_commit_release(struct net *net) + * to prevent expensive synchronize_rcu() in commit phase. + */ + if (list_empty(&net->nft.commit_list)) { ++ nf_tables_module_autoload_cleanup(net); + mutex_unlock(&net->nft.commit_mutex); + return; + } +@@ -6738,6 +6770,7 @@ static void nf_tables_commit_release(struct net *net) + list_splice_tail_init(&net->nft.commit_list, &nf_tables_destroy_list); + spin_unlock(&nf_tables_destroy_list_lock); + ++ nf_tables_module_autoload_cleanup(net); + mutex_unlock(&net->nft.commit_mutex); + + schedule_work(&trans_destroy_work); +@@ -6929,6 +6962,26 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) + return 0; + } + ++static void nf_tables_module_autoload(struct net *net) ++{ ++ struct nft_module_request *req, *next; ++ LIST_HEAD(module_list); ++ ++ list_splice_init(&net->nft.module_list, &module_list); ++ mutex_unlock(&net->nft.commit_mutex); ++ list_for_each_entry_safe(req, next, &module_list, list) { ++ if (req->done) { ++ list_del(&req->list); ++ kfree(req); ++ } else { ++ request_module("%s", req->module); ++ req->done = true; ++ } ++ } ++ mutex_lock(&net->nft.commit_mutex); ++ list_splice(&module_list, &net->nft.module_list); ++} ++ + static void nf_tables_abort_release(struct nft_trans *trans) + { + switch (trans->msg_type) { +@@ -6958,7 +7011,7 @@ static void nf_tables_abort_release(struct nft_trans *trans) + kfree(trans); + } + +-static int __nf_tables_abort(struct net *net) ++static int __nf_tables_abort(struct net *net, bool autoload) + { + struct nft_trans *trans, *next; + struct nft_trans_elem *te; +@@ -7080,6 +7133,11 @@ static int __nf_tables_abort(struct net *net) + nf_tables_abort_release(trans); + } + ++ if (autoload) ++ nf_tables_module_autoload(net); ++ else ++ nf_tables_module_autoload_cleanup(net); ++ + return 0; + } + +@@ -7088,9 +7146,9 @@ static void nf_tables_cleanup(struct net *net) + nft_validate_state_update(net, NFT_VALIDATE_SKIP); + } + +-static int nf_tables_abort(struct net *net, struct sk_buff *skb) ++static int nf_tables_abort(struct net *net, struct sk_buff *skb, bool autoload) + { +- int ret = __nf_tables_abort(net); ++ int ret = __nf_tables_abort(net, autoload); + + mutex_unlock(&net->nft.commit_mutex); + +@@ -7685,6 +7743,7 @@ static int __net_init nf_tables_init_net(struct net *net) + { + INIT_LIST_HEAD(&net->nft.tables); + INIT_LIST_HEAD(&net->nft.commit_list); ++ INIT_LIST_HEAD(&net->nft.module_list); + mutex_init(&net->nft.commit_mutex); + net->nft.base_seq = 1; + net->nft.validate_state = NFT_VALIDATE_SKIP; +@@ -7696,7 +7755,7 @@ static void __net_exit nf_tables_exit_net(struct net *net) + { + mutex_lock(&net->nft.commit_mutex); + if (!list_empty(&net->nft.commit_list)) +- __nf_tables_abort(net); ++ __nf_tables_abort(net, false); + __nft_release_tables(net); + mutex_unlock(&net->nft.commit_mutex); + WARN_ON_ONCE(!list_empty(&net->nft.tables)); +diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c +index 4abbb452cf6c..99127e2d95a8 100644 +--- a/net/netfilter/nfnetlink.c ++++ b/net/netfilter/nfnetlink.c +@@ -476,7 +476,7 @@ ack: + } + done: + if (status & NFNL_BATCH_REPLAY) { +- ss->abort(net, oskb); ++ ss->abort(net, oskb, true); + nfnl_err_reset(&err_list); + kfree_skb(skb); + module_put(ss->owner); +@@ -487,11 +487,11 @@ done: + status |= NFNL_BATCH_REPLAY; + goto done; + } else if (err) { +- ss->abort(net, oskb); ++ ss->abort(net, oskb, false); + netlink_ack(oskb, nlmsg_hdr(oskb), err, NULL); + } + } else { +- ss->abort(net, oskb); ++ ss->abort(net, oskb, false); + } + if (ss->cleanup) + ss->cleanup(net); +diff --git a/net/netfilter/nft_osf.c b/net/netfilter/nft_osf.c +index f54d6ae15bb1..b42247aa48a9 100644 +--- a/net/netfilter/nft_osf.c ++++ b/net/netfilter/nft_osf.c +@@ -61,6 +61,9 @@ static int nft_osf_init(const struct nft_ctx *ctx, + int err; + u8 ttl; + ++ if (!tb[NFTA_OSF_DREG]) ++ return -EINVAL; ++ + if (tb[NFTA_OSF_TTL]) { + ttl = nla_get_u8(tb[NFTA_OSF_TTL]); + if (ttl > 2) +diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c +index 76e0d122616a..c2cdd0fc2e70 100644 +--- a/net/sched/cls_api.c ++++ b/net/sched/cls_api.c +@@ -2055,9 +2055,8 @@ replay: + &chain_info)); + + mutex_unlock(&chain->filter_chain_lock); +- tp_new = tcf_proto_create(nla_data(tca[TCA_KIND]), +- protocol, prio, chain, rtnl_held, +- extack); ++ tp_new = tcf_proto_create(name, protocol, prio, chain, ++ rtnl_held, extack); + if (IS_ERR(tp_new)) { + err = PTR_ERR(tp_new); + goto errout_tp; +diff --git a/net/sched/ematch.c b/net/sched/ematch.c +index 8f2ad706784d..d0140a92694a 100644 +--- a/net/sched/ematch.c ++++ b/net/sched/ematch.c +@@ -263,12 +263,12 @@ static int tcf_em_validate(struct tcf_proto *tp, + } + em->data = (unsigned long) v; + } ++ em->datalen = data_len; + } + } + + em->matchid = em_hdr->matchid; + em->flags = em_hdr->flags; +- em->datalen = data_len; + em->net = net; + + err = 0; +diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c +index a80920f261ca..41e9c2932b34 100644 +--- a/net/tls/tls_sw.c ++++ b/net/tls/tls_sw.c +@@ -793,7 +793,7 @@ static int bpf_exec_tx_verdict(struct sk_msg *msg, struct sock *sk, + psock = sk_psock_get(sk); + if (!psock || !policy) { + err = tls_push_record(sk, flags, record_type); +- if (err) { ++ if (err && err != -EINPROGRESS) { + *copied -= sk_msg_free(sk, msg); + tls_free_open_rec(sk); + } +@@ -819,7 +819,7 @@ more_data: + switch (psock->eval) { + case __SK_PASS: + err = tls_push_record(sk, flags, record_type); +- if (err < 0) { ++ if (err && err != -EINPROGRESS) { + *copied -= sk_msg_free(sk, msg); + tls_free_open_rec(sk); + goto out_err; +diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c +index 6aee9f5e8e71..256f3e97d1f3 100644 +--- a/net/x25/af_x25.c ++++ b/net/x25/af_x25.c +@@ -760,6 +760,10 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr, + if (sk->sk_state == TCP_ESTABLISHED) + goto out; + ++ rc = -EALREADY; /* Do nothing if call is already in progress */ ++ if (sk->sk_state == TCP_SYN_SENT) ++ goto out; ++ + sk->sk_state = TCP_CLOSE; + sock->state = SS_UNCONNECTED; + +@@ -806,7 +810,7 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr, + /* Now the loop */ + rc = -EINPROGRESS; + if (sk->sk_state != TCP_ESTABLISHED && (flags & O_NONBLOCK)) +- goto out_put_neigh; ++ goto out; + + rc = x25_wait_for_connection_establishment(sk); + if (rc) +diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c +index 612268eabef4..7225107a9aaf 100644 +--- a/scripts/recordmcount.c ++++ b/scripts/recordmcount.c +@@ -38,6 +38,10 @@ + #define R_AARCH64_ABS64 257 + #endif + ++#define R_ARM_PC24 1 ++#define R_ARM_THM_CALL 10 ++#define R_ARM_CALL 28 ++ + static int fd_map; /* File descriptor for file being modified. */ + static int mmap_failed; /* Boolean flag. */ + static char gpfx; /* prefix for global symbol name (sometimes '_') */ +@@ -418,6 +422,18 @@ static char const *already_has_rel_mcount = "success"; /* our work here is done! + #define RECORD_MCOUNT_64 + #include "recordmcount.h" + ++static int arm_is_fake_mcount(Elf32_Rel const *rp) ++{ ++ switch (ELF32_R_TYPE(w(rp->r_info))) { ++ case R_ARM_THM_CALL: ++ case R_ARM_CALL: ++ case R_ARM_PC24: ++ return 0; ++ } ++ ++ return 1; ++} ++ + /* 64-bit EM_MIPS has weird ELF64_Rela.r_info. + * http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf + * We interpret Table 29 Relocation Operation (Elf64_Rel, Elf64_Rela) [p.40] +@@ -523,6 +539,7 @@ static int do_file(char const *const fname) + altmcount = "__gnu_mcount_nc"; + make_nop = make_nop_arm; + rel_type_nop = R_ARM_NONE; ++ is_fake_mcount32 = arm_is_fake_mcount; + gpfx = 0; + break; + case EM_AARCH64: diff --git a/patch/kernel/odroidxu4-current/03-patch-5.4.16-17.patch b/patch/kernel/odroidxu4-current/03-patch-5.4.16-17.patch new file mode 100644 index 000000000..3a901e1bd --- /dev/null +++ b/patch/kernel/odroidxu4-current/03-patch-5.4.16-17.patch @@ -0,0 +1,4118 @@ +diff --git a/Makefile b/Makefile +index e16d2e58ed4b..a363a539a092 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 16 ++SUBLEVEL = 17 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/arch/arc/plat-eznps/Kconfig b/arch/arc/plat-eznps/Kconfig +index a376a50d3fea..a931d0a256d0 100644 +--- a/arch/arc/plat-eznps/Kconfig ++++ b/arch/arc/plat-eznps/Kconfig +@@ -7,7 +7,7 @@ + menuconfig ARC_PLAT_EZNPS + bool "\"EZchip\" ARC dev platform" + select CPU_BIG_ENDIAN +- select CLKSRC_NPS ++ select CLKSRC_NPS if !PHYS_ADDR_T_64BIT + select EZNPS_GIC + select EZCHIP_NPS_MANAGEMENT_ENET if ETHERNET + help +diff --git a/arch/arm/configs/aspeed_g5_defconfig b/arch/arm/configs/aspeed_g5_defconfig +index 597536cc9573..b87508c7056c 100644 +--- a/arch/arm/configs/aspeed_g5_defconfig ++++ b/arch/arm/configs/aspeed_g5_defconfig +@@ -139,6 +139,7 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=6 + CONFIG_SERIAL_8250_EXTENDED=y + CONFIG_SERIAL_8250_ASPEED_VUART=y + CONFIG_SERIAL_8250_SHARE_IRQ=y ++CONFIG_SERIAL_8250_DW=y + CONFIG_SERIAL_OF_PLATFORM=y + CONFIG_ASPEED_KCS_IPMI_BMC=y + CONFIG_ASPEED_BT_IPMI_BMC=y +diff --git a/arch/arm64/kvm/debug.c b/arch/arm64/kvm/debug.c +index 43487f035385..7a7e425616b5 100644 +--- a/arch/arm64/kvm/debug.c ++++ b/arch/arm64/kvm/debug.c +@@ -101,7 +101,7 @@ void kvm_arm_reset_debug_ptr(struct kvm_vcpu *vcpu) + void kvm_arm_setup_debug(struct kvm_vcpu *vcpu) + { + bool trap_debug = !(vcpu->arch.flags & KVM_ARM64_DEBUG_DIRTY); +- unsigned long mdscr; ++ unsigned long mdscr, orig_mdcr_el2 = vcpu->arch.mdcr_el2; + + trace_kvm_arm_setup_debug(vcpu, vcpu->guest_debug); + +@@ -197,6 +197,10 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu) + if (vcpu_read_sys_reg(vcpu, MDSCR_EL1) & (DBG_MDSCR_KDE | DBG_MDSCR_MDE)) + vcpu->arch.flags |= KVM_ARM64_DEBUG_DIRTY; + ++ /* Write mdcr_el2 changes since vcpu_load on VHE systems */ ++ if (has_vhe() && orig_mdcr_el2 != vcpu->arch.mdcr_el2) ++ write_sysreg(vcpu->arch.mdcr_el2, mdcr_el2); ++ + trace_kvm_arm_set_dreg32("MDCR_EL2", vcpu->arch.mdcr_el2); + trace_kvm_arm_set_dreg32("MDSCR_EL1", vcpu_read_sys_reg(vcpu, MDSCR_EL1)); + } +diff --git a/arch/um/include/asm/common.lds.S b/arch/um/include/asm/common.lds.S +index d7086b985f27..4049f2c46387 100644 +--- a/arch/um/include/asm/common.lds.S ++++ b/arch/um/include/asm/common.lds.S +@@ -83,8 +83,8 @@ + __preinit_array_end = .; + } + .init_array : { +- /* dummy - we call this ourselves */ + __init_array_start = .; ++ *(.init_array) + __init_array_end = .; + } + .fini_array : { +diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S +index c69d69ee96be..f5001481010c 100644 +--- a/arch/um/kernel/dyn.lds.S ++++ b/arch/um/kernel/dyn.lds.S +@@ -103,6 +103,7 @@ SECTIONS + be empty, which isn't pretty. */ + . = ALIGN(32 / 8); + .preinit_array : { *(.preinit_array) } ++ .init_array : { *(.init_array) } + .fini_array : { *(.fini_array) } + .data : { + INIT_TASK_DATA(KERNEL_STACK_SIZE) +diff --git a/crypto/af_alg.c b/crypto/af_alg.c +index 0dceaabc6321..3d8e53010cda 100644 +--- a/crypto/af_alg.c ++++ b/crypto/af_alg.c +@@ -134,11 +134,13 @@ void af_alg_release_parent(struct sock *sk) + sk = ask->parent; + ask = alg_sk(sk); + +- lock_sock(sk); ++ local_bh_disable(); ++ bh_lock_sock(sk); + ask->nokey_refcnt -= nokey; + if (!last) + last = !--ask->refcnt; +- release_sock(sk); ++ bh_unlock_sock(sk); ++ local_bh_enable(); + + if (last) + sock_put(sk); +diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c +index 543792e0ebf0..81bbea7f2ba6 100644 +--- a/crypto/pcrypt.c ++++ b/crypto/pcrypt.c +@@ -362,11 +362,12 @@ err: + + static void __exit pcrypt_exit(void) + { ++ crypto_unregister_template(&pcrypt_tmpl); ++ + pcrypt_fini_padata(pencrypt); + pcrypt_fini_padata(pdecrypt); + + kset_unregister(pcrypt_kset); +- crypto_unregister_template(&pcrypt_tmpl); + } + + subsys_initcall(pcrypt_init); +diff --git a/drivers/android/binder.c b/drivers/android/binder.c +index 976a69420c16..254f87b627fe 100644 +--- a/drivers/android/binder.c ++++ b/drivers/android/binder.c +@@ -5203,10 +5203,11 @@ err_bad_arg: + + static int binder_open(struct inode *nodp, struct file *filp) + { +- struct binder_proc *proc; ++ struct binder_proc *proc, *itr; + struct binder_device *binder_dev; + struct binderfs_info *info; + struct dentry *binder_binderfs_dir_entry_proc = NULL; ++ bool existing_pid = false; + + binder_debug(BINDER_DEBUG_OPEN_CLOSE, "%s: %d:%d\n", __func__, + current->group_leader->pid, current->pid); +@@ -5239,19 +5240,24 @@ static int binder_open(struct inode *nodp, struct file *filp) + filp->private_data = proc; + + mutex_lock(&binder_procs_lock); ++ hlist_for_each_entry(itr, &binder_procs, proc_node) { ++ if (itr->pid == proc->pid) { ++ existing_pid = true; ++ break; ++ } ++ } + hlist_add_head(&proc->proc_node, &binder_procs); + mutex_unlock(&binder_procs_lock); + +- if (binder_debugfs_dir_entry_proc) { ++ if (binder_debugfs_dir_entry_proc && !existing_pid) { + char strbuf[11]; + + snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); + /* +- * proc debug entries are shared between contexts, so +- * this will fail if the process tries to open the driver +- * again with a different context. The priting code will +- * anyway print all contexts that a given PID has, so this +- * is not a problem. ++ * proc debug entries are shared between contexts. ++ * Only create for the first PID to avoid debugfs log spamming ++ * The printing code will anyway print all contexts for a given ++ * PID so this is not a problem. + */ + proc->debugfs_entry = debugfs_create_file(strbuf, 0444, + binder_debugfs_dir_entry_proc, +@@ -5259,19 +5265,16 @@ static int binder_open(struct inode *nodp, struct file *filp) + &proc_fops); + } + +- if (binder_binderfs_dir_entry_proc) { ++ if (binder_binderfs_dir_entry_proc && !existing_pid) { + char strbuf[11]; + struct dentry *binderfs_entry; + + snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); + /* + * Similar to debugfs, the process specific log file is shared +- * between contexts. If the file has already been created for a +- * process, the following binderfs_create_file() call will +- * fail with error code EEXIST if another context of the same +- * process invoked binder_open(). This is ok since same as +- * debugfs, the log file will contain information on all +- * contexts of a given PID. ++ * between contexts. Only create for the first PID. ++ * This is ok since same as debugfs, the log file will contain ++ * information on all contexts of a given PID. + */ + binderfs_entry = binderfs_create_file(binder_binderfs_dir_entry_proc, + strbuf, &proc_fops, (void *)(unsigned long)proc->pid); +@@ -5281,10 +5284,8 @@ static int binder_open(struct inode *nodp, struct file *filp) + int error; + + error = PTR_ERR(binderfs_entry); +- if (error != -EEXIST) { +- pr_warn("Unable to create file %s in binderfs (error %d)\n", +- strbuf, error); +- } ++ pr_warn("Unable to create file %s in binderfs (error %d)\n", ++ strbuf, error); + } + } + +diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c +index b23d1e4bad33..9d0d65efcd94 100644 +--- a/drivers/atm/eni.c ++++ b/drivers/atm/eni.c +@@ -374,7 +374,7 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb, + here = (eni_vcc->descr+skip) & (eni_vcc->words-1); + dma[j++] = (here << MID_DMA_COUNT_SHIFT) | (vcc->vci + << MID_DMA_VCI_SHIFT) | MID_DT_JK; +- j++; ++ dma[j++] = 0; + } + here = (eni_vcc->descr+size+skip) & (eni_vcc->words-1); + if (!eff) size += skip; +@@ -447,7 +447,7 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb, + if (size != eff) { + dma[j++] = (here << MID_DMA_COUNT_SHIFT) | + (vcc->vci << MID_DMA_VCI_SHIFT) | MID_DT_JK; +- j++; ++ dma[j++] = 0; + } + if (!j || j > 2*RX_DMA_BUF) { + printk(KERN_CRIT DEV_LABEL "!j or j too big!!!\n"); +diff --git a/drivers/base/component.c b/drivers/base/component.c +index 532a3a5d8f63..1fdbd6ff2058 100644 +--- a/drivers/base/component.c ++++ b/drivers/base/component.c +@@ -102,11 +102,11 @@ static int component_devices_show(struct seq_file *s, void *data) + seq_printf(s, "%-40s %20s\n", "device name", "status"); + seq_puts(s, "-------------------------------------------------------------\n"); + for (i = 0; i < match->num; i++) { +- struct device *d = (struct device *)match->compare[i].data; ++ struct component *component = match->compare[i].component; + +- seq_printf(s, "%-40s %20s\n", dev_name(d), +- match->compare[i].component ? +- "registered" : "not registered"); ++ seq_printf(s, "%-40s %20s\n", ++ component ? dev_name(component->dev) : "(unknown)", ++ component ? (component->bound ? "bound" : "not bound") : "not registered"); + } + mutex_unlock(&component_mutex); + +diff --git a/drivers/base/test/test_async_driver_probe.c b/drivers/base/test/test_async_driver_probe.c +index f4b1d8e54daf..3bb7beb127a9 100644 +--- a/drivers/base/test/test_async_driver_probe.c ++++ b/drivers/base/test/test_async_driver_probe.c +@@ -44,7 +44,8 @@ static int test_probe(struct platform_device *pdev) + * performing an async init on that node. + */ + if (dev->driver->probe_type == PROBE_PREFER_ASYNCHRONOUS) { +- if (dev_to_node(dev) != numa_node_id()) { ++ if (IS_ENABLED(CONFIG_NUMA) && ++ dev_to_node(dev) != numa_node_id()) { + dev_warn(dev, "NUMA node mismatch %d != %d\n", + dev_to_node(dev), numa_node_id()); + atomic_inc(&warnings); +diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c +index 2d2e6d862068..f02a4bdc0ca7 100644 +--- a/drivers/bluetooth/btbcm.c ++++ b/drivers/bluetooth/btbcm.c +@@ -440,6 +440,12 @@ int btbcm_finalize(struct hci_dev *hdev) + + set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); + ++ /* Some devices ship with the controller default address. ++ * Allow the bootloader to set a valid address through the ++ * device tree. ++ */ ++ set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); ++ + return 0; + } + EXPORT_SYMBOL_GPL(btbcm_finalize); +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c +index 04cf767d0708..4e7ef35f1c8f 100644 +--- a/drivers/bluetooth/btusb.c ++++ b/drivers/bluetooth/btusb.c +@@ -2585,7 +2585,7 @@ static void btusb_mtk_wmt_recv(struct urb *urb) + * and being processed the events from there then. + */ + if (test_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags)) { +- data->evt_skb = skb_clone(skb, GFP_KERNEL); ++ data->evt_skb = skb_clone(skb, GFP_ATOMIC); + if (!data->evt_skb) + goto err_out; + } +diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c +index abbf281ee337..d9846265a5cd 100644 +--- a/drivers/bus/ti-sysc.c ++++ b/drivers/bus/ti-sysc.c +@@ -923,6 +923,9 @@ set_midle: + return -EINVAL; + } + ++ if (ddata->cfg.quirks & SYSC_QUIRK_SWSUP_MSTANDBY) ++ best_mode = SYSC_IDLE_NO; ++ + reg &= ~(SYSC_IDLE_MASK << regbits->midle_shift); + reg |= best_mode << regbits->midle_shift; + sysc_write(ddata, ddata->offsets[SYSC_SYSCONFIG], reg); +@@ -984,6 +987,10 @@ static int sysc_disable_module(struct device *dev) + return ret; + } + ++ if (ddata->cfg.quirks & (SYSC_QUIRK_SWSUP_MSTANDBY) || ++ ddata->cfg.quirks & (SYSC_QUIRK_FORCE_MSTANDBY)) ++ best_mode = SYSC_IDLE_FORCE; ++ + reg &= ~(SYSC_IDLE_MASK << regbits->midle_shift); + reg |= best_mode << regbits->midle_shift; + sysc_write(ddata, ddata->offsets[SYSC_SYSCONFIG], reg); +@@ -1242,6 +1249,8 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { + SYSC_QUIRK_SWSUP_SIDLE), + + /* Quirks that need to be set based on detected module */ ++ SYSC_QUIRK("aess", 0, 0, 0x10, -1, 0x40000000, 0xffffffff, ++ SYSC_MODULE_QUIRK_AESS), + SYSC_QUIRK("hdq1w", 0, 0, 0x14, 0x18, 0x00000006, 0xffffffff, + SYSC_MODULE_QUIRK_HDQ1W), + SYSC_QUIRK("hdq1w", 0, 0, 0x14, 0x18, 0x0000000a, 0xffffffff, +@@ -1257,6 +1266,10 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { + SYSC_QUIRK("gpu", 0x50000000, 0x14, -1, -1, 0x00010201, 0xffffffff, 0), + SYSC_QUIRK("gpu", 0x50000000, 0xfe00, 0xfe10, -1, 0x40000000 , 0xffffffff, + SYSC_MODULE_QUIRK_SGX), ++ SYSC_QUIRK("usb_otg_hs", 0, 0x400, 0x404, 0x408, 0x00000050, ++ 0xffffffff, SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), ++ SYSC_QUIRK("usb_otg_hs", 0, 0, 0x10, -1, 0x4ea2080d, 0xffffffff, ++ SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY), + SYSC_QUIRK("wdt", 0, 0, 0x10, 0x14, 0x502a0500, 0xfffff0f0, + SYSC_MODULE_QUIRK_WDT), + /* Watchdog on am3 and am4 */ +@@ -1266,7 +1279,6 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { + #ifdef DEBUG + SYSC_QUIRK("adc", 0, 0, 0x10, -1, 0x47300001, 0xffffffff, 0), + SYSC_QUIRK("atl", 0, 0, -1, -1, 0x0a070100, 0xffffffff, 0), +- SYSC_QUIRK("aess", 0, 0, 0x10, -1, 0x40000000, 0xffffffff, 0), + SYSC_QUIRK("cm", 0, 0, -1, -1, 0x40000301, 0xffffffff, 0), + SYSC_QUIRK("control", 0, 0, 0x10, -1, 0x40000900, 0xffffffff, 0), + SYSC_QUIRK("cpgmac", 0, 0x1200, 0x1208, 0x1204, 0x4edb1902, +@@ -1315,8 +1327,6 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { + SYSC_QUIRK("usbhstll", 0, 0, 0x10, 0x14, 0x00000008, 0xffffffff, 0), + SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, 0x14, 0x50700100, 0xffffffff, 0), + SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, -1, 0x50700101, 0xffffffff, 0), +- SYSC_QUIRK("usb_otg_hs", 0, 0x400, 0x404, 0x408, 0x00000050, +- 0xffffffff, 0), + SYSC_QUIRK("vfpe", 0, 0, 0x104, -1, 0x4d001200, 0xffffffff, 0), + #endif + }; +@@ -1400,6 +1410,14 @@ static void sysc_clk_enable_quirk_hdq1w(struct sysc *ddata) + sysc_write(ddata, offset, val); + } + ++/* AESS (Audio Engine SubSystem) needs autogating set after enable */ ++static void sysc_module_enable_quirk_aess(struct sysc *ddata) ++{ ++ int offset = 0x7c; /* AESS_AUTO_GATING_ENABLE */ ++ ++ sysc_write(ddata, offset, 1); ++} ++ + /* I2C needs extra enable bit toggling for reset */ + static void sysc_clk_quirk_i2c(struct sysc *ddata, bool enable) + { +@@ -1482,6 +1500,9 @@ static void sysc_init_module_quirks(struct sysc *ddata) + return; + } + ++ if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_AESS) ++ ddata->module_enable_quirk = sysc_module_enable_quirk_aess; ++ + if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_SGX) + ddata->module_enable_quirk = sysc_module_enable_quirk_sgx; + +diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c +index db22777d59b4..62930351ccd9 100644 +--- a/drivers/crypto/caam/ctrl.c ++++ b/drivers/crypto/caam/ctrl.c +@@ -685,11 +685,9 @@ static int caam_probe(struct platform_device *pdev) + of_node_put(np); + + if (!ctrlpriv->mc_en) +- clrsetbits_32(&ctrl->mcr, MCFGR_AWCACHE_MASK | MCFGR_LONG_PTR, ++ clrsetbits_32(&ctrl->mcr, MCFGR_AWCACHE_MASK, + MCFGR_AWCACHE_CACH | MCFGR_AWCACHE_BUFF | +- MCFGR_WDENABLE | MCFGR_LARGE_BURST | +- (sizeof(dma_addr_t) == sizeof(u64) ? +- MCFGR_LONG_PTR : 0)); ++ MCFGR_WDENABLE | MCFGR_LARGE_BURST); + + handle_imx6_err005766(&ctrl->mcr); + +diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c +index 38ee38b37ae6..01dd418bdadc 100644 +--- a/drivers/crypto/chelsio/chcr_algo.c ++++ b/drivers/crypto/chelsio/chcr_algo.c +@@ -3194,9 +3194,6 @@ static int chcr_gcm_setauthsize(struct crypto_aead *tfm, unsigned int authsize) + aeadctx->mayverify = VERIFY_SW; + break; + default: +- +- crypto_tfm_set_flags((struct crypto_tfm *) tfm, +- CRYPTO_TFM_RES_BAD_KEY_LEN); + return -EINVAL; + } + return crypto_aead_setauthsize(aeadctx->sw_cipher, authsize); +@@ -3221,8 +3218,6 @@ static int chcr_4106_4309_setauthsize(struct crypto_aead *tfm, + aeadctx->mayverify = VERIFY_HW; + break; + default: +- crypto_tfm_set_flags((struct crypto_tfm *)tfm, +- CRYPTO_TFM_RES_BAD_KEY_LEN); + return -EINVAL; + } + return crypto_aead_setauthsize(aeadctx->sw_cipher, authsize); +@@ -3263,8 +3258,6 @@ static int chcr_ccm_setauthsize(struct crypto_aead *tfm, + aeadctx->mayverify = VERIFY_HW; + break; + default: +- crypto_tfm_set_flags((struct crypto_tfm *)tfm, +- CRYPTO_TFM_RES_BAD_KEY_LEN); + return -EINVAL; + } + return crypto_aead_setauthsize(aeadctx->sw_cipher, authsize); +@@ -3289,8 +3282,7 @@ static int chcr_ccm_common_setkey(struct crypto_aead *aead, + ck_size = CHCR_KEYCTX_CIPHER_KEY_SIZE_256; + mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_256; + } else { +- crypto_tfm_set_flags((struct crypto_tfm *)aead, +- CRYPTO_TFM_RES_BAD_KEY_LEN); ++ crypto_aead_set_flags(aead, CRYPTO_TFM_RES_BAD_KEY_LEN); + aeadctx->enckey_len = 0; + return -EINVAL; + } +@@ -3328,8 +3320,7 @@ static int chcr_aead_rfc4309_setkey(struct crypto_aead *aead, const u8 *key, + int error; + + if (keylen < 3) { +- crypto_tfm_set_flags((struct crypto_tfm *)aead, +- CRYPTO_TFM_RES_BAD_KEY_LEN); ++ crypto_aead_set_flags(aead, CRYPTO_TFM_RES_BAD_KEY_LEN); + aeadctx->enckey_len = 0; + return -EINVAL; + } +@@ -3379,8 +3370,7 @@ static int chcr_gcm_setkey(struct crypto_aead *aead, const u8 *key, + } else if (keylen == AES_KEYSIZE_256) { + ck_size = CHCR_KEYCTX_CIPHER_KEY_SIZE_256; + } else { +- crypto_tfm_set_flags((struct crypto_tfm *)aead, +- CRYPTO_TFM_RES_BAD_KEY_LEN); ++ crypto_aead_set_flags(aead, CRYPTO_TFM_RES_BAD_KEY_LEN); + pr_err("GCM: Invalid key length %d\n", keylen); + ret = -EINVAL; + goto out; +diff --git a/drivers/crypto/vmx/aes_xts.c b/drivers/crypto/vmx/aes_xts.c +index d59e736882f6..9fee1b1532a4 100644 +--- a/drivers/crypto/vmx/aes_xts.c ++++ b/drivers/crypto/vmx/aes_xts.c +@@ -84,6 +84,9 @@ static int p8_aes_xts_crypt(struct skcipher_request *req, int enc) + u8 tweak[AES_BLOCK_SIZE]; + int ret; + ++ if (req->cryptlen < AES_BLOCK_SIZE) ++ return -EINVAL; ++ + if (!crypto_simd_usable() || (req->cryptlen % XTS_BLOCK_SIZE) != 0) { + struct skcipher_request *subreq = skcipher_request_ctx(req); + +diff --git a/drivers/extcon/extcon-intel-cht-wc.c b/drivers/extcon/extcon-intel-cht-wc.c +index 9d32150e68db..771f6f4cf92e 100644 +--- a/drivers/extcon/extcon-intel-cht-wc.c ++++ b/drivers/extcon/extcon-intel-cht-wc.c +@@ -338,6 +338,7 @@ static int cht_wc_extcon_probe(struct platform_device *pdev) + struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent); + struct cht_wc_extcon_data *ext; + unsigned long mask = ~(CHT_WC_PWRSRC_VBUS | CHT_WC_PWRSRC_USBID_MASK); ++ int pwrsrc_sts, id; + int irq, ret; + + irq = platform_get_irq(pdev, 0); +@@ -387,8 +388,19 @@ static int cht_wc_extcon_probe(struct platform_device *pdev) + goto disable_sw_control; + } + +- /* Route D+ and D- to PMIC for initial charger detection */ +- cht_wc_extcon_set_phymux(ext, MUX_SEL_PMIC); ++ ret = regmap_read(ext->regmap, CHT_WC_PWRSRC_STS, &pwrsrc_sts); ++ if (ret) { ++ dev_err(ext->dev, "Error reading pwrsrc status: %d\n", ret); ++ goto disable_sw_control; ++ } ++ ++ /* ++ * If no USB host or device connected, route D+ and D- to PMIC for ++ * initial charger detection ++ */ ++ id = cht_wc_extcon_get_id(ext, pwrsrc_sts); ++ if (id != INTEL_USB_ID_GND) ++ cht_wc_extcon_set_phymux(ext, MUX_SEL_PMIC); + + /* Get initial state */ + cht_wc_extcon_pwrsrc_event(ext); +diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig +index ceb908f7dbe5..f9263426af03 100644 +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -1120,6 +1120,7 @@ config GPIO_MADERA + config GPIO_MAX77620 + tristate "GPIO support for PMIC MAX77620 and MAX20024" + depends on MFD_MAX77620 ++ select GPIOLIB_IRQCHIP + help + GPIO driver for MAX77620 and MAX20024 PMIC from Maxim Semiconductor. + MAX77620 PMIC has 8 pins that can be configured as GPIOs. The +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +index 33a1099e2f33..bb9a2771a0f9 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +@@ -1023,6 +1023,7 @@ static const struct pci_device_id pciidlist[] = { + + /* Navi12 */ + {0x1002, 0x7360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI12|AMD_EXP_HW_SUPPORT}, ++ {0x1002, 0x7362, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI12|AMD_EXP_HW_SUPPORT}, + + {0, 0, 0} + }; +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +index 4e9c15c409ba..360c87ba4595 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -3266,27 +3266,21 @@ get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing) + return color_space; + } + +-static void reduce_mode_colour_depth(struct dc_crtc_timing *timing_out) +-{ +- if (timing_out->display_color_depth <= COLOR_DEPTH_888) +- return; +- +- timing_out->display_color_depth--; +-} +- +-static void adjust_colour_depth_from_display_info(struct dc_crtc_timing *timing_out, +- const struct drm_display_info *info) ++static bool adjust_colour_depth_from_display_info( ++ struct dc_crtc_timing *timing_out, ++ const struct drm_display_info *info) + { ++ enum dc_color_depth depth = timing_out->display_color_depth; + int normalized_clk; +- if (timing_out->display_color_depth <= COLOR_DEPTH_888) +- return; + do { + normalized_clk = timing_out->pix_clk_100hz / 10; + /* YCbCr 4:2:0 requires additional adjustment of 1/2 */ + if (timing_out->pixel_encoding == PIXEL_ENCODING_YCBCR420) + normalized_clk /= 2; + /* Adjusting pix clock following on HDMI spec based on colour depth */ +- switch (timing_out->display_color_depth) { ++ switch (depth) { ++ case COLOR_DEPTH_888: ++ break; + case COLOR_DEPTH_101010: + normalized_clk = (normalized_clk * 30) / 24; + break; +@@ -3297,14 +3291,15 @@ static void adjust_colour_depth_from_display_info(struct dc_crtc_timing *timing_ + normalized_clk = (normalized_clk * 48) / 24; + break; + default: +- return; ++ /* The above depths are the only ones valid for HDMI. */ ++ return false; + } +- if (normalized_clk <= info->max_tmds_clock) +- return; +- reduce_mode_colour_depth(timing_out); +- +- } while (timing_out->display_color_depth > COLOR_DEPTH_888); +- ++ if (normalized_clk <= info->max_tmds_clock) { ++ timing_out->display_color_depth = depth; ++ return true; ++ } ++ } while (--depth > COLOR_DEPTH_666); ++ return false; + } + + static void fill_stream_properties_from_drm_display_mode( +@@ -3370,8 +3365,14 @@ static void fill_stream_properties_from_drm_display_mode( + + stream->out_transfer_func->type = TF_TYPE_PREDEFINED; + stream->out_transfer_func->tf = TRANSFER_FUNCTION_SRGB; +- if (stream->signal == SIGNAL_TYPE_HDMI_TYPE_A) +- adjust_colour_depth_from_display_info(timing_out, info); ++ if (stream->signal == SIGNAL_TYPE_HDMI_TYPE_A) { ++ if (!adjust_colour_depth_from_display_info(timing_out, info) && ++ drm_mode_is_420_also(info, mode_in) && ++ timing_out->pixel_encoding != PIXEL_ENCODING_YCBCR420) { ++ timing_out->pixel_encoding = PIXEL_ENCODING_YCBCR420; ++ adjust_colour_depth_from_display_info(timing_out, info); ++ } ++ } + } + + static void fill_audio_info(struct audio_info *audio_info, +diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c +index 8063b1d567b1..e6e4c841fb06 100644 +--- a/drivers/hid/hid-asus.c ++++ b/drivers/hid/hid-asus.c +@@ -261,7 +261,8 @@ static int asus_event(struct hid_device *hdev, struct hid_field *field, + struct hid_usage *usage, __s32 value) + { + if ((usage->hid & HID_USAGE_PAGE) == 0xff310000 && +- (usage->hid & HID_USAGE) != 0x00 && !usage->type) { ++ (usage->hid & HID_USAGE) != 0x00 && ++ (usage->hid & HID_USAGE) != 0xff && !usage->type) { + hid_warn(hdev, "Unmapped Asus vendor usagepage code 0x%02x\n", + usage->hid & HID_USAGE); + } +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h +index 6273e7178e78..5fc82029a03b 100644 +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -631,6 +631,7 @@ + #define USB_VENDOR_ID_ITE 0x048d + #define USB_DEVICE_ID_ITE_LENOVO_YOGA 0x8386 + #define USB_DEVICE_ID_ITE_LENOVO_YOGA2 0x8350 ++#define I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720 0x837a + #define USB_DEVICE_ID_ITE_LENOVO_YOGA900 0x8396 + #define USB_DEVICE_ID_ITE8595 0x8595 + +@@ -730,6 +731,7 @@ + #define USB_DEVICE_ID_LG_MULTITOUCH 0x0064 + #define USB_DEVICE_ID_LG_MELFAS_MT 0x6007 + #define I2C_DEVICE_ID_LG_8001 0x8001 ++#define I2C_DEVICE_ID_LG_7010 0x7010 + + #define USB_VENDOR_ID_LOGITECH 0x046d + #define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e +@@ -1098,6 +1100,7 @@ + #define USB_DEVICE_ID_SYNAPTICS_LTS2 0x1d10 + #define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3 + #define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3 ++#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 0x2968 + #define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710 + #define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5 0x81a7 + +diff --git a/drivers/hid/hid-ite.c b/drivers/hid/hid-ite.c +index a45f2352618d..c436e12feb23 100644 +--- a/drivers/hid/hid-ite.c ++++ b/drivers/hid/hid-ite.c +@@ -40,6 +40,9 @@ static int ite_event(struct hid_device *hdev, struct hid_field *field, + static const struct hid_device_id ite_devices[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_ITE, USB_DEVICE_ID_ITE8595) }, + { HID_USB_DEVICE(USB_VENDOR_ID_258A, USB_DEVICE_ID_258A_6A88) }, ++ /* ITE8595 USB kbd ctlr, with Synaptics touchpad connected to it. */ ++ { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, ++ USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012) }, + { } + }; + MODULE_DEVICE_TABLE(hid, ite_devices); +diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c +index 3cfeb1629f79..362805ddf377 100644 +--- a/drivers/hid/hid-multitouch.c ++++ b/drivers/hid/hid-multitouch.c +@@ -1019,7 +1019,7 @@ static int mt_process_slot(struct mt_device *td, struct input_dev *input, + tool = MT_TOOL_DIAL; + else if (unlikely(!confidence_state)) { + tool = MT_TOOL_PALM; +- if (!active && ++ if (!active && mt && + input_mt_is_active(&mt->slots[slotnum])) { + /* + * The non-confidence was reported for +@@ -1985,6 +1985,9 @@ static const struct hid_device_id mt_devices[] = { + { .driver_data = MT_CLS_LG, + HID_USB_DEVICE(USB_VENDOR_ID_LG, + USB_DEVICE_ID_LG_MELFAS_MT) }, ++ { .driver_data = MT_CLS_LG, ++ HID_DEVICE(BUS_I2C, HID_GROUP_GENERIC, ++ USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_7010) }, + + /* MosArt panels */ + { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, +diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c +index 9a35af1e2662..fa58a7cbb3ff 100644 +--- a/drivers/hid/hid-quirks.c ++++ b/drivers/hid/hid-quirks.c +@@ -174,6 +174,7 @@ static const struct hid_device_id hid_quirks[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET), HID_QUIRK_MULTI_INPUT }, + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, ++ { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE), HID_QUIRK_MULTI_INPUT }, + + { 0 } + }; +diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c +index 8dae0f9b819e..6286204d4c56 100644 +--- a/drivers/hid/hid-steam.c ++++ b/drivers/hid/hid-steam.c +@@ -768,8 +768,12 @@ static int steam_probe(struct hid_device *hdev, + + if (steam->quirks & STEAM_QUIRK_WIRELESS) { + hid_info(hdev, "Steam wireless receiver connected"); ++ /* If using a wireless adaptor ask for connection status */ ++ steam->connected = false; + steam_request_conn_status(steam); + } else { ++ /* A wired connection is always present */ ++ steam->connected = true; + ret = steam_register(steam); + if (ret) { + hid_err(hdev, +diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c +index ac44bf752ff1..479934f7d241 100644 +--- a/drivers/hid/i2c-hid/i2c-hid-core.c ++++ b/drivers/hid/i2c-hid/i2c-hid-core.c +@@ -49,6 +49,8 @@ + #define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1) + #define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) + #define I2C_HID_QUIRK_RESET_ON_RESUME BIT(5) ++#define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(6) ++ + + /* flags */ + #define I2C_HID_STARTED 0 +@@ -177,6 +179,8 @@ static const struct i2c_hid_quirks { + I2C_HID_QUIRK_BOGUS_IRQ }, + { USB_VENDOR_ID_ALPS_JP, HID_ANY_ID, + I2C_HID_QUIRK_RESET_ON_RESUME }, ++ { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720, ++ I2C_HID_QUIRK_BAD_INPUT_SIZE }, + { 0, 0 } + }; + +@@ -498,9 +502,15 @@ static void i2c_hid_get_input(struct i2c_hid *ihid) + } + + if ((ret_size > size) || (ret_size < 2)) { +- dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n", +- __func__, size, ret_size); +- return; ++ if (ihid->quirks & I2C_HID_QUIRK_BAD_INPUT_SIZE) { ++ ihid->inbuf[0] = size & 0xff; ++ ihid->inbuf[1] = size >> 8; ++ ret_size = size; ++ } else { ++ dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n", ++ __func__, size, ret_size); ++ return; ++ } + } + + i2c_hid_dbg(ihid, "input: %*ph\n", ret_size, ihid->inbuf); +diff --git a/drivers/hid/intel-ish-hid/ipc/hw-ish.h b/drivers/hid/intel-ish-hid/ipc/hw-ish.h +index 6c1e6110867f..1fb294ca463e 100644 +--- a/drivers/hid/intel-ish-hid/ipc/hw-ish.h ++++ b/drivers/hid/intel-ish-hid/ipc/hw-ish.h +@@ -24,7 +24,9 @@ + #define ICL_MOBILE_DEVICE_ID 0x34FC + #define SPT_H_DEVICE_ID 0xA135 + #define CML_LP_DEVICE_ID 0x02FC ++#define CMP_H_DEVICE_ID 0x06FC + #define EHL_Ax_DEVICE_ID 0x4BB3 ++#define TGL_LP_DEVICE_ID 0xA0FC + + #define REVISION_ID_CHT_A0 0x6 + #define REVISION_ID_CHT_Ax_SI 0x0 +diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c b/drivers/hid/intel-ish-hid/ipc/pci-ish.c +index 784dcc8c7022..f491d8b4e24c 100644 +--- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c ++++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c +@@ -34,7 +34,9 @@ static const struct pci_device_id ish_pci_tbl[] = { + {PCI_DEVICE(PCI_VENDOR_ID_INTEL, ICL_MOBILE_DEVICE_ID)}, + {PCI_DEVICE(PCI_VENDOR_ID_INTEL, SPT_H_DEVICE_ID)}, + {PCI_DEVICE(PCI_VENDOR_ID_INTEL, CML_LP_DEVICE_ID)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, CMP_H_DEVICE_ID)}, + {PCI_DEVICE(PCI_VENDOR_ID_INTEL, EHL_Ax_DEVICE_ID)}, ++ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, TGL_LP_DEVICE_ID)}, + {0, } + }; + MODULE_DEVICE_TABLE(pci, ish_pci_tbl); +diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c +index ccb74529bc78..d99a9d407671 100644 +--- a/drivers/hid/wacom_wac.c ++++ b/drivers/hid/wacom_wac.c +@@ -2096,14 +2096,16 @@ static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field + (hdev->product == 0x34d || hdev->product == 0x34e || /* MobileStudio Pro */ + hdev->product == 0x357 || hdev->product == 0x358 || /* Intuos Pro 2 */ + hdev->product == 0x392 || /* Intuos Pro 2 */ +- hdev->product == 0x398 || hdev->product == 0x399)) { /* MobileStudio Pro */ ++ hdev->product == 0x398 || hdev->product == 0x399 || /* MobileStudio Pro */ ++ hdev->product == 0x3AA)) { /* MobileStudio Pro */ + value = (field->logical_maximum - value); + + if (hdev->product == 0x357 || hdev->product == 0x358 || + hdev->product == 0x392) + value = wacom_offset_rotation(input, usage, value, 3, 16); + else if (hdev->product == 0x34d || hdev->product == 0x34e || +- hdev->product == 0x398 || hdev->product == 0x399) ++ hdev->product == 0x398 || hdev->product == 0x399 || ++ hdev->product == 0x3AA) + value = wacom_offset_rotation(input, usage, value, 1, 2); + } + else { +diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c +index e493242c266e..0339ecdd06bd 100644 +--- a/drivers/iio/adc/stm32-dfsdm-adc.c ++++ b/drivers/iio/adc/stm32-dfsdm-adc.c +@@ -1204,6 +1204,8 @@ static int stm32_dfsdm_single_conv(struct iio_dev *indio_dev, + + stm32_dfsdm_stop_conv(adc); + ++ stm32_dfsdm_process_data(adc, res); ++ + stop_dfsdm: + stm32_dfsdm_stop_dfsdm(adc->dfsdm); + +diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c +index c0acbb5d2ffb..b21f72dd473c 100644 +--- a/drivers/iio/gyro/st_gyro_core.c ++++ b/drivers/iio/gyro/st_gyro_core.c +@@ -139,7 +139,6 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = { + [2] = LSM330DLC_GYRO_DEV_NAME, + [3] = L3G4IS_GYRO_DEV_NAME, + [4] = LSM330_GYRO_DEV_NAME, +- [5] = LSM9DS0_GYRO_DEV_NAME, + }, + .ch = (struct iio_chan_spec *)st_gyro_16bit_channels, + .odr = { +@@ -209,6 +208,80 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = { + .multi_read_bit = true, + .bootime = 2, + }, ++ { ++ .wai = 0xd4, ++ .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, ++ .sensors_supported = { ++ [0] = LSM9DS0_GYRO_DEV_NAME, ++ }, ++ .ch = (struct iio_chan_spec *)st_gyro_16bit_channels, ++ .odr = { ++ .addr = 0x20, ++ .mask = GENMASK(7, 6), ++ .odr_avl = { ++ { .hz = 95, .value = 0x00, }, ++ { .hz = 190, .value = 0x01, }, ++ { .hz = 380, .value = 0x02, }, ++ { .hz = 760, .value = 0x03, }, ++ }, ++ }, ++ .pw = { ++ .addr = 0x20, ++ .mask = BIT(3), ++ .value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE, ++ .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, ++ }, ++ .enable_axis = { ++ .addr = ST_SENSORS_DEFAULT_AXIS_ADDR, ++ .mask = ST_SENSORS_DEFAULT_AXIS_MASK, ++ }, ++ .fs = { ++ .addr = 0x23, ++ .mask = GENMASK(5, 4), ++ .fs_avl = { ++ [0] = { ++ .num = ST_GYRO_FS_AVL_245DPS, ++ .value = 0x00, ++ .gain = IIO_DEGREE_TO_RAD(8750), ++ }, ++ [1] = { ++ .num = ST_GYRO_FS_AVL_500DPS, ++ .value = 0x01, ++ .gain = IIO_DEGREE_TO_RAD(17500), ++ }, ++ [2] = { ++ .num = ST_GYRO_FS_AVL_2000DPS, ++ .value = 0x02, ++ .gain = IIO_DEGREE_TO_RAD(70000), ++ }, ++ }, ++ }, ++ .bdu = { ++ .addr = 0x23, ++ .mask = BIT(7), ++ }, ++ .drdy_irq = { ++ .int2 = { ++ .addr = 0x22, ++ .mask = BIT(3), ++ }, ++ /* ++ * The sensor has IHL (active low) and open ++ * drain settings, but only for INT1 and not ++ * for the DRDY line on INT2. ++ */ ++ .stat_drdy = { ++ .addr = ST_SENSORS_DEFAULT_STAT_ADDR, ++ .mask = GENMASK(2, 0), ++ }, ++ }, ++ .sim = { ++ .addr = 0x23, ++ .value = BIT(0), ++ }, ++ .multi_read_bit = true, ++ .bootime = 2, ++ }, + { + .wai = 0xd7, + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, +diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c +index dd555078258c..454695b372c8 100644 +--- a/drivers/iommu/amd_iommu.c ++++ b/drivers/iommu/amd_iommu.c +@@ -226,71 +226,61 @@ static struct iommu_dev_data *search_dev_data(u16 devid) + return NULL; + } + +-static int __last_alias(struct pci_dev *pdev, u16 alias, void *data) ++static int clone_alias(struct pci_dev *pdev, u16 alias, void *data) + { +- *(u16 *)data = alias; +- return 0; +-} +- +-static u16 get_alias(struct device *dev) +-{ +- struct pci_dev *pdev = to_pci_dev(dev); +- u16 devid, ivrs_alias, pci_alias; +- +- /* The callers make sure that get_device_id() does not fail here */ +- devid = get_device_id(dev); ++ u16 devid = pci_dev_id(pdev); + +- /* For ACPI HID devices, we simply return the devid as such */ +- if (!dev_is_pci(dev)) +- return devid; ++ if (devid == alias) ++ return 0; + +- ivrs_alias = amd_iommu_alias_table[devid]; ++ amd_iommu_rlookup_table[alias] = ++ amd_iommu_rlookup_table[devid]; ++ memcpy(amd_iommu_dev_table[alias].data, ++ amd_iommu_dev_table[devid].data, ++ sizeof(amd_iommu_dev_table[alias].data)); + +- pci_for_each_dma_alias(pdev, __last_alias, &pci_alias); ++ return 0; ++} + +- if (ivrs_alias == pci_alias) +- return ivrs_alias; ++static void clone_aliases(struct pci_dev *pdev) ++{ ++ if (!pdev) ++ return; + + /* +- * DMA alias showdown +- * +- * The IVRS is fairly reliable in telling us about aliases, but it +- * can't know about every screwy device. If we don't have an IVRS +- * reported alias, use the PCI reported alias. In that case we may +- * still need to initialize the rlookup and dev_table entries if the +- * alias is to a non-existent device. ++ * The IVRS alias stored in the alias table may not be ++ * part of the PCI DMA aliases if it's bus differs ++ * from the original device. + */ +- if (ivrs_alias == devid) { +- if (!amd_iommu_rlookup_table[pci_alias]) { +- amd_iommu_rlookup_table[pci_alias] = +- amd_iommu_rlookup_table[devid]; +- memcpy(amd_iommu_dev_table[pci_alias].data, +- amd_iommu_dev_table[devid].data, +- sizeof(amd_iommu_dev_table[pci_alias].data)); +- } ++ clone_alias(pdev, amd_iommu_alias_table[pci_dev_id(pdev)], NULL); + +- return pci_alias; +- } ++ pci_for_each_dma_alias(pdev, clone_alias, NULL); ++} + +- pci_info(pdev, "Using IVRS reported alias %02x:%02x.%d " +- "for device [%04x:%04x], kernel reported alias " +- "%02x:%02x.%d\n", PCI_BUS_NUM(ivrs_alias), PCI_SLOT(ivrs_alias), +- PCI_FUNC(ivrs_alias), pdev->vendor, pdev->device, +- PCI_BUS_NUM(pci_alias), PCI_SLOT(pci_alias), +- PCI_FUNC(pci_alias)); ++static struct pci_dev *setup_aliases(struct device *dev) ++{ ++ struct pci_dev *pdev = to_pci_dev(dev); ++ u16 ivrs_alias; ++ ++ /* For ACPI HID devices, there are no aliases */ ++ if (!dev_is_pci(dev)) ++ return NULL; + + /* +- * If we don't have a PCI DMA alias and the IVRS alias is on the same +- * bus, then the IVRS table may know about a quirk that we don't. ++ * Add the IVRS alias to the pci aliases if it is on the same ++ * bus. The IVRS table may know about a quirk that we don't. + */ +- if (pci_alias == devid && ++ ivrs_alias = amd_iommu_alias_table[pci_dev_id(pdev)]; ++ if (ivrs_alias != pci_dev_id(pdev) && + PCI_BUS_NUM(ivrs_alias) == pdev->bus->number) { + pci_add_dma_alias(pdev, ivrs_alias & 0xff); + pci_info(pdev, "Added PCI DMA alias %02x.%d\n", + PCI_SLOT(ivrs_alias), PCI_FUNC(ivrs_alias)); + } + +- return ivrs_alias; ++ clone_aliases(pdev); ++ ++ return pdev; + } + + static struct iommu_dev_data *find_dev_data(u16 devid) +@@ -428,7 +418,7 @@ static int iommu_init_device(struct device *dev) + if (!dev_data) + return -ENOMEM; + +- dev_data->alias = get_alias(dev); ++ dev_data->pdev = setup_aliases(dev); + + /* + * By default we use passthrough mode for IOMMUv2 capable device. +@@ -453,20 +443,16 @@ static int iommu_init_device(struct device *dev) + + static void iommu_ignore_device(struct device *dev) + { +- u16 alias; + int devid; + + devid = get_device_id(dev); + if (devid < 0) + return; + +- alias = get_alias(dev); +- ++ amd_iommu_rlookup_table[devid] = NULL; + memset(&amd_iommu_dev_table[devid], 0, sizeof(struct dev_table_entry)); +- memset(&amd_iommu_dev_table[alias], 0, sizeof(struct dev_table_entry)); + +- amd_iommu_rlookup_table[devid] = NULL; +- amd_iommu_rlookup_table[alias] = NULL; ++ setup_aliases(dev); + } + + static void iommu_uninit_device(struct device *dev) +@@ -1236,6 +1222,13 @@ static int device_flush_iotlb(struct iommu_dev_data *dev_data, + return iommu_queue_command(iommu, &cmd); + } + ++static int device_flush_dte_alias(struct pci_dev *pdev, u16 alias, void *data) ++{ ++ struct amd_iommu *iommu = data; ++ ++ return iommu_flush_dte(iommu, alias); ++} ++ + /* + * Command send function for invalidating a device table entry + */ +@@ -1246,14 +1239,22 @@ static int device_flush_dte(struct iommu_dev_data *dev_data) + int ret; + + iommu = amd_iommu_rlookup_table[dev_data->devid]; +- alias = dev_data->alias; + +- ret = iommu_flush_dte(iommu, dev_data->devid); +- if (!ret && alias != dev_data->devid) +- ret = iommu_flush_dte(iommu, alias); ++ if (dev_data->pdev) ++ ret = pci_for_each_dma_alias(dev_data->pdev, ++ device_flush_dte_alias, iommu); ++ else ++ ret = iommu_flush_dte(iommu, dev_data->devid); + if (ret) + return ret; + ++ alias = amd_iommu_alias_table[dev_data->devid]; ++ if (alias != dev_data->devid) { ++ ret = iommu_flush_dte(iommu, alias); ++ if (ret) ++ return ret; ++ } ++ + if (dev_data->ats.enabled) + ret = device_flush_iotlb(dev_data, 0, ~0UL); + +@@ -2035,11 +2036,9 @@ static void do_attach(struct iommu_dev_data *dev_data, + struct protection_domain *domain) + { + struct amd_iommu *iommu; +- u16 alias; + bool ats; + + iommu = amd_iommu_rlookup_table[dev_data->devid]; +- alias = dev_data->alias; + ats = dev_data->ats.enabled; + + /* Update data structures */ +@@ -2052,8 +2051,7 @@ static void do_attach(struct iommu_dev_data *dev_data, + + /* Update device table */ + set_dte_entry(dev_data->devid, domain, ats, dev_data->iommu_v2); +- if (alias != dev_data->devid) +- set_dte_entry(alias, domain, ats, dev_data->iommu_v2); ++ clone_aliases(dev_data->pdev); + + device_flush_dte(dev_data); + } +@@ -2062,17 +2060,14 @@ static void do_detach(struct iommu_dev_data *dev_data) + { + struct protection_domain *domain = dev_data->domain; + struct amd_iommu *iommu; +- u16 alias; + + iommu = amd_iommu_rlookup_table[dev_data->devid]; +- alias = dev_data->alias; + + /* Update data structures */ + dev_data->domain = NULL; + list_del(&dev_data->list); + clear_dte_entry(dev_data->devid); +- if (alias != dev_data->devid) +- clear_dte_entry(alias); ++ clone_aliases(dev_data->pdev); + + /* Flush the DTE entry */ + device_flush_dte(dev_data); +@@ -2384,13 +2379,7 @@ static void update_device_table(struct protection_domain *domain) + list_for_each_entry(dev_data, &domain->dev_list, list) { + set_dte_entry(dev_data->devid, domain, dev_data->ats.enabled, + dev_data->iommu_v2); +- +- if (dev_data->devid == dev_data->alias) +- continue; +- +- /* There is an alias, update device table entry for it */ +- set_dte_entry(dev_data->alias, domain, dev_data->ats.enabled, +- dev_data->iommu_v2); ++ clone_aliases(dev_data->pdev); + } + } + +@@ -3752,7 +3741,20 @@ static void set_remap_table_entry(struct amd_iommu *iommu, u16 devid, + iommu_flush_dte(iommu, devid); + } + +-static struct irq_remap_table *alloc_irq_table(u16 devid) ++static int set_remap_table_entry_alias(struct pci_dev *pdev, u16 alias, ++ void *data) ++{ ++ struct irq_remap_table *table = data; ++ ++ irq_lookup_table[alias] = table; ++ set_dte_irq_entry(alias, table); ++ ++ iommu_flush_dte(amd_iommu_rlookup_table[alias], alias); ++ ++ return 0; ++} ++ ++static struct irq_remap_table *alloc_irq_table(u16 devid, struct pci_dev *pdev) + { + struct irq_remap_table *table = NULL; + struct irq_remap_table *new_table = NULL; +@@ -3798,7 +3800,12 @@ static struct irq_remap_table *alloc_irq_table(u16 devid) + table = new_table; + new_table = NULL; + +- set_remap_table_entry(iommu, devid, table); ++ if (pdev) ++ pci_for_each_dma_alias(pdev, set_remap_table_entry_alias, ++ table); ++ else ++ set_remap_table_entry(iommu, devid, table); ++ + if (devid != alias) + set_remap_table_entry(iommu, alias, table); + +@@ -3815,7 +3822,8 @@ out_unlock: + return table; + } + +-static int alloc_irq_index(u16 devid, int count, bool align) ++static int alloc_irq_index(u16 devid, int count, bool align, ++ struct pci_dev *pdev) + { + struct irq_remap_table *table; + int index, c, alignment = 1; +@@ -3825,7 +3833,7 @@ static int alloc_irq_index(u16 devid, int count, bool align) + if (!iommu) + return -ENODEV; + +- table = alloc_irq_table(devid); ++ table = alloc_irq_table(devid, pdev); + if (!table) + return -ENODEV; + +@@ -4258,7 +4266,7 @@ static int irq_remapping_alloc(struct irq_domain *domain, unsigned int virq, + struct irq_remap_table *table; + struct amd_iommu *iommu; + +- table = alloc_irq_table(devid); ++ table = alloc_irq_table(devid, NULL); + if (table) { + if (!table->min_index) { + /* +@@ -4275,11 +4283,15 @@ static int irq_remapping_alloc(struct irq_domain *domain, unsigned int virq, + } else { + index = -ENOMEM; + } +- } else { ++ } else if (info->type == X86_IRQ_ALLOC_TYPE_MSI || ++ info->type == X86_IRQ_ALLOC_TYPE_MSIX) { + bool align = (info->type == X86_IRQ_ALLOC_TYPE_MSI); + +- index = alloc_irq_index(devid, nr_irqs, align); ++ index = alloc_irq_index(devid, nr_irqs, align, info->msi_dev); ++ } else { ++ index = alloc_irq_index(devid, nr_irqs, false, NULL); + } ++ + if (index < 0) { + pr_warn("Failed to allocate IRTE\n"); + ret = index; +diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h +index 17bd5a349119..fc956479b94e 100644 +--- a/drivers/iommu/amd_iommu_types.h ++++ b/drivers/iommu/amd_iommu_types.h +@@ -639,8 +639,8 @@ struct iommu_dev_data { + struct list_head list; /* For domain->dev_list */ + struct llist_node dev_data_list; /* For global dev_data_list */ + struct protection_domain *domain; /* Domain the device is bound to */ ++ struct pci_dev *pdev; + u16 devid; /* PCI Device ID */ +- u16 alias; /* Alias Device ID */ + bool iommu_v2; /* Device can make use of IOMMUv2 */ + bool passthrough; /* Device is identity mapped */ + struct { +diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c +index 51456e7f264f..c68a1f072c31 100644 +--- a/drivers/iommu/dma-iommu.c ++++ b/drivers/iommu/dma-iommu.c +@@ -1177,7 +1177,6 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr) + { + struct device *dev = msi_desc_to_dev(desc); + struct iommu_domain *domain = iommu_get_domain_for_dev(dev); +- struct iommu_dma_cookie *cookie; + struct iommu_dma_msi_page *msi_page; + static DEFINE_MUTEX(msi_prepare_lock); /* see below */ + +@@ -1186,8 +1185,6 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr) + return 0; + } + +- cookie = domain->iova_cookie; +- + /* + * In fact the whole prepare operation should already be serialised by + * irq_domain_mutex further up the callchain, but that's pretty subtle +diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c +index 617a306f6815..dc380c0c9536 100644 +--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c ++++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c +@@ -792,6 +792,9 @@ static const struct usb_device_id dvbsky_id_table[] = { + { DVB_USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230C, + &mygica_t230c_props, "MyGica Mini DVB-T2 USB Stick T230C", + RC_MAP_TOTAL_MEDIA_IN_HAND_02) }, ++ { DVB_USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230C_LITE, ++ &mygica_t230c_props, "MyGica Mini DVB-T2 USB Stick T230C Lite", ++ NULL) }, + { DVB_USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230C2, + &mygica_t230c_props, "MyGica Mini DVB-T2 USB Stick T230C v2", + RC_MAP_TOTAL_MEDIA_IN_HAND_02) }, +diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c +index 1767f30a1676..b33030e3385c 100644 +--- a/drivers/mfd/intel-lpss-pci.c ++++ b/drivers/mfd/intel-lpss-pci.c +@@ -140,7 +140,7 @@ static const struct intel_lpss_platform_info cnl_i2c_info = { + }; + + static const struct pci_device_id intel_lpss_pci_ids[] = { +- /* CML */ ++ /* CML-LP */ + { PCI_VDEVICE(INTEL, 0x02a8), (kernel_ulong_t)&spt_uart_info }, + { PCI_VDEVICE(INTEL, 0x02a9), (kernel_ulong_t)&spt_uart_info }, + { PCI_VDEVICE(INTEL, 0x02aa), (kernel_ulong_t)&spt_info }, +@@ -153,6 +153,17 @@ static const struct pci_device_id intel_lpss_pci_ids[] = { + { PCI_VDEVICE(INTEL, 0x02ea), (kernel_ulong_t)&cnl_i2c_info }, + { PCI_VDEVICE(INTEL, 0x02eb), (kernel_ulong_t)&cnl_i2c_info }, + { PCI_VDEVICE(INTEL, 0x02fb), (kernel_ulong_t)&spt_info }, ++ /* CML-H */ ++ { PCI_VDEVICE(INTEL, 0x06a8), (kernel_ulong_t)&spt_uart_info }, ++ { PCI_VDEVICE(INTEL, 0x06a9), (kernel_ulong_t)&spt_uart_info }, ++ { PCI_VDEVICE(INTEL, 0x06aa), (kernel_ulong_t)&spt_info }, ++ { PCI_VDEVICE(INTEL, 0x06ab), (kernel_ulong_t)&spt_info }, ++ { PCI_VDEVICE(INTEL, 0x06c7), (kernel_ulong_t)&spt_uart_info }, ++ { PCI_VDEVICE(INTEL, 0x06e8), (kernel_ulong_t)&cnl_i2c_info }, ++ { PCI_VDEVICE(INTEL, 0x06e9), (kernel_ulong_t)&cnl_i2c_info }, ++ { PCI_VDEVICE(INTEL, 0x06ea), (kernel_ulong_t)&cnl_i2c_info }, ++ { PCI_VDEVICE(INTEL, 0x06eb), (kernel_ulong_t)&cnl_i2c_info }, ++ { PCI_VDEVICE(INTEL, 0x06fb), (kernel_ulong_t)&spt_info }, + /* BXT A-Step */ + { PCI_VDEVICE(INTEL, 0x0aac), (kernel_ulong_t)&bxt_i2c_info }, + { PCI_VDEVICE(INTEL, 0x0aae), (kernel_ulong_t)&bxt_i2c_info }, +diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c +index c681f6fab342..a9793ea6933b 100644 +--- a/drivers/misc/mei/hdcp/mei_hdcp.c ++++ b/drivers/misc/mei/hdcp/mei_hdcp.c +@@ -758,11 +758,38 @@ static const struct component_master_ops mei_component_master_ops = { + .unbind = mei_component_master_unbind, + }; + ++/** ++ * mei_hdcp_component_match - compare function for matching mei hdcp. ++ * ++ * The function checks if the driver is i915, the subcomponent is HDCP ++ * and the grand parent of hdcp and the parent of i915 are the same ++ * PCH device. ++ * ++ * @dev: master device ++ * @subcomponent: subcomponent to match (I915_COMPONENT_HDCP) ++ * @data: compare data (mei hdcp device) ++ * ++ * Return: ++ * * 1 - if components match ++ * * 0 - otherwise ++ */ + static int mei_hdcp_component_match(struct device *dev, int subcomponent, + void *data) + { +- return !strcmp(dev->driver->name, "i915") && +- subcomponent == I915_COMPONENT_HDCP; ++ struct device *base = data; ++ ++ if (strcmp(dev->driver->name, "i915") || ++ subcomponent != I915_COMPONENT_HDCP) ++ return 0; ++ ++ base = base->parent; ++ if (!base) ++ return 0; ++ ++ base = base->parent; ++ dev = dev->parent; ++ ++ return (base && dev && dev == base); + } + + static int mei_hdcp_probe(struct mei_cl_device *cldev, +@@ -786,7 +813,7 @@ static int mei_hdcp_probe(struct mei_cl_device *cldev, + + master_match = NULL; + component_match_add_typed(&cldev->dev, &master_match, +- mei_hdcp_component_match, comp_master); ++ mei_hdcp_component_match, &cldev->dev); + if (IS_ERR_OR_NULL(master_match)) { + ret = -ENOMEM; + goto err_exit; +diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h +index b359f06f05e7..69d9b1736bf9 100644 +--- a/drivers/misc/mei/hw-me-regs.h ++++ b/drivers/misc/mei/hw-me-regs.h +@@ -81,8 +81,12 @@ + + #define MEI_DEV_ID_CMP_LP 0x02e0 /* Comet Point LP */ + #define MEI_DEV_ID_CMP_LP_3 0x02e4 /* Comet Point LP 3 (iTouch) */ ++ + #define MEI_DEV_ID_CMP_V 0xA3BA /* Comet Point Lake V */ + ++#define MEI_DEV_ID_CMP_H 0x06e0 /* Comet Lake H */ ++#define MEI_DEV_ID_CMP_H_3 0x06e4 /* Comet Lake H 3 (iTouch) */ ++ + #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */ + + #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 ce43415a536c..309cb8a23381 100644 +--- a/drivers/misc/mei/pci-me.c ++++ b/drivers/misc/mei/pci-me.c +@@ -99,6 +99,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = { + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_LP, MEI_ME_PCH12_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_LP_3, MEI_ME_PCH8_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_V, MEI_ME_PCH12_CFG)}, ++ {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_H, MEI_ME_PCH12_CFG)}, ++ {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)}, + +diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c +index 642a9667db4d..c9ea365c248c 100644 +--- a/drivers/mmc/host/sdhci-pci-core.c ++++ b/drivers/mmc/host/sdhci-pci-core.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1598,11 +1599,59 @@ static int amd_probe(struct sdhci_pci_chip *chip) + return 0; + } + ++static u32 sdhci_read_present_state(struct sdhci_host *host) ++{ ++ return sdhci_readl(host, SDHCI_PRESENT_STATE); ++} ++ ++void amd_sdhci_reset(struct sdhci_host *host, u8 mask) ++{ ++ struct sdhci_pci_slot *slot = sdhci_priv(host); ++ struct pci_dev *pdev = slot->chip->pdev; ++ u32 present_state; ++ ++ /* ++ * SDHC 0x7906 requires a hard reset to clear all internal state. ++ * Otherwise it can get into a bad state where the DATA lines are always ++ * read as zeros. ++ */ ++ if (pdev->device == 0x7906 && (mask & SDHCI_RESET_ALL)) { ++ pci_clear_master(pdev); ++ ++ pci_save_state(pdev); ++ ++ pci_set_power_state(pdev, PCI_D3cold); ++ pr_debug("%s: power_state=%u\n", mmc_hostname(host->mmc), ++ pdev->current_state); ++ pci_set_power_state(pdev, PCI_D0); ++ ++ pci_restore_state(pdev); ++ ++ /* ++ * SDHCI_RESET_ALL says the card detect logic should not be ++ * reset, but since we need to reset the entire controller ++ * we should wait until the card detect logic has stabilized. ++ * ++ * This normally takes about 40ms. ++ */ ++ readx_poll_timeout( ++ sdhci_read_present_state, ++ host, ++ present_state, ++ present_state & SDHCI_CD_STABLE, ++ 10000, ++ 100000 ++ ); ++ } ++ ++ return sdhci_reset(host, mask); ++} ++ + static const struct sdhci_ops amd_sdhci_pci_ops = { + .set_clock = sdhci_set_clock, + .enable_dma = sdhci_pci_enable_dma, + .set_bus_width = sdhci_set_bus_width, +- .reset = sdhci_reset, ++ .reset = amd_sdhci_reset, + .set_uhs_signaling = sdhci_set_uhs_signaling, + }; + +@@ -1681,6 +1730,8 @@ static const struct pci_device_id pci_ids[] = { + SDHCI_PCI_DEVICE(INTEL, CML_EMMC, intel_glk_emmc), + SDHCI_PCI_DEVICE(INTEL, CML_SD, intel_byt_sd), + SDHCI_PCI_DEVICE(INTEL, CMLH_SD, intel_byt_sd), ++ SDHCI_PCI_DEVICE(INTEL, JSL_EMMC, intel_glk_emmc), ++ SDHCI_PCI_DEVICE(INTEL, JSL_SD, intel_byt_sd), + SDHCI_PCI_DEVICE(O2, 8120, o2), + SDHCI_PCI_DEVICE(O2, 8220, o2), + SDHCI_PCI_DEVICE(O2, 8221, o2), +diff --git a/drivers/mmc/host/sdhci-pci.h b/drivers/mmc/host/sdhci-pci.h +index 558202fe64c6..981bbbe63aff 100644 +--- a/drivers/mmc/host/sdhci-pci.h ++++ b/drivers/mmc/host/sdhci-pci.h +@@ -55,6 +55,8 @@ + #define PCI_DEVICE_ID_INTEL_CML_EMMC 0x02c4 + #define PCI_DEVICE_ID_INTEL_CML_SD 0x02f5 + #define PCI_DEVICE_ID_INTEL_CMLH_SD 0x06f5 ++#define PCI_DEVICE_ID_INTEL_JSL_EMMC 0x4dc4 ++#define PCI_DEVICE_ID_INTEL_JSL_SD 0x4df8 + + #define PCI_DEVICE_ID_SYSKONNECT_8000 0x8000 + #define PCI_DEVICE_ID_VIA_95D0 0x95d0 +diff --git a/drivers/net/can/m_can/tcan4x5x.c b/drivers/net/can/m_can/tcan4x5x.c +index d797912e665a..b233756345f8 100644 +--- a/drivers/net/can/m_can/tcan4x5x.c ++++ b/drivers/net/can/m_can/tcan4x5x.c +@@ -164,6 +164,28 @@ static void tcan4x5x_check_wake(struct tcan4x5x_priv *priv) + } + } + ++static int tcan4x5x_reset(struct tcan4x5x_priv *priv) ++{ ++ int ret = 0; ++ ++ if (priv->reset_gpio) { ++ gpiod_set_value(priv->reset_gpio, 1); ++ ++ /* tpulse_width minimum 30us */ ++ usleep_range(30, 100); ++ gpiod_set_value(priv->reset_gpio, 0); ++ } else { ++ ret = regmap_write(priv->regmap, TCAN4X5X_CONFIG, ++ TCAN4X5X_SW_RESET); ++ if (ret) ++ return ret; ++ } ++ ++ usleep_range(700, 1000); ++ ++ return ret; ++} ++ + static int regmap_spi_gather_write(void *context, const void *reg, + size_t reg_len, const void *val, + size_t val_len) +@@ -341,6 +363,7 @@ static int tcan4x5x_init(struct m_can_classdev *cdev) + static int tcan4x5x_parse_config(struct m_can_classdev *cdev) + { + struct tcan4x5x_priv *tcan4x5x = cdev->device_data; ++ int ret; + + tcan4x5x->device_wake_gpio = devm_gpiod_get(cdev->dev, "device-wake", + GPIOD_OUT_HIGH); +@@ -354,7 +377,9 @@ static int tcan4x5x_parse_config(struct m_can_classdev *cdev) + if (IS_ERR(tcan4x5x->reset_gpio)) + tcan4x5x->reset_gpio = NULL; + +- usleep_range(700, 1000); ++ ret = tcan4x5x_reset(tcan4x5x); ++ if (ret) ++ return ret; + + tcan4x5x->device_state_gpio = devm_gpiod_get_optional(cdev->dev, + "device-state", +diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c +index 97ab0dd25552..1a7710c399d7 100644 +--- a/drivers/net/ethernet/broadcom/b44.c ++++ b/drivers/net/ethernet/broadcom/b44.c +@@ -1519,8 +1519,10 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset) + int ethaddr_bytes = ETH_ALEN; + + memset(ppattern + offset, 0xff, magicsync); +- for (j = 0; j < magicsync; j++) +- set_bit(len++, (unsigned long *) pmask); ++ for (j = 0; j < magicsync; j++) { ++ pmask[len >> 3] |= BIT(len & 7); ++ len++; ++ } + + for (j = 0; j < B44_MAX_PATTERNS; j++) { + if ((B44_PATTERN_SIZE - len) >= ETH_ALEN) +@@ -1532,7 +1534,8 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset) + for (k = 0; k< ethaddr_bytes; k++) { + ppattern[offset + magicsync + + (j * ETH_ALEN) + k] = macaddr[k]; +- set_bit(len++, (unsigned long *) pmask); ++ pmask[len >> 3] |= BIT(len & 7); ++ len++; + } + } + return len - 1; +diff --git a/drivers/net/ethernet/google/gve/gve_rx.c b/drivers/net/ethernet/google/gve/gve_rx.c +index edec61dfc868..9f52e72ff641 100644 +--- a/drivers/net/ethernet/google/gve/gve_rx.c ++++ b/drivers/net/ethernet/google/gve/gve_rx.c +@@ -418,8 +418,6 @@ bool gve_clean_rx_done(struct gve_rx_ring *rx, int budget, + rx->cnt = cnt; + rx->fill_cnt += work_done; + +- /* restock desc ring slots */ +- dma_wmb(); /* Ensure descs are visible before ringing doorbell */ + gve_rx_write_doorbell(priv, rx); + return gve_rx_work_pending(rx); + } +diff --git a/drivers/net/ethernet/google/gve/gve_tx.c b/drivers/net/ethernet/google/gve/gve_tx.c +index f4889431f9b7..d0244feb0301 100644 +--- a/drivers/net/ethernet/google/gve/gve_tx.c ++++ b/drivers/net/ethernet/google/gve/gve_tx.c +@@ -487,10 +487,6 @@ netdev_tx_t gve_tx(struct sk_buff *skb, struct net_device *dev) + * may have added descriptors without ringing the doorbell. + */ + +- /* Ensure tx descs from a prior gve_tx are visible before +- * ringing doorbell. +- */ +- dma_wmb(); + gve_tx_put_doorbell(priv, tx->q_resources, tx->req); + return NETDEV_TX_BUSY; + } +@@ -505,8 +501,6 @@ netdev_tx_t gve_tx(struct sk_buff *skb, struct net_device *dev) + if (!netif_xmit_stopped(tx->netdev_txq) && netdev_xmit_more()) + return NETDEV_TX_OK; + +- /* Ensure tx descs are visible before ringing doorbell */ +- dma_wmb(); + gve_tx_put_doorbell(priv, tx->q_resources, tx->req); + return NETDEV_TX_OK; + } +diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c +index 471b0ca6d69a..55dfba990e6e 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c +@@ -204,8 +204,8 @@ mlxsw_m_port_create(struct mlxsw_m *mlxsw_m, u8 local_port, u8 module) + + err_register_netdev: + mlxsw_m->ports[local_port] = NULL; +- free_netdev(dev); + err_dev_addr_get: ++ free_netdev(dev); + err_alloc_etherdev: + mlxsw_core_port_fini(mlxsw_m->core, local_port); + return err; +diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c +index 41ddd8fff2a7..8bd2912bf713 100644 +--- a/drivers/net/ethernet/socionext/netsec.c ++++ b/drivers/net/ethernet/socionext/netsec.c +@@ -928,7 +928,6 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget) + struct netsec_rx_pkt_info rx_info; + enum dma_data_direction dma_dir; + struct bpf_prog *xdp_prog; +- struct sk_buff *skb = NULL; + u16 xdp_xmit = 0; + u32 xdp_act = 0; + int done = 0; +@@ -942,7 +941,8 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget) + struct netsec_de *de = dring->vaddr + (DESC_SZ * idx); + struct netsec_desc *desc = &dring->desc[idx]; + struct page *page = virt_to_page(desc->addr); +- u32 xdp_result = XDP_PASS; ++ u32 xdp_result = NETSEC_XDP_PASS; ++ struct sk_buff *skb = NULL; + u16 pkt_len, desc_len; + dma_addr_t dma_handle; + struct xdp_buff xdp; +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +index 1b3520d0e59e..06dd65c419c4 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -105,6 +105,7 @@ MODULE_PARM_DESC(chain_mode, "To use chain instead of ring mode"); + static irqreturn_t stmmac_interrupt(int irq, void *dev_id); + + #ifdef CONFIG_DEBUG_FS ++static const struct net_device_ops stmmac_netdev_ops; + static void stmmac_init_fs(struct net_device *dev); + static void stmmac_exit_fs(struct net_device *dev); + #endif +@@ -4175,6 +4176,34 @@ static int stmmac_dma_cap_show(struct seq_file *seq, void *v) + } + DEFINE_SHOW_ATTRIBUTE(stmmac_dma_cap); + ++/* Use network device events to rename debugfs file entries. ++ */ ++static int stmmac_device_event(struct notifier_block *unused, ++ unsigned long event, void *ptr) ++{ ++ struct net_device *dev = netdev_notifier_info_to_dev(ptr); ++ struct stmmac_priv *priv = netdev_priv(dev); ++ ++ if (dev->netdev_ops != &stmmac_netdev_ops) ++ goto done; ++ ++ switch (event) { ++ case NETDEV_CHANGENAME: ++ if (priv->dbgfs_dir) ++ priv->dbgfs_dir = debugfs_rename(stmmac_fs_dir, ++ priv->dbgfs_dir, ++ stmmac_fs_dir, ++ dev->name); ++ break; ++ } ++done: ++ return NOTIFY_DONE; ++} ++ ++static struct notifier_block stmmac_notifier = { ++ .notifier_call = stmmac_device_event, ++}; ++ + static void stmmac_init_fs(struct net_device *dev) + { + struct stmmac_priv *priv = netdev_priv(dev); +@@ -4189,12 +4218,15 @@ static void stmmac_init_fs(struct net_device *dev) + /* Entry to report the DMA HW features */ + debugfs_create_file("dma_cap", 0444, priv->dbgfs_dir, dev, + &stmmac_dma_cap_fops); ++ ++ register_netdevice_notifier(&stmmac_notifier); + } + + static void stmmac_exit_fs(struct net_device *dev) + { + struct stmmac_priv *priv = netdev_priv(dev); + ++ unregister_netdevice_notifier(&stmmac_notifier); + debugfs_remove_recursive(priv->dbgfs_dir); + } + #endif /* CONFIG_DEBUG_FS */ +diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c +index e2e679a01b65..77ccf3672ede 100644 +--- a/drivers/net/wan/sdla.c ++++ b/drivers/net/wan/sdla.c +@@ -708,7 +708,7 @@ static netdev_tx_t sdla_transmit(struct sk_buff *skb, + + spin_lock_irqsave(&sdla_lock, flags); + SDLA_WINDOW(dev, addr); +- pbuf = (void *)(((int) dev->mem_start) + (addr & SDLA_ADDR_MASK)); ++ pbuf = (void *)(dev->mem_start + (addr & SDLA_ADDR_MASK)); + __sdla_write(dev, pbuf->buf_addr, skb->data, skb->len); + SDLA_WINDOW(dev, addr); + pbuf->opp_flag = 1; +diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c +index fb649d85b8fc..dd0c32379375 100644 +--- a/drivers/net/wireless/ath/ath9k/hif_usb.c ++++ b/drivers/net/wireless/ath/ath9k/hif_usb.c +@@ -1216,7 +1216,7 @@ err_fw: + static int send_eject_command(struct usb_interface *interface) + { + struct usb_device *udev = interface_to_usbdev(interface); +- struct usb_host_interface *iface_desc = &interface->altsetting[0]; ++ struct usb_host_interface *iface_desc = interface->cur_altsetting; + struct usb_endpoint_descriptor *endpoint; + unsigned char *cmd; + u8 bulk_out_ep; +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +index 06f3c01f10b3..7cdfde9b3dea 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -1348,7 +1348,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) + goto fail; + } + +- desc = &intf->altsetting[0].desc; ++ desc = &intf->cur_altsetting->desc; + if ((desc->bInterfaceClass != USB_CLASS_VENDOR_SPEC) || + (desc->bInterfaceSubClass != 2) || + (desc->bInterfaceProtocol != 0xff)) { +@@ -1361,7 +1361,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) + + num_of_eps = desc->bNumEndpoints; + for (ep = 0; ep < num_of_eps; ep++) { +- endpoint = &intf->altsetting[0].endpoint[ep].desc; ++ endpoint = &intf->cur_altsetting->endpoint[ep].desc; + endpoint_num = usb_endpoint_num(endpoint); + if (!usb_endpoint_xfer_bulk(endpoint)) + continue; +diff --git a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c +index 40a8b941ad5c..8c79b963bcff 100644 +--- a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c ++++ b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c +@@ -1608,9 +1608,9 @@ static int ezusb_probe(struct usb_interface *interface, + /* set up the endpoint information */ + /* check out the endpoints */ + +- iface_desc = &interface->altsetting[0].desc; ++ iface_desc = &interface->cur_altsetting->desc; + for (i = 0; i < iface_desc->bNumEndpoints; ++i) { +- ep = &interface->altsetting[0].endpoint[i].desc; ++ ep = &interface->cur_altsetting->endpoint[i].desc; + + if (usb_endpoint_is_bulk_in(ep)) { + /* we found a bulk in endpoint */ +diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +index e7d96ac673b7..3499b211dad5 100644 +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -5915,7 +5915,7 @@ static int rtl8xxxu_parse_usb(struct rtl8xxxu_priv *priv, + u8 dir, xtype, num; + int ret = 0; + +- host_interface = &interface->altsetting[0]; ++ host_interface = interface->cur_altsetting; + interface_desc = &host_interface->desc; + endpoints = interface_desc->bNumEndpoints; + +diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c b/drivers/net/wireless/rsi/rsi_91x_hal.c +index f84250bdb8cf..6f8d5f9a9f7e 100644 +--- a/drivers/net/wireless/rsi/rsi_91x_hal.c ++++ b/drivers/net/wireless/rsi/rsi_91x_hal.c +@@ -622,6 +622,7 @@ static int bl_cmd(struct rsi_hw *adapter, u8 cmd, u8 exp_resp, char *str) + bl_start_cmd_timer(adapter, timeout); + status = bl_write_cmd(adapter, cmd, exp_resp, ®out_val); + if (status < 0) { ++ bl_stop_cmd_timer(adapter); + rsi_dbg(ERR_ZONE, + "%s: Command %s (%0x) writing failed..\n", + __func__, str, cmd); +@@ -737,10 +738,9 @@ static int ping_pong_write(struct rsi_hw *adapter, u8 cmd, u8 *addr, u32 size) + } + + status = bl_cmd(adapter, cmd_req, cmd_resp, str); +- if (status) { +- bl_stop_cmd_timer(adapter); ++ if (status) + return status; +- } ++ + return 0; + } + +@@ -828,10 +828,9 @@ static int auto_fw_upgrade(struct rsi_hw *adapter, u8 *flash_content, + + status = bl_cmd(adapter, EOF_REACHED, FW_LOADING_SUCCESSFUL, + "EOF_REACHED"); +- if (status) { +- bl_stop_cmd_timer(adapter); ++ if (status) + return status; +- } ++ + rsi_dbg(INFO_ZONE, "FW loading is done and FW is running..\n"); + return 0; + } +@@ -849,6 +848,7 @@ static int rsi_hal_prepare_fwload(struct rsi_hw *adapter) + ®out_val, + RSI_COMMON_REG_SIZE); + if (status < 0) { ++ bl_stop_cmd_timer(adapter); + rsi_dbg(ERR_ZONE, + "%s: REGOUT read failed\n", __func__); + return status; +diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c +index 23a1d00b5f38..d6cdabef264d 100644 +--- a/drivers/net/wireless/rsi/rsi_91x_usb.c ++++ b/drivers/net/wireless/rsi/rsi_91x_usb.c +@@ -16,6 +16,7 @@ + */ + + #include ++#include + #include + #include "rsi_usb.h" + #include "rsi_hal.h" +@@ -29,7 +30,7 @@ MODULE_PARM_DESC(dev_oper_mode, + "9[Wi-Fi STA + BT LE], 13[Wi-Fi STA + BT classic + BT LE]\n" + "6[AP + BT classic], 14[AP + BT classic + BT LE]"); + +-static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num); ++static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t flags); + + /** + * rsi_usb_card_write() - This function writes to the USB Card. +@@ -117,7 +118,7 @@ static int rsi_find_bulk_in_and_out_endpoints(struct usb_interface *interface, + __le16 buffer_size; + int ii, bin_found = 0, bout_found = 0; + +- iface_desc = &(interface->altsetting[0]); ++ iface_desc = interface->cur_altsetting; + + for (ii = 0; ii < iface_desc->desc.bNumEndpoints; ++ii) { + endpoint = &(iface_desc->endpoint[ii].desc); +@@ -285,20 +286,29 @@ static void rsi_rx_done_handler(struct urb *urb) + status = 0; + + out: +- if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num)) ++ if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num, GFP_ATOMIC)) + rsi_dbg(ERR_ZONE, "%s: Failed in urb submission", __func__); + + if (status) + dev_kfree_skb(rx_cb->rx_skb); + } + ++static void rsi_rx_urb_kill(struct rsi_hw *adapter, u8 ep_num) ++{ ++ struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev; ++ struct rx_usb_ctrl_block *rx_cb = &dev->rx_cb[ep_num - 1]; ++ struct urb *urb = rx_cb->rx_urb; ++ ++ usb_kill_urb(urb); ++} ++ + /** + * rsi_rx_urb_submit() - This function submits the given URB to the USB stack. + * @adapter: Pointer to the adapter structure. + * + * Return: 0 on success, a negative error code on failure. + */ +-static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num) ++static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t mem_flags) + { + struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev; + struct rx_usb_ctrl_block *rx_cb = &dev->rx_cb[ep_num - 1]; +@@ -328,9 +338,11 @@ static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num) + rsi_rx_done_handler, + rx_cb); + +- status = usb_submit_urb(urb, GFP_KERNEL); +- if (status) ++ status = usb_submit_urb(urb, mem_flags); ++ if (status) { + rsi_dbg(ERR_ZONE, "%s: Failed in urb submission\n", __func__); ++ dev_kfree_skb(skb); ++ } + + return status; + } +@@ -816,17 +828,20 @@ static int rsi_probe(struct usb_interface *pfunction, + rsi_dbg(INIT_ZONE, "%s: Device Init Done\n", __func__); + } + +- status = rsi_rx_urb_submit(adapter, WLAN_EP); ++ status = rsi_rx_urb_submit(adapter, WLAN_EP, GFP_KERNEL); + if (status) + goto err1; + + if (adapter->priv->coex_mode > 1) { +- status = rsi_rx_urb_submit(adapter, BT_EP); ++ status = rsi_rx_urb_submit(adapter, BT_EP, GFP_KERNEL); + if (status) +- goto err1; ++ goto err_kill_wlan_urb; + } + + return 0; ++ ++err_kill_wlan_urb: ++ rsi_rx_urb_kill(adapter, WLAN_EP); + err1: + rsi_deinit_usb_interface(adapter); + err: +@@ -857,6 +872,10 @@ static void rsi_disconnect(struct usb_interface *pfunction) + adapter->priv->bt_adapter = NULL; + } + ++ if (adapter->priv->coex_mode > 1) ++ rsi_rx_urb_kill(adapter, BT_EP); ++ rsi_rx_urb_kill(adapter, WLAN_EP); ++ + rsi_reset_card(adapter); + rsi_deinit_usb_interface(adapter); + rsi_91x_deinit(adapter); +diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c +index 7b5c2fe5bd4d..8ff0374126e4 100644 +--- a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c ++++ b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c +@@ -1263,7 +1263,7 @@ static void print_id(struct usb_device *udev) + static int eject_installer(struct usb_interface *intf) + { + struct usb_device *udev = interface_to_usbdev(intf); +- struct usb_host_interface *iface_desc = &intf->altsetting[0]; ++ struct usb_host_interface *iface_desc = intf->cur_altsetting; + struct usb_endpoint_descriptor *endpoint; + unsigned char *cmd; + u8 bulk_out_ep; +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c +index 1593b8494ebb..2f88b1ff7ada 100644 +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -4080,6 +4080,40 @@ static void quirk_mic_x200_dma_alias(struct pci_dev *pdev) + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2260, quirk_mic_x200_dma_alias); + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2264, quirk_mic_x200_dma_alias); + ++/* ++ * Intel Visual Compute Accelerator (VCA) is a family of PCIe add-in devices ++ * exposing computational units via Non Transparent Bridges (NTB, PEX 87xx). ++ * ++ * Similarly to MIC x200, we need to add DMA aliases to allow buffer access ++ * when IOMMU is enabled. These aliases allow computational unit access to ++ * host memory. These aliases mark the whole VCA device as one IOMMU ++ * group. ++ * ++ * All possible slot numbers (0x20) are used, since we are unable to tell ++ * what slot is used on other side. This quirk is intended for both host ++ * and computational unit sides. The VCA devices have up to five functions ++ * (four for DMA channels and one additional). ++ */ ++static void quirk_pex_vca_alias(struct pci_dev *pdev) ++{ ++ const unsigned int num_pci_slots = 0x20; ++ unsigned int slot; ++ ++ for (slot = 0; slot < num_pci_slots; slot++) { ++ pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x0)); ++ pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x1)); ++ pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x2)); ++ pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x3)); ++ pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x4)); ++ } ++} ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2954, quirk_pex_vca_alias); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2955, quirk_pex_vca_alias); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2956, quirk_pex_vca_alias); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2958, quirk_pex_vca_alias); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2959, quirk_pex_vca_alias); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x295A, quirk_pex_vca_alias); ++ + /* + * The IOMMU and interrupt controller on Broadcom Vulcan/Cavium ThunderX2 are + * associated not at the root bus, but at a bridge below. This quirk avoids +diff --git a/drivers/perf/fsl_imx8_ddr_perf.c b/drivers/perf/fsl_imx8_ddr_perf.c +index ce7345745b42..2a3966d059e7 100644 +--- a/drivers/perf/fsl_imx8_ddr_perf.c ++++ b/drivers/perf/fsl_imx8_ddr_perf.c +@@ -45,7 +45,8 @@ + static DEFINE_IDA(ddr_ida); + + /* DDR Perf hardware feature */ +-#define DDR_CAP_AXI_ID_FILTER 0x1 /* support AXI ID filter */ ++#define DDR_CAP_AXI_ID_FILTER 0x1 /* support AXI ID filter */ ++#define DDR_CAP_AXI_ID_FILTER_ENHANCED 0x3 /* support enhanced AXI ID filter */ + + struct fsl_ddr_devtype_data { + unsigned int quirks; /* quirks needed for different DDR Perf core */ +@@ -178,6 +179,36 @@ static const struct attribute_group *attr_groups[] = { + NULL, + }; + ++static bool ddr_perf_is_filtered(struct perf_event *event) ++{ ++ return event->attr.config == 0x41 || event->attr.config == 0x42; ++} ++ ++static u32 ddr_perf_filter_val(struct perf_event *event) ++{ ++ return event->attr.config1; ++} ++ ++static bool ddr_perf_filters_compatible(struct perf_event *a, ++ struct perf_event *b) ++{ ++ if (!ddr_perf_is_filtered(a)) ++ return true; ++ if (!ddr_perf_is_filtered(b)) ++ return true; ++ return ddr_perf_filter_val(a) == ddr_perf_filter_val(b); ++} ++ ++static bool ddr_perf_is_enhanced_filtered(struct perf_event *event) ++{ ++ unsigned int filt; ++ struct ddr_pmu *pmu = to_ddr_pmu(event->pmu); ++ ++ filt = pmu->devtype_data->quirks & DDR_CAP_AXI_ID_FILTER_ENHANCED; ++ return (filt == DDR_CAP_AXI_ID_FILTER_ENHANCED) && ++ ddr_perf_is_filtered(event); ++} ++ + static u32 ddr_perf_alloc_counter(struct ddr_pmu *pmu, int event) + { + int i; +@@ -209,27 +240,17 @@ static void ddr_perf_free_counter(struct ddr_pmu *pmu, int counter) + + static u32 ddr_perf_read_counter(struct ddr_pmu *pmu, int counter) + { +- return readl_relaxed(pmu->base + COUNTER_READ + counter * 4); +-} +- +-static bool ddr_perf_is_filtered(struct perf_event *event) +-{ +- return event->attr.config == 0x41 || event->attr.config == 0x42; +-} ++ struct perf_event *event = pmu->events[counter]; ++ void __iomem *base = pmu->base; + +-static u32 ddr_perf_filter_val(struct perf_event *event) +-{ +- return event->attr.config1; +-} +- +-static bool ddr_perf_filters_compatible(struct perf_event *a, +- struct perf_event *b) +-{ +- if (!ddr_perf_is_filtered(a)) +- return true; +- if (!ddr_perf_is_filtered(b)) +- return true; +- return ddr_perf_filter_val(a) == ddr_perf_filter_val(b); ++ /* ++ * return bytes instead of bursts from ddr transaction for ++ * axid-read and axid-write event if PMU core supports enhanced ++ * filter. ++ */ ++ base += ddr_perf_is_enhanced_filtered(event) ? COUNTER_DPCR1 : ++ COUNTER_READ; ++ return readl_relaxed(base + counter * 4); + } + + static int ddr_perf_event_init(struct perf_event *event) +diff --git a/drivers/phy/motorola/phy-cpcap-usb.c b/drivers/phy/motorola/phy-cpcap-usb.c +index 9a38741d3546..5baf64dfb24d 100644 +--- a/drivers/phy/motorola/phy-cpcap-usb.c ++++ b/drivers/phy/motorola/phy-cpcap-usb.c +@@ -115,7 +115,7 @@ struct cpcap_usb_ints_state { + enum cpcap_gpio_mode { + CPCAP_DM_DP, + CPCAP_MDM_RX_TX, +- CPCAP_UNKNOWN, ++ CPCAP_UNKNOWN_DISABLED, /* Seems to disable USB lines */ + CPCAP_OTG_DM_DP, + }; + +@@ -381,7 +381,8 @@ static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata) + { + int error; + +- error = cpcap_usb_gpio_set_mode(ddata, CPCAP_DM_DP); ++ /* Disable lines to prevent glitches from waking up mdm6600 */ ++ error = cpcap_usb_gpio_set_mode(ddata, CPCAP_UNKNOWN_DISABLED); + if (error) + goto out_err; + +@@ -408,6 +409,11 @@ static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata) + if (error) + goto out_err; + ++ /* Enable UART mode */ ++ error = cpcap_usb_gpio_set_mode(ddata, CPCAP_DM_DP); ++ if (error) ++ goto out_err; ++ + return 0; + + out_err: +@@ -420,7 +426,8 @@ static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata) + { + int error; + +- error = cpcap_usb_gpio_set_mode(ddata, CPCAP_OTG_DM_DP); ++ /* Disable lines to prevent glitches from waking up mdm6600 */ ++ error = cpcap_usb_gpio_set_mode(ddata, CPCAP_UNKNOWN_DISABLED); + if (error) + return error; + +@@ -460,6 +467,11 @@ static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata) + if (error) + goto out_err; + ++ /* Enable USB mode */ ++ error = cpcap_usb_gpio_set_mode(ddata, CPCAP_OTG_DM_DP); ++ if (error) ++ goto out_err; ++ + return 0; + + out_err: +diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c +index 39e8deb8001e..27dd20a7fe13 100644 +--- a/drivers/phy/qualcomm/phy-qcom-qmp.c ++++ b/drivers/phy/qualcomm/phy-qcom-qmp.c +@@ -66,7 +66,7 @@ + /* QPHY_V3_PCS_MISC_CLAMP_ENABLE register bits */ + #define CLAMP_EN BIT(0) /* enables i/o clamp_n */ + +-#define PHY_INIT_COMPLETE_TIMEOUT 1000 ++#define PHY_INIT_COMPLETE_TIMEOUT 10000 + #define POWER_DOWN_DELAY_US_MIN 10 + #define POWER_DOWN_DELAY_US_MAX 11 + +diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c +index d27be2836bc2..74e988f839e8 100644 +--- a/drivers/platform/x86/dell-laptop.c ++++ b/drivers/platform/x86/dell-laptop.c +@@ -33,6 +33,7 @@ + + struct quirk_entry { + bool touchpad_led; ++ bool kbd_led_not_present; + bool kbd_led_levels_off_1; + bool kbd_missing_ac_tag; + +@@ -73,6 +74,10 @@ static struct quirk_entry quirk_dell_latitude_e6410 = { + .kbd_led_levels_off_1 = true, + }; + ++static struct quirk_entry quirk_dell_inspiron_1012 = { ++ .kbd_led_not_present = true, ++}; ++ + static struct platform_driver platform_driver = { + .driver = { + .name = "dell-laptop", +@@ -310,6 +315,24 @@ static const struct dmi_system_id dell_quirks[] __initconst = { + }, + .driver_data = &quirk_dell_latitude_e6410, + }, ++ { ++ .callback = dmi_matched, ++ .ident = "Dell Inspiron 1012", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1012"), ++ }, ++ .driver_data = &quirk_dell_inspiron_1012, ++ }, ++ { ++ .callback = dmi_matched, ++ .ident = "Dell Inspiron 1018", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1018"), ++ }, ++ .driver_data = &quirk_dell_inspiron_1012, ++ }, + { } + }; + +@@ -1493,6 +1516,9 @@ static void kbd_init(void) + { + int ret; + ++ if (quirks && quirks->kbd_led_not_present) ++ return; ++ + ret = kbd_init_info(); + kbd_init_tokens(); + +diff --git a/drivers/power/supply/ingenic-battery.c b/drivers/power/supply/ingenic-battery.c +index 35816d4b3012..2748715c4c75 100644 +--- a/drivers/power/supply/ingenic-battery.c ++++ b/drivers/power/supply/ingenic-battery.c +@@ -100,10 +100,17 @@ static int ingenic_battery_set_scale(struct ingenic_battery *bat) + return -EINVAL; + } + +- return iio_write_channel_attribute(bat->channel, +- scale_raw[best_idx], +- scale_raw[best_idx + 1], +- IIO_CHAN_INFO_SCALE); ++ /* Only set scale if there is more than one (fractional) entry */ ++ if (scale_len > 2) { ++ ret = iio_write_channel_attribute(bat->channel, ++ scale_raw[best_idx], ++ scale_raw[best_idx + 1], ++ IIO_CHAN_INFO_SCALE); ++ if (ret) ++ return ret; ++ } ++ ++ return 0; + } + + static enum power_supply_property ingenic_battery_properties[] = { +diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c +index 45972056ed8c..11cac7e10663 100644 +--- a/drivers/spi/spi-dw.c ++++ b/drivers/spi/spi-dw.c +@@ -172,9 +172,11 @@ static inline u32 rx_max(struct dw_spi *dws) + + static void dw_writer(struct dw_spi *dws) + { +- u32 max = tx_max(dws); ++ u32 max; + u16 txw = 0; + ++ spin_lock(&dws->buf_lock); ++ max = tx_max(dws); + while (max--) { + /* Set the tx word if the transfer's original "tx" is not null */ + if (dws->tx_end - dws->len) { +@@ -186,13 +188,16 @@ static void dw_writer(struct dw_spi *dws) + dw_write_io_reg(dws, DW_SPI_DR, txw); + dws->tx += dws->n_bytes; + } ++ spin_unlock(&dws->buf_lock); + } + + static void dw_reader(struct dw_spi *dws) + { +- u32 max = rx_max(dws); ++ u32 max; + u16 rxw; + ++ spin_lock(&dws->buf_lock); ++ max = rx_max(dws); + while (max--) { + rxw = dw_read_io_reg(dws, DW_SPI_DR); + /* Care rx only if the transfer's original "rx" is not null */ +@@ -204,6 +209,7 @@ static void dw_reader(struct dw_spi *dws) + } + dws->rx += dws->n_bytes; + } ++ spin_unlock(&dws->buf_lock); + } + + static void int_error_stop(struct dw_spi *dws, const char *msg) +@@ -276,18 +282,20 @@ static int dw_spi_transfer_one(struct spi_controller *master, + { + struct dw_spi *dws = spi_controller_get_devdata(master); + struct chip_data *chip = spi_get_ctldata(spi); ++ unsigned long flags; + u8 imask = 0; + u16 txlevel = 0; + u32 cr0; + int ret; + + dws->dma_mapped = 0; +- ++ spin_lock_irqsave(&dws->buf_lock, flags); + dws->tx = (void *)transfer->tx_buf; + dws->tx_end = dws->tx + transfer->len; + dws->rx = transfer->rx_buf; + dws->rx_end = dws->rx + transfer->len; + dws->len = transfer->len; ++ spin_unlock_irqrestore(&dws->buf_lock, flags); + + spi_enable_chip(dws, 0); + +@@ -471,6 +479,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) + dws->type = SSI_MOTO_SPI; + dws->dma_inited = 0; + dws->dma_addr = (dma_addr_t)(dws->paddr + DW_SPI_DR); ++ spin_lock_init(&dws->buf_lock); + + spi_controller_set_devdata(master, dws); + +diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h +index c9c15881e982..f3a2f157a2b1 100644 +--- a/drivers/spi/spi-dw.h ++++ b/drivers/spi/spi-dw.h +@@ -120,6 +120,7 @@ struct dw_spi { + size_t len; + void *tx; + void *tx_end; ++ spinlock_t buf_lock; + void *rx; + void *rx_end; + int dma_mapped; +diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c +index 9f92165fe09f..2fd843b18297 100644 +--- a/drivers/spi/spi-pxa2xx.c ++++ b/drivers/spi/spi-pxa2xx.c +@@ -1461,6 +1461,10 @@ static const struct pci_device_id pxa2xx_spi_pci_compound_match[] = { + { PCI_VDEVICE(INTEL, 0x02aa), LPSS_CNL_SSP }, + { PCI_VDEVICE(INTEL, 0x02ab), LPSS_CNL_SSP }, + { PCI_VDEVICE(INTEL, 0x02fb), LPSS_CNL_SSP }, ++ /* CML-H */ ++ { PCI_VDEVICE(INTEL, 0x06aa), LPSS_CNL_SSP }, ++ { PCI_VDEVICE(INTEL, 0x06ab), LPSS_CNL_SSP }, ++ { PCI_VDEVICE(INTEL, 0x06fb), LPSS_CNL_SSP }, + /* TGL-LP */ + { PCI_VDEVICE(INTEL, 0xa0aa), LPSS_CNL_SSP }, + { PCI_VDEVICE(INTEL, 0xa0ab), LPSS_CNL_SSP }, +diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c +index 26a31854c636..c48956f0ef29 100644 +--- a/drivers/staging/most/net/net.c ++++ b/drivers/staging/most/net/net.c +@@ -81,6 +81,11 @@ static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo) + unsigned int payload_len = skb->len - ETH_HLEN; + unsigned int mdp_len = payload_len + MDP_HDR_LEN; + ++ if (mdp_len < skb->len) { ++ pr_err("drop: too large packet! (%u)\n", skb->len); ++ return -EINVAL; ++ } ++ + if (mbo->buffer_length < mdp_len) { + pr_err("drop: too small buffer! (%d for %d)\n", + mbo->buffer_length, mdp_len); +@@ -128,6 +133,11 @@ static int skb_to_mep(const struct sk_buff *skb, struct mbo *mbo) + u8 *buff = mbo->virt_address; + unsigned int mep_len = skb->len + MEP_HDR_LEN; + ++ if (mep_len < skb->len) { ++ pr_err("drop: too large packet! (%u)\n", skb->len); ++ return -EINVAL; ++ } ++ + if (mbo->buffer_length < mep_len) { + pr_err("drop: too small buffer! (%d for %d)\n", + mbo->buffer_length, mep_len); +diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c b/drivers/staging/mt7621-pci/pci-mt7621.c +index 6b98827da57f..3633c924848e 100644 +--- a/drivers/staging/mt7621-pci/pci-mt7621.c ++++ b/drivers/staging/mt7621-pci/pci-mt7621.c +@@ -29,15 +29,14 @@ + #include + #include + #include ++#include + #include + #include + + #include "../../pci/pci.h" + + /* sysctl */ +-#define MT7621_CHIP_REV_ID 0x0c + #define MT7621_GPIO_MODE 0x60 +-#define CHIP_REV_MT7621_E2 0x0101 + + /* MediaTek specific configuration registers */ + #define PCIE_FTS_NUM 0x70c +@@ -126,6 +125,8 @@ struct mt7621_pcie_port { + * @ports: pointer to PCIe port information + * @perst: gpio reset + * @rst: pointer to pcie reset ++ * @resets_inverted: depends on chip revision ++ * reset lines are inverted. + */ + struct mt7621_pcie { + void __iomem *base; +@@ -140,6 +141,7 @@ struct mt7621_pcie { + struct list_head ports; + struct gpio_desc *perst; + struct reset_control *rst; ++ bool resets_inverted; + }; + + static inline u32 pcie_read(struct mt7621_pcie *pcie, u32 reg) +@@ -229,9 +231,9 @@ static inline void mt7621_pcie_port_clk_disable(struct mt7621_pcie_port *port) + + static inline void mt7621_control_assert(struct mt7621_pcie_port *port) + { +- u32 chip_rev_id = rt_sysc_r32(MT7621_CHIP_REV_ID); ++ struct mt7621_pcie *pcie = port->pcie; + +- if ((chip_rev_id & 0xFFFF) == CHIP_REV_MT7621_E2) ++ if (pcie->resets_inverted) + reset_control_assert(port->pcie_rst); + else + reset_control_deassert(port->pcie_rst); +@@ -239,9 +241,9 @@ static inline void mt7621_control_assert(struct mt7621_pcie_port *port) + + static inline void mt7621_control_deassert(struct mt7621_pcie_port *port) + { +- u32 chip_rev_id = rt_sysc_r32(MT7621_CHIP_REV_ID); ++ struct mt7621_pcie *pcie = port->pcie; + +- if ((chip_rev_id & 0xFFFF) == CHIP_REV_MT7621_E2) ++ if (pcie->resets_inverted) + reset_control_deassert(port->pcie_rst); + else + reset_control_assert(port->pcie_rst); +@@ -641,9 +643,14 @@ static int mt7621_pcie_register_host(struct pci_host_bridge *host, + return pci_host_probe(host); + } + ++static const struct soc_device_attribute mt7621_pci_quirks_match[] = { ++ { .soc_id = "mt7621", .revision = "E2" } ++}; ++ + static int mt7621_pci_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; ++ const struct soc_device_attribute *attr; + struct mt7621_pcie *pcie; + struct pci_host_bridge *bridge; + int err; +@@ -661,6 +668,10 @@ static int mt7621_pci_probe(struct platform_device *pdev) + platform_set_drvdata(pdev, pcie); + INIT_LIST_HEAD(&pcie->ports); + ++ attr = soc_device_match(mt7621_pci_quirks_match); ++ if (attr) ++ pcie->resets_inverted = true; ++ + err = mt7621_pcie_parse_dt(pcie); + if (err) { + dev_err(dev, "Parsing DT failed\n"); +diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h +index 50e1c8918040..e2fabe818b19 100644 +--- a/drivers/staging/vt6656/device.h ++++ b/drivers/staging/vt6656/device.h +@@ -52,6 +52,8 @@ + #define RATE_AUTO 12 + + #define MAX_RATE 12 ++#define VNT_B_RATES (BIT(RATE_1M) | BIT(RATE_2M) |\ ++ BIT(RATE_5M) | BIT(RATE_11M)) + + /* + * device specific +diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c +index f40947955675..af215860be4c 100644 +--- a/drivers/staging/vt6656/int.c ++++ b/drivers/staging/vt6656/int.c +@@ -99,9 +99,11 @@ static int vnt_int_report_rate(struct vnt_private *priv, u8 pkt_no, u8 tsr) + + info->status.rates[0].count = tx_retry; + +- if (!(tsr & (TSR_TMO | TSR_RETRYTMO))) { ++ if (!(tsr & TSR_TMO)) { + info->status.rates[0].idx = idx; +- info->flags |= IEEE80211_TX_STAT_ACK; ++ ++ if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) ++ info->flags |= IEEE80211_TX_STAT_ACK; + } + + ieee80211_tx_status_irqsafe(priv->hw, context->skb); +diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c +index c26882e2bb80..69a48383611f 100644 +--- a/drivers/staging/vt6656/main_usb.c ++++ b/drivers/staging/vt6656/main_usb.c +@@ -1016,6 +1016,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) + ieee80211_hw_set(priv->hw, RX_INCLUDES_FCS); + ieee80211_hw_set(priv->hw, REPORTS_TX_ACK_STATUS); + ieee80211_hw_set(priv->hw, SUPPORTS_PS); ++ ieee80211_hw_set(priv->hw, PS_NULLFUNC_STACK); + + priv->hw->max_signal = 100; + +diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c +index 4e9cfacf75f2..ab6141f361af 100644 +--- a/drivers/staging/vt6656/rxtx.c ++++ b/drivers/staging/vt6656/rxtx.c +@@ -278,11 +278,9 @@ static u16 vnt_rxtx_datahead_g(struct vnt_usb_send_context *tx_context, + PK_TYPE_11B, &buf->b); + + /* Get Duration and TimeStamp */ +- if (ieee80211_is_pspoll(hdr->frame_control)) { +- __le16 dur = cpu_to_le16(priv->current_aid | BIT(14) | BIT(15)); +- +- buf->duration_a = dur; +- buf->duration_b = dur; ++ if (ieee80211_is_nullfunc(hdr->frame_control)) { ++ buf->duration_a = hdr->duration_id; ++ buf->duration_b = hdr->duration_id; + } else { + buf->duration_a = vnt_get_duration_le(priv, + tx_context->pkt_type, need_ack); +@@ -371,10 +369,8 @@ static u16 vnt_rxtx_datahead_ab(struct vnt_usb_send_context *tx_context, + tx_context->pkt_type, &buf->ab); + + /* Get Duration and TimeStampOff */ +- if (ieee80211_is_pspoll(hdr->frame_control)) { +- __le16 dur = cpu_to_le16(priv->current_aid | BIT(14) | BIT(15)); +- +- buf->duration = dur; ++ if (ieee80211_is_nullfunc(hdr->frame_control)) { ++ buf->duration = hdr->duration_id; + } else { + buf->duration = vnt_get_duration_le(priv, tx_context->pkt_type, + need_ack); +@@ -815,10 +811,14 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) + if (info->band == NL80211_BAND_5GHZ) { + pkt_type = PK_TYPE_11A; + } else { +- if (tx_rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT) +- pkt_type = PK_TYPE_11GB; +- else +- pkt_type = PK_TYPE_11GA; ++ if (tx_rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { ++ if (priv->basic_rates & VNT_B_RATES) ++ pkt_type = PK_TYPE_11GB; ++ else ++ pkt_type = PK_TYPE_11GA; ++ } else { ++ pkt_type = PK_TYPE_11A; ++ } + } + } else { + pkt_type = PK_TYPE_11B; +diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c +index 7350fe5d96a3..a8860d2aee68 100644 +--- a/drivers/staging/wlan-ng/prism2mgmt.c ++++ b/drivers/staging/wlan-ng/prism2mgmt.c +@@ -959,7 +959,7 @@ int prism2mgmt_flashdl_state(struct wlandevice *wlandev, void *msgp) + } + } + +- return 0; ++ return result; + } + + /*---------------------------------------------------------------- +diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c b/drivers/tty/serial/8250/8250_bcm2835aux.c +index 8ce700c1a7fc..4997c519ebb3 100644 +--- a/drivers/tty/serial/8250/8250_bcm2835aux.c ++++ b/drivers/tty/serial/8250/8250_bcm2835aux.c +@@ -113,7 +113,7 @@ static int bcm2835aux_serial_remove(struct platform_device *pdev) + { + struct bcm2835aux_data *data = platform_get_drvdata(pdev); + +- serial8250_unregister_port(data->uart.port.line); ++ serial8250_unregister_port(data->line); + clk_disable_unprepare(data->clk); + + return 0; +diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c +index 34f602c3a882..9d8c660dc289 100644 +--- a/drivers/tty/serial/imx.c ++++ b/drivers/tty/serial/imx.c +@@ -700,22 +700,33 @@ static void imx_uart_start_tx(struct uart_port *port) + } + } + +-static irqreturn_t imx_uart_rtsint(int irq, void *dev_id) ++static irqreturn_t __imx_uart_rtsint(int irq, void *dev_id) + { + struct imx_port *sport = dev_id; + u32 usr1; + +- spin_lock(&sport->port.lock); +- + imx_uart_writel(sport, USR1_RTSD, USR1); + usr1 = imx_uart_readl(sport, USR1) & USR1_RTSS; + uart_handle_cts_change(&sport->port, !!usr1); + wake_up_interruptible(&sport->port.state->port.delta_msr_wait); + +- spin_unlock(&sport->port.lock); + return IRQ_HANDLED; + } + ++static irqreturn_t imx_uart_rtsint(int irq, void *dev_id) ++{ ++ struct imx_port *sport = dev_id; ++ irqreturn_t ret; ++ ++ spin_lock(&sport->port.lock); ++ ++ ret = __imx_uart_rtsint(irq, dev_id); ++ ++ spin_unlock(&sport->port.lock); ++ ++ return ret; ++} ++ + static irqreturn_t imx_uart_txint(int irq, void *dev_id) + { + struct imx_port *sport = dev_id; +@@ -726,14 +737,12 @@ static irqreturn_t imx_uart_txint(int irq, void *dev_id) + return IRQ_HANDLED; + } + +-static irqreturn_t imx_uart_rxint(int irq, void *dev_id) ++static irqreturn_t __imx_uart_rxint(int irq, void *dev_id) + { + struct imx_port *sport = dev_id; + unsigned int rx, flg, ignored = 0; + struct tty_port *port = &sport->port.state->port; + +- spin_lock(&sport->port.lock); +- + while (imx_uart_readl(sport, USR2) & USR2_RDR) { + u32 usr2; + +@@ -792,11 +801,25 @@ static irqreturn_t imx_uart_rxint(int irq, void *dev_id) + } + + out: +- spin_unlock(&sport->port.lock); + tty_flip_buffer_push(port); ++ + return IRQ_HANDLED; + } + ++static irqreturn_t imx_uart_rxint(int irq, void *dev_id) ++{ ++ struct imx_port *sport = dev_id; ++ irqreturn_t ret; ++ ++ spin_lock(&sport->port.lock); ++ ++ ret = __imx_uart_rxint(irq, dev_id); ++ ++ spin_unlock(&sport->port.lock); ++ ++ return ret; ++} ++ + static void imx_uart_clear_rx_errors(struct imx_port *sport); + + /* +@@ -855,6 +878,8 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id) + unsigned int usr1, usr2, ucr1, ucr2, ucr3, ucr4; + irqreturn_t ret = IRQ_NONE; + ++ spin_lock(&sport->port.lock); ++ + usr1 = imx_uart_readl(sport, USR1); + usr2 = imx_uart_readl(sport, USR2); + ucr1 = imx_uart_readl(sport, UCR1); +@@ -888,27 +913,25 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id) + usr2 &= ~USR2_ORE; + + if (usr1 & (USR1_RRDY | USR1_AGTIM)) { +- imx_uart_rxint(irq, dev_id); ++ __imx_uart_rxint(irq, dev_id); + ret = IRQ_HANDLED; + } + + if ((usr1 & USR1_TRDY) || (usr2 & USR2_TXDC)) { +- imx_uart_txint(irq, dev_id); ++ imx_uart_transmit_buffer(sport); + ret = IRQ_HANDLED; + } + + if (usr1 & USR1_DTRD) { + imx_uart_writel(sport, USR1_DTRD, USR1); + +- spin_lock(&sport->port.lock); + imx_uart_mctrl_check(sport); +- spin_unlock(&sport->port.lock); + + ret = IRQ_HANDLED; + } + + if (usr1 & USR1_RTSD) { +- imx_uart_rtsint(irq, dev_id); ++ __imx_uart_rtsint(irq, dev_id); + ret = IRQ_HANDLED; + } + +@@ -923,6 +946,8 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id) + ret = IRQ_HANDLED; + } + ++ spin_unlock(&sport->port.lock); ++ + return ret; + } + +diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c +index 97d6ae3c4df2..cede7a8e3605 100644 +--- a/drivers/usb/dwc3/core.c ++++ b/drivers/usb/dwc3/core.c +@@ -1209,6 +1209,9 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc) + /* do nothing */ + break; + } ++ ++ /* de-assert DRVVBUS for HOST and OTG mode */ ++ dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE); + } + + static void dwc3_get_properties(struct dwc3 *dwc) +diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c +index 294276f7deb9..7051611229c9 100644 +--- a/drivers/usb/dwc3/dwc3-pci.c ++++ b/drivers/usb/dwc3/dwc3-pci.c +@@ -34,6 +34,7 @@ + #define PCI_DEVICE_ID_INTEL_GLK 0x31aa + #define PCI_DEVICE_ID_INTEL_CNPLP 0x9dee + #define PCI_DEVICE_ID_INTEL_CNPH 0xa36e ++#define PCI_DEVICE_ID_INTEL_CNPV 0xa3b0 + #define PCI_DEVICE_ID_INTEL_ICLLP 0x34ee + #define PCI_DEVICE_ID_INTEL_EHLLP 0x4b7e + #define PCI_DEVICE_ID_INTEL_TGPLP 0xa0ee +@@ -342,6 +343,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = { + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPH), + (kernel_ulong_t) &dwc3_pci_intel_properties, }, + ++ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPV), ++ (kernel_ulong_t) &dwc3_pci_intel_properties, }, ++ + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICLLP), + (kernel_ulong_t) &dwc3_pci_intel_properties, }, + +diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c +index dc172513a4aa..b8e24ccba9f3 100644 +--- a/drivers/usb/host/xhci-tegra.c ++++ b/drivers/usb/host/xhci-tegra.c +@@ -1413,6 +1413,7 @@ MODULE_FIRMWARE("nvidia/tegra210/xusb.bin"); + + static const char * const tegra186_supply_names[] = { + }; ++MODULE_FIRMWARE("nvidia/tegra186/xusb.bin"); + + static const struct tegra_xusb_phy_type tegra186_phy_types[] = { + { .name = "usb3", .num = 3, }, +diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c +index 5261f8dfedec..e3b8c84ccdb8 100644 +--- a/drivers/usb/musb/jz4740.c ++++ b/drivers/usb/musb/jz4740.c +@@ -75,14 +75,17 @@ static struct musb_hdrc_platform_data jz4740_musb_platform_data = { + static int jz4740_musb_init(struct musb *musb) + { + struct device *dev = musb->controller->parent; ++ int err; + + if (dev->of_node) + musb->xceiv = devm_usb_get_phy_by_phandle(dev, "phys", 0); + else + musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + if (IS_ERR(musb->xceiv)) { +- dev_err(dev, "No transceiver configured\n"); +- return PTR_ERR(musb->xceiv); ++ err = PTR_ERR(musb->xceiv); ++ if (err != -EPROBE_DEFER) ++ dev_err(dev, "No transceiver configured: %d", err); ++ return err; + } + + /* Silicon does not implement ConfigData register. +diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c +index 302eb9530859..627bea7e6cfb 100644 +--- a/drivers/usb/serial/ir-usb.c ++++ b/drivers/usb/serial/ir-usb.c +@@ -45,9 +45,10 @@ static int buffer_size; + static int xbof = -1; + + static int ir_startup (struct usb_serial *serial); +-static int ir_open(struct tty_struct *tty, struct usb_serial_port *port); +-static int ir_prepare_write_buffer(struct usb_serial_port *port, +- void *dest, size_t size); ++static int ir_write(struct tty_struct *tty, struct usb_serial_port *port, ++ const unsigned char *buf, int count); ++static int ir_write_room(struct tty_struct *tty); ++static void ir_write_bulk_callback(struct urb *urb); + static void ir_process_read_urb(struct urb *urb); + static void ir_set_termios(struct tty_struct *tty, + struct usb_serial_port *port, struct ktermios *old_termios); +@@ -77,8 +78,9 @@ static struct usb_serial_driver ir_device = { + .num_ports = 1, + .set_termios = ir_set_termios, + .attach = ir_startup, +- .open = ir_open, +- .prepare_write_buffer = ir_prepare_write_buffer, ++ .write = ir_write, ++ .write_room = ir_write_room, ++ .write_bulk_callback = ir_write_bulk_callback, + .process_read_urb = ir_process_read_urb, + }; + +@@ -195,6 +197,9 @@ static int ir_startup(struct usb_serial *serial) + struct usb_irda_cs_descriptor *irda_desc; + int rates; + ++ if (serial->num_bulk_in < 1 || serial->num_bulk_out < 1) ++ return -ENODEV; ++ + irda_desc = irda_usb_find_class_desc(serial, 0); + if (!irda_desc) { + dev_err(&serial->dev->dev, +@@ -251,35 +256,102 @@ static int ir_startup(struct usb_serial *serial) + return 0; + } + +-static int ir_open(struct tty_struct *tty, struct usb_serial_port *port) ++static int ir_write(struct tty_struct *tty, struct usb_serial_port *port, ++ const unsigned char *buf, int count) + { +- int i; ++ struct urb *urb = NULL; ++ unsigned long flags; ++ int ret; + +- for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i) +- port->write_urbs[i]->transfer_flags = URB_ZERO_PACKET; ++ if (port->bulk_out_size == 0) ++ return -EINVAL; + +- /* Start reading from the device */ +- return usb_serial_generic_open(tty, port); +-} ++ if (count == 0) ++ return 0; + +-static int ir_prepare_write_buffer(struct usb_serial_port *port, +- void *dest, size_t size) +-{ +- unsigned char *buf = dest; +- int count; ++ count = min(count, port->bulk_out_size - 1); ++ ++ spin_lock_irqsave(&port->lock, flags); ++ if (__test_and_clear_bit(0, &port->write_urbs_free)) { ++ urb = port->write_urbs[0]; ++ port->tx_bytes += count; ++ } ++ spin_unlock_irqrestore(&port->lock, flags); ++ ++ if (!urb) ++ return 0; + + /* + * The first byte of the packet we send to the device contains an +- * inbound header which indicates an additional number of BOFs and ++ * outbound header which indicates an additional number of BOFs and + * a baud rate change. + * + * See section 5.4.2.2 of the USB IrDA spec. + */ +- *buf = ir_xbof | ir_baud; ++ *(u8 *)urb->transfer_buffer = ir_xbof | ir_baud; ++ ++ memcpy(urb->transfer_buffer + 1, buf, count); ++ ++ urb->transfer_buffer_length = count + 1; ++ urb->transfer_flags = URB_ZERO_PACKET; ++ ++ ret = usb_submit_urb(urb, GFP_ATOMIC); ++ if (ret) { ++ dev_err(&port->dev, "failed to submit write urb: %d\n", ret); ++ ++ spin_lock_irqsave(&port->lock, flags); ++ __set_bit(0, &port->write_urbs_free); ++ port->tx_bytes -= count; ++ spin_unlock_irqrestore(&port->lock, flags); ++ ++ return ret; ++ } ++ ++ return count; ++} ++ ++static void ir_write_bulk_callback(struct urb *urb) ++{ ++ struct usb_serial_port *port = urb->context; ++ int status = urb->status; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&port->lock, flags); ++ __set_bit(0, &port->write_urbs_free); ++ port->tx_bytes -= urb->transfer_buffer_length - 1; ++ spin_unlock_irqrestore(&port->lock, flags); ++ ++ switch (status) { ++ case 0: ++ break; ++ case -ENOENT: ++ case -ECONNRESET: ++ case -ESHUTDOWN: ++ dev_dbg(&port->dev, "write urb stopped: %d\n", status); ++ return; ++ case -EPIPE: ++ dev_err(&port->dev, "write urb stopped: %d\n", status); ++ return; ++ default: ++ dev_err(&port->dev, "nonzero write-urb status: %d\n", status); ++ break; ++ } ++ ++ usb_serial_port_softint(port); ++} ++ ++static int ir_write_room(struct tty_struct *tty) ++{ ++ struct usb_serial_port *port = tty->driver_data; ++ int count = 0; ++ ++ if (port->bulk_out_size == 0) ++ return 0; ++ ++ if (test_bit(0, &port->write_urbs_free)) ++ count = port->bulk_out_size - 1; + +- count = kfifo_out_locked(&port->write_fifo, buf + 1, size - 1, +- &port->lock); +- return count + 1; ++ return count; + } + + static void ir_process_read_urb(struct urb *urb) +@@ -332,34 +404,34 @@ static void ir_set_termios(struct tty_struct *tty, + + switch (baud) { + case 2400: +- ir_baud = USB_IRDA_BR_2400; ++ ir_baud = USB_IRDA_LS_2400; + break; + case 9600: +- ir_baud = USB_IRDA_BR_9600; ++ ir_baud = USB_IRDA_LS_9600; + break; + case 19200: +- ir_baud = USB_IRDA_BR_19200; ++ ir_baud = USB_IRDA_LS_19200; + break; + case 38400: +- ir_baud = USB_IRDA_BR_38400; ++ ir_baud = USB_IRDA_LS_38400; + break; + case 57600: +- ir_baud = USB_IRDA_BR_57600; ++ ir_baud = USB_IRDA_LS_57600; + break; + case 115200: +- ir_baud = USB_IRDA_BR_115200; ++ ir_baud = USB_IRDA_LS_115200; + break; + case 576000: +- ir_baud = USB_IRDA_BR_576000; ++ ir_baud = USB_IRDA_LS_576000; + break; + case 1152000: +- ir_baud = USB_IRDA_BR_1152000; ++ ir_baud = USB_IRDA_LS_1152000; + break; + case 4000000: +- ir_baud = USB_IRDA_BR_4000000; ++ ir_baud = USB_IRDA_LS_4000000; + break; + default: +- ir_baud = USB_IRDA_BR_9600; ++ ir_baud = USB_IRDA_LS_9600; + baud = 9600; + } + +diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h +index d0bdebd87ce3..1b23741036ee 100644 +--- a/drivers/usb/storage/unusual_uas.h ++++ b/drivers/usb/storage/unusual_uas.h +@@ -87,12 +87,15 @@ UNUSUAL_DEV(0x2537, 0x1068, 0x0000, 0x9999, + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_UAS), + +-/* Reported-by: Takeo Nakayama */ ++/* ++ * Initially Reported-by: Takeo Nakayama ++ * UAS Ignore Reported by Steven Ellis ++ */ + UNUSUAL_DEV(0x357d, 0x7788, 0x0000, 0x9999, + "JMicron", + "JMS566", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, +- US_FL_NO_REPORT_OPCODES), ++ US_FL_NO_REPORT_OPCODES | US_FL_IGNORE_UAS), + + /* Reported-by: Hans de Goede */ + UNUSUAL_DEV(0x4971, 0x1012, 0x0000, 0x9999, +diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c +index ed8655c6af8c..b498960ff72b 100644 +--- a/drivers/usb/typec/tcpm/fusb302.c ++++ b/drivers/usb/typec/tcpm/fusb302.c +@@ -1666,7 +1666,7 @@ static const struct property_entry port_props[] = { + PROPERTY_ENTRY_STRING("try-power-role", "sink"), + PROPERTY_ENTRY_U32_ARRAY("source-pdos", src_pdo), + PROPERTY_ENTRY_U32_ARRAY("sink-pdos", snk_pdo), +- PROPERTY_ENTRY_U32("op-sink-microwatt", 2500), ++ PROPERTY_ENTRY_U32("op-sink-microwatt", 2500000), + { } + }; + +diff --git a/drivers/usb/typec/tcpm/wcove.c b/drivers/usb/typec/tcpm/wcove.c +index edc271da14f4..9b745f432c91 100644 +--- a/drivers/usb/typec/tcpm/wcove.c ++++ b/drivers/usb/typec/tcpm/wcove.c +@@ -597,7 +597,7 @@ static const struct property_entry wcove_props[] = { + PROPERTY_ENTRY_STRING("try-power-role", "sink"), + PROPERTY_ENTRY_U32_ARRAY("source-pdos", src_pdo), + PROPERTY_ENTRY_U32_ARRAY("sink-pdos", snk_pdo), +- PROPERTY_ENTRY_U32("op-sink-microwatt", 15000), ++ PROPERTY_ENTRY_U32("op-sink-microwatt", 15000000), + { } + }; + +diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig +index 4c761abc5688..e2745f686196 100644 +--- a/drivers/watchdog/Kconfig ++++ b/drivers/watchdog/Kconfig +@@ -687,6 +687,7 @@ config MAX63XX_WATCHDOG + config MAX77620_WATCHDOG + tristate "Maxim Max77620 Watchdog Timer" + depends on MFD_MAX77620 || COMPILE_TEST ++ select WATCHDOG_CORE + help + This is the driver for the Max77620 watchdog timer. + Say 'Y' here to enable the watchdog timer support for +diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c +index 1cccf8eb1c5d..8e6dfe76f9c9 100644 +--- a/drivers/watchdog/orion_wdt.c ++++ b/drivers/watchdog/orion_wdt.c +@@ -602,7 +602,7 @@ static int orion_wdt_probe(struct platform_device *pdev) + set_bit(WDOG_HW_RUNNING, &dev->wdt.status); + + /* Request the IRQ only after the watchdog is disabled */ +- irq = platform_get_irq(pdev, 0); ++ irq = platform_get_irq_optional(pdev, 0); + if (irq > 0) { + /* + * Not all supported platforms specify an interrupt for the +@@ -617,7 +617,7 @@ static int orion_wdt_probe(struct platform_device *pdev) + } + + /* Optional 2nd interrupt for pretimeout */ +- irq = platform_get_irq(pdev, 1); ++ irq = platform_get_irq_optional(pdev, 1); + if (irq > 0) { + orion_wdt_info.options |= WDIOF_PRETIMEOUT; + ret = devm_request_irq(&pdev->dev, irq, orion_wdt_pre_irq, +diff --git a/drivers/watchdog/rn5t618_wdt.c b/drivers/watchdog/rn5t618_wdt.c +index 234876047431..6e524c8e26a8 100644 +--- a/drivers/watchdog/rn5t618_wdt.c ++++ b/drivers/watchdog/rn5t618_wdt.c +@@ -188,6 +188,7 @@ static struct platform_driver rn5t618_wdt_driver = { + + module_platform_driver(rn5t618_wdt_driver); + ++MODULE_ALIAS("platform:rn5t618-wdt"); + MODULE_AUTHOR("Beniamino Galvani "); + MODULE_DESCRIPTION("RN5T618 watchdog driver"); + MODULE_LICENSE("GPL v2"); +diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h +index f55e53486e74..53611d7e9d28 100644 +--- a/fs/cifs/cifsglob.h ++++ b/fs/cifs/cifsglob.h +@@ -1538,6 +1538,7 @@ struct mid_q_entry { + mid_callback_t *callback; /* call completion callback */ + mid_handle_t *handle; /* call handle mid callback */ + void *callback_data; /* general purpose pointer for callback */ ++ struct task_struct *creator; + void *resp_buf; /* pointer to received SMB header */ + unsigned int resp_buf_size; + int mid_state; /* wish this were enum but can not pass to wait_event */ +diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c +index 766974fe637a..14265b4bbcc0 100644 +--- a/fs/cifs/smb2misc.c ++++ b/fs/cifs/smb2misc.c +@@ -750,7 +750,7 @@ __smb2_handle_cancelled_close(struct cifs_tcon *tcon, __u64 persistent_fid, + { + struct close_cancelled_open *cancelled; + +- cancelled = kzalloc(sizeof(*cancelled), GFP_KERNEL); ++ cancelled = kzalloc(sizeof(*cancelled), GFP_ATOMIC); + if (!cancelled) + return -ENOMEM; + +diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c +index b5c1cba3e6a1..662256fa2a18 100644 +--- a/fs/cifs/smb2ops.c ++++ b/fs/cifs/smb2ops.c +@@ -1461,7 +1461,9 @@ smb2_ioctl_query_info(const unsigned int xid, + COMPOUND_FID, COMPOUND_FID, + qi.info_type, true, buffer, + qi.output_buffer_length, +- CIFSMaxBufSize); ++ CIFSMaxBufSize - ++ MAX_SMB2_CREATE_RESPONSE_SIZE - ++ MAX_SMB2_CLOSE_RESPONSE_SIZE); + } + } else if (qi.flags == PASSTHRU_SET_INFO) { + /* Can eventually relax perm check since server enforces too */ +@@ -2634,7 +2636,10 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, + + rc = SMB2_ioctl_init(tcon, &rqst[1], fid.persistent_fid, + fid.volatile_fid, FSCTL_GET_REPARSE_POINT, +- true /* is_fctl */, NULL, 0, CIFSMaxBufSize); ++ true /* is_fctl */, NULL, 0, ++ CIFSMaxBufSize - ++ MAX_SMB2_CREATE_RESPONSE_SIZE - ++ MAX_SMB2_CLOSE_RESPONSE_SIZE); + if (rc) + goto querty_exit; + +diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c +index 148d7942c796..805652969065 100644 +--- a/fs/cifs/smb2transport.c ++++ b/fs/cifs/smb2transport.c +@@ -599,6 +599,8 @@ smb2_mid_entry_alloc(const struct smb2_sync_hdr *shdr, + * The default is for the mid to be synchronous, so the + * default callback just wakes up the current task. + */ ++ get_task_struct(current); ++ temp->creator = current; + temp->callback = cifs_wake_up_task; + temp->callback_data = current; + +diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c +index 755434d5e4e7..e67a43fd037c 100644 +--- a/fs/cifs/transport.c ++++ b/fs/cifs/transport.c +@@ -76,6 +76,8 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server) + * The default is for the mid to be synchronous, so the + * default callback just wakes up the current task. + */ ++ get_task_struct(current); ++ temp->creator = current; + temp->callback = cifs_wake_up_task; + temp->callback_data = current; + +@@ -158,6 +160,7 @@ static void _cifs_mid_q_entry_release(struct kref *refcount) + } + } + #endif ++ put_task_struct(midEntry->creator); + + mempool_free(midEntry, cifs_mid_poolp); + } +diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c +index 87846aad594b..8fd45eb89424 100644 +--- a/fs/debugfs/file.c ++++ b/fs/debugfs/file.c +@@ -142,18 +142,21 @@ EXPORT_SYMBOL_GPL(debugfs_file_put); + * We also need to exclude any file that has ways to write or alter it as root + * can bypass the permissions check. + */ +-static bool debugfs_is_locked_down(struct inode *inode, +- struct file *filp, +- const struct file_operations *real_fops) ++static int debugfs_locked_down(struct inode *inode, ++ struct file *filp, ++ const struct file_operations *real_fops) + { + if ((inode->i_mode & 07777) == 0444 && + !(filp->f_mode & FMODE_WRITE) && + !real_fops->unlocked_ioctl && + !real_fops->compat_ioctl && + !real_fops->mmap) +- return false; ++ return 0; + +- return security_locked_down(LOCKDOWN_DEBUGFS); ++ if (security_locked_down(LOCKDOWN_DEBUGFS)) ++ return -EPERM; ++ ++ return 0; + } + + static int open_proxy_open(struct inode *inode, struct file *filp) +@@ -168,7 +171,7 @@ static int open_proxy_open(struct inode *inode, struct file *filp) + + real_fops = debugfs_real_fops(filp); + +- r = debugfs_is_locked_down(inode, filp, real_fops); ++ r = debugfs_locked_down(inode, filp, real_fops); + if (r) + goto out; + +@@ -298,7 +301,7 @@ static int full_proxy_open(struct inode *inode, struct file *filp) + + real_fops = debugfs_real_fops(filp); + +- r = debugfs_is_locked_down(inode, filp, real_fops); ++ r = debugfs_locked_down(inode, filp, real_fops); + if (r) + goto out; + +diff --git a/include/linux/platform_data/ti-sysc.h b/include/linux/platform_data/ti-sysc.h +index b5b7a3423ca8..8cfe570fdece 100644 +--- a/include/linux/platform_data/ti-sysc.h ++++ b/include/linux/platform_data/ti-sysc.h +@@ -49,6 +49,8 @@ struct sysc_regbits { + s8 emufree_shift; + }; + ++#define SYSC_QUIRK_FORCE_MSTANDBY BIT(20) ++#define SYSC_MODULE_QUIRK_AESS BIT(19) + #define SYSC_MODULE_QUIRK_SGX BIT(18) + #define SYSC_MODULE_QUIRK_HDQ1W BIT(17) + #define SYSC_MODULE_QUIRK_I2C BIT(16) +diff --git a/include/linux/power/smartreflex.h b/include/linux/power/smartreflex.h +index d0b37e937037..971c9264179e 100644 +--- a/include/linux/power/smartreflex.h ++++ b/include/linux/power/smartreflex.h +@@ -293,6 +293,9 @@ struct omap_sr_data { + struct voltagedomain *voltdm; + }; + ++ ++extern struct omap_sr_data omap_sr_pdata[OMAP_SR_NR]; ++ + #ifdef CONFIG_POWER_AVS_OMAP + + /* Smartreflex module enable/disable interface */ +diff --git a/include/linux/usb/irda.h b/include/linux/usb/irda.h +index 396d2b043e64..556a801efce3 100644 +--- a/include/linux/usb/irda.h ++++ b/include/linux/usb/irda.h +@@ -119,11 +119,22 @@ struct usb_irda_cs_descriptor { + * 6 - 115200 bps + * 7 - 576000 bps + * 8 - 1.152 Mbps +- * 9 - 5 mbps ++ * 9 - 4 Mbps + * 10..15 - Reserved + */ + #define USB_IRDA_STATUS_LINK_SPEED 0x0f + ++#define USB_IRDA_LS_NO_CHANGE 0 ++#define USB_IRDA_LS_2400 1 ++#define USB_IRDA_LS_9600 2 ++#define USB_IRDA_LS_19200 3 ++#define USB_IRDA_LS_38400 4 ++#define USB_IRDA_LS_57600 5 ++#define USB_IRDA_LS_115200 6 ++#define USB_IRDA_LS_576000 7 ++#define USB_IRDA_LS_1152000 8 ++#define USB_IRDA_LS_4000000 9 ++ + /* The following is a 4-bit value used only for + * outbound header: + * +diff --git a/include/media/dvb-usb-ids.h b/include/media/dvb-usb-ids.h +index 7ce4e8332421..1409230ad3a4 100644 +--- a/include/media/dvb-usb-ids.h ++++ b/include/media/dvb-usb-ids.h +@@ -389,6 +389,7 @@ + #define USB_PID_MYGICA_T230 0xc688 + #define USB_PID_MYGICA_T230C 0xc689 + #define USB_PID_MYGICA_T230C2 0xc68a ++#define USB_PID_MYGICA_T230C_LITE 0xc699 + #define USB_PID_ELGATO_EYETV_DIVERSITY 0x0011 + #define USB_PID_ELGATO_EYETV_DTT 0x0021 + #define USB_PID_ELGATO_EYETV_DTT_2 0x003f +diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h +index e553fc80eb23..9976ad2f54fd 100644 +--- a/include/net/pkt_cls.h ++++ b/include/net/pkt_cls.h +@@ -141,31 +141,38 @@ __cls_set_class(unsigned long *clp, unsigned long cl) + return xchg(clp, cl); + } + +-static inline unsigned long +-cls_set_class(struct Qdisc *q, unsigned long *clp, unsigned long cl) ++static inline void ++__tcf_bind_filter(struct Qdisc *q, struct tcf_result *r, unsigned long base) + { +- unsigned long old_cl; ++ unsigned long cl; + +- sch_tree_lock(q); +- old_cl = __cls_set_class(clp, cl); +- sch_tree_unlock(q); +- return old_cl; ++ cl = q->ops->cl_ops->bind_tcf(q, base, r->classid); ++ cl = __cls_set_class(&r->class, cl); ++ if (cl) ++ q->ops->cl_ops->unbind_tcf(q, cl); + } + + static inline void + tcf_bind_filter(struct tcf_proto *tp, struct tcf_result *r, unsigned long base) + { + struct Qdisc *q = tp->chain->block->q; +- unsigned long cl; + + /* Check q as it is not set for shared blocks. In that case, + * setting class is not supported. + */ + if (!q) + return; +- cl = q->ops->cl_ops->bind_tcf(q, base, r->classid); +- cl = cls_set_class(q, &r->class, cl); +- if (cl) ++ sch_tree_lock(q); ++ __tcf_bind_filter(q, r, base); ++ sch_tree_unlock(q); ++} ++ ++static inline void ++__tcf_unbind_filter(struct Qdisc *q, struct tcf_result *r) ++{ ++ unsigned long cl; ++ ++ if ((cl = __cls_set_class(&r->class, 0)) != 0) + q->ops->cl_ops->unbind_tcf(q, cl); + } + +@@ -173,12 +180,10 @@ static inline void + tcf_unbind_filter(struct tcf_proto *tp, struct tcf_result *r) + { + struct Qdisc *q = tp->chain->block->q; +- unsigned long cl; + + if (!q) + return; +- if ((cl = __cls_set_class(&r->class, 0)) != 0) +- q->ops->cl_ops->unbind_tcf(q, cl); ++ __tcf_unbind_filter(q, r); + } + + struct tcf_exts { +diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h +index 32e418dba133..d334e4609dd4 100644 +--- a/include/net/sch_generic.h ++++ b/include/net/sch_generic.h +@@ -318,7 +318,8 @@ struct tcf_proto_ops { + void *type_data); + void (*hw_del)(struct tcf_proto *tp, + void *type_data); +- void (*bind_class)(void *, u32, unsigned long); ++ void (*bind_class)(void *, u32, unsigned long, ++ void *, unsigned long); + void * (*tmplt_create)(struct net *net, + struct tcf_chain *chain, + struct nlattr **tca, +diff --git a/include/net/udp.h b/include/net/udp.h +index bad74f780831..8f163d674f07 100644 +--- a/include/net/udp.h ++++ b/include/net/udp.h +@@ -476,6 +476,9 @@ static inline struct sk_buff *udp_rcv_segment(struct sock *sk, + if (!inet_get_convert_csum(sk)) + features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; + ++ if (skb->pkt_type == PACKET_LOOPBACK) ++ skb->ip_summed = CHECKSUM_PARTIAL; ++ + /* the GSO CB lays after the UDP one, no need to save and restore any + * CB fragment + */ +diff --git a/init/Kconfig b/init/Kconfig +index b4daad2bac23..0328b53d09ad 100644 +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -54,6 +54,7 @@ config CC_DISABLE_WARN_MAYBE_UNINITIALIZED + + config CONSTRUCTORS + bool ++ depends on !UML + + config IRQ_WORK + bool +diff --git a/kernel/gcov/Kconfig b/kernel/gcov/Kconfig +index 060e8e726755..3941a9c48f83 100644 +--- a/kernel/gcov/Kconfig ++++ b/kernel/gcov/Kconfig +@@ -4,7 +4,7 @@ menu "GCOV-based kernel profiling" + config GCOV_KERNEL + bool "Enable gcov-based kernel profiling" + depends on DEBUG_FS +- select CONSTRUCTORS ++ select CONSTRUCTORS if !UML + default n + ---help--- + This option enables gcov-based code profiling (e.g. for code coverage +diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c +index 0cc9ce917222..9e19d5a3aac8 100644 +--- a/net/bluetooth/hci_core.c ++++ b/net/bluetooth/hci_core.c +@@ -1444,11 +1444,20 @@ static int hci_dev_do_open(struct hci_dev *hdev) + + if (hci_dev_test_flag(hdev, HCI_SETUP) || + test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks)) { ++ bool invalid_bdaddr; ++ + hci_sock_dev_event(hdev, HCI_DEV_SETUP); + + if (hdev->setup) + ret = hdev->setup(hdev); + ++ /* The transport driver can set the quirk to mark the ++ * BD_ADDR invalid before creating the HCI device or in ++ * its setup callback. ++ */ ++ invalid_bdaddr = test_bit(HCI_QUIRK_INVALID_BDADDR, ++ &hdev->quirks); ++ + if (ret) + goto setup_failed; + +@@ -1457,20 +1466,33 @@ static int hci_dev_do_open(struct hci_dev *hdev) + hci_dev_get_bd_addr_from_property(hdev); + + if (bacmp(&hdev->public_addr, BDADDR_ANY) && +- hdev->set_bdaddr) ++ hdev->set_bdaddr) { + ret = hdev->set_bdaddr(hdev, + &hdev->public_addr); ++ ++ /* If setting of the BD_ADDR from the device ++ * property succeeds, then treat the address ++ * as valid even if the invalid BD_ADDR ++ * quirk indicates otherwise. ++ */ ++ if (!ret) ++ invalid_bdaddr = false; ++ } + } + + setup_failed: + /* The transport driver can set these quirks before + * creating the HCI device or in its setup callback. + * ++ * For the invalid BD_ADDR quirk it is possible that ++ * it becomes a valid address if the bootloader does ++ * provide it (see above). ++ * + * In case any of them is set, the controller has to + * start up as unconfigured. + */ + if (test_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks) || +- test_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks)) ++ invalid_bdaddr) + hci_dev_set_flag(hdev, HCI_UNCONFIGURED); + + /* For an unconfigured controller it is required to +diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c +index fc34fd1668d6..3737d32ad11a 100644 +--- a/net/ipv4/nexthop.c ++++ b/net/ipv4/nexthop.c +@@ -322,7 +322,9 @@ static size_t nh_nlmsg_size_single(struct nexthop *nh) + + static size_t nh_nlmsg_size(struct nexthop *nh) + { +- size_t sz = nla_total_size(4); /* NHA_ID */ ++ size_t sz = NLMSG_ALIGN(sizeof(struct nhmsg)); ++ ++ sz += nla_total_size(4); /* NHA_ID */ + + if (nh->is_group) + sz += nh_nlmsg_size_grp(nh); +diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c +index 86bd133b4fa0..96d54e5bf7bc 100644 +--- a/net/rxrpc/input.c ++++ b/net/rxrpc/input.c +@@ -413,7 +413,7 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb) + { + struct rxrpc_skb_priv *sp = rxrpc_skb(skb); + enum rxrpc_call_state state; +- unsigned int j; ++ unsigned int j, nr_subpackets; + rxrpc_serial_t serial = sp->hdr.serial, ack_serial = 0; + rxrpc_seq_t seq0 = sp->hdr.seq, hard_ack; + bool immediate_ack = false, jumbo_bad = false; +@@ -457,7 +457,8 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb) + call->ackr_prev_seq = seq0; + hard_ack = READ_ONCE(call->rx_hard_ack); + +- if (sp->nr_subpackets > 1) { ++ nr_subpackets = sp->nr_subpackets; ++ if (nr_subpackets > 1) { + if (call->nr_jumbo_bad > 3) { + ack = RXRPC_ACK_NOSPACE; + ack_serial = serial; +@@ -465,11 +466,11 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb) + } + } + +- for (j = 0; j < sp->nr_subpackets; j++) { ++ for (j = 0; j < nr_subpackets; j++) { + rxrpc_serial_t serial = sp->hdr.serial + j; + rxrpc_seq_t seq = seq0 + j; + unsigned int ix = seq & RXRPC_RXTX_BUFF_MASK; +- bool terminal = (j == sp->nr_subpackets - 1); ++ bool terminal = (j == nr_subpackets - 1); + bool last = terminal && (sp->rx_flags & RXRPC_SKB_INCL_LAST); + u8 flags, annotation = j; + +@@ -506,7 +507,7 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb) + } + + if (call->rxtx_buffer[ix]) { +- rxrpc_input_dup_data(call, seq, sp->nr_subpackets > 1, ++ rxrpc_input_dup_data(call, seq, nr_subpackets > 1, + &jumbo_bad); + if (ack != RXRPC_ACK_DUPLICATE) { + ack = RXRPC_ACK_DUPLICATE; +@@ -564,6 +565,7 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb) + * ring. + */ + skb = NULL; ++ sp = NULL; + } + + if (last) { +diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c +index 4aafbe3d435c..f256a7c69093 100644 +--- a/net/sched/cls_basic.c ++++ b/net/sched/cls_basic.c +@@ -263,12 +263,17 @@ skip: + } + } + +-static void basic_bind_class(void *fh, u32 classid, unsigned long cl) ++static void basic_bind_class(void *fh, u32 classid, unsigned long cl, void *q, ++ unsigned long base) + { + struct basic_filter *f = fh; + +- if (f && f->res.classid == classid) +- f->res.class = cl; ++ if (f && f->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &f->res, base); ++ else ++ __tcf_unbind_filter(q, &f->res); ++ } + } + + static int basic_dump(struct net *net, struct tcf_proto *tp, void *fh, +diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c +index 8229ed4a67be..6e3e63db0e01 100644 +--- a/net/sched/cls_bpf.c ++++ b/net/sched/cls_bpf.c +@@ -631,12 +631,17 @@ nla_put_failure: + return -1; + } + +-static void cls_bpf_bind_class(void *fh, u32 classid, unsigned long cl) ++static void cls_bpf_bind_class(void *fh, u32 classid, unsigned long cl, ++ void *q, unsigned long base) + { + struct cls_bpf_prog *prog = fh; + +- if (prog && prog->res.classid == classid) +- prog->res.class = cl; ++ if (prog && prog->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &prog->res, base); ++ else ++ __tcf_unbind_filter(q, &prog->res); ++ } + } + + static void cls_bpf_walk(struct tcf_proto *tp, struct tcf_walker *arg, +diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c +index 5cf8163710c8..7394e01c0c9c 100644 +--- a/net/sched/cls_flower.c ++++ b/net/sched/cls_flower.c +@@ -2511,12 +2511,17 @@ nla_put_failure: + return -EMSGSIZE; + } + +-static void fl_bind_class(void *fh, u32 classid, unsigned long cl) ++static void fl_bind_class(void *fh, u32 classid, unsigned long cl, void *q, ++ unsigned long base) + { + struct cls_fl_filter *f = fh; + +- if (f && f->res.classid == classid) +- f->res.class = cl; ++ if (f && f->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &f->res, base); ++ else ++ __tcf_unbind_filter(q, &f->res); ++ } + } + + static bool fl_delete_empty(struct tcf_proto *tp) +diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c +index c9496c920d6f..ec945294626a 100644 +--- a/net/sched/cls_fw.c ++++ b/net/sched/cls_fw.c +@@ -419,12 +419,17 @@ nla_put_failure: + return -1; + } + +-static void fw_bind_class(void *fh, u32 classid, unsigned long cl) ++static void fw_bind_class(void *fh, u32 classid, unsigned long cl, void *q, ++ unsigned long base) + { + struct fw_filter *f = fh; + +- if (f && f->res.classid == classid) +- f->res.class = cl; ++ if (f && f->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &f->res, base); ++ else ++ __tcf_unbind_filter(q, &f->res); ++ } + } + + static struct tcf_proto_ops cls_fw_ops __read_mostly = { +diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c +index 7fc2eb62aa98..039cc86974f4 100644 +--- a/net/sched/cls_matchall.c ++++ b/net/sched/cls_matchall.c +@@ -393,12 +393,17 @@ nla_put_failure: + return -1; + } + +-static void mall_bind_class(void *fh, u32 classid, unsigned long cl) ++static void mall_bind_class(void *fh, u32 classid, unsigned long cl, void *q, ++ unsigned long base) + { + struct cls_mall_head *head = fh; + +- if (head && head->res.classid == classid) +- head->res.class = cl; ++ if (head && head->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &head->res, base); ++ else ++ __tcf_unbind_filter(q, &head->res); ++ } + } + + static struct tcf_proto_ops cls_mall_ops __read_mostly = { +diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c +index 2d9e0b4484ea..6f8786b06bde 100644 +--- a/net/sched/cls_route.c ++++ b/net/sched/cls_route.c +@@ -641,12 +641,17 @@ nla_put_failure: + return -1; + } + +-static void route4_bind_class(void *fh, u32 classid, unsigned long cl) ++static void route4_bind_class(void *fh, u32 classid, unsigned long cl, void *q, ++ unsigned long base) + { + struct route4_filter *f = fh; + +- if (f && f->res.classid == classid) +- f->res.class = cl; ++ if (f && f->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &f->res, base); ++ else ++ __tcf_unbind_filter(q, &f->res); ++ } + } + + static struct tcf_proto_ops cls_route4_ops __read_mostly = { +diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h +index 2f3c03b25d5d..c22624131949 100644 +--- a/net/sched/cls_rsvp.h ++++ b/net/sched/cls_rsvp.h +@@ -738,12 +738,17 @@ nla_put_failure: + return -1; + } + +-static void rsvp_bind_class(void *fh, u32 classid, unsigned long cl) ++static void rsvp_bind_class(void *fh, u32 classid, unsigned long cl, void *q, ++ unsigned long base) + { + struct rsvp_filter *f = fh; + +- if (f && f->res.classid == classid) +- f->res.class = cl; ++ if (f && f->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &f->res, base); ++ else ++ __tcf_unbind_filter(q, &f->res); ++ } + } + + static struct tcf_proto_ops RSVP_OPS __read_mostly = { +diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c +index e573e5a5c794..3d4a1280352f 100644 +--- a/net/sched/cls_tcindex.c ++++ b/net/sched/cls_tcindex.c +@@ -654,12 +654,17 @@ nla_put_failure: + return -1; + } + +-static void tcindex_bind_class(void *fh, u32 classid, unsigned long cl) ++static void tcindex_bind_class(void *fh, u32 classid, unsigned long cl, ++ void *q, unsigned long base) + { + struct tcindex_filter_result *r = fh; + +- if (r && r->res.classid == classid) +- r->res.class = cl; ++ if (r && r->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &r->res, base); ++ else ++ __tcf_unbind_filter(q, &r->res); ++ } + } + + static struct tcf_proto_ops cls_tcindex_ops __read_mostly = { +diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c +index a0e6fac613de..e15ff335953d 100644 +--- a/net/sched/cls_u32.c ++++ b/net/sched/cls_u32.c +@@ -1255,12 +1255,17 @@ static int u32_reoffload(struct tcf_proto *tp, bool add, flow_setup_cb_t *cb, + return 0; + } + +-static void u32_bind_class(void *fh, u32 classid, unsigned long cl) ++static void u32_bind_class(void *fh, u32 classid, unsigned long cl, void *q, ++ unsigned long base) + { + struct tc_u_knode *n = fh; + +- if (n && n->res.classid == classid) +- n->res.class = cl; ++ if (n && n->res.classid == classid) { ++ if (cl) ++ __tcf_bind_filter(q, &n->res, base); ++ else ++ __tcf_unbind_filter(q, &n->res); ++ } + } + + static int u32_dump(struct net *net, struct tcf_proto *tp, void *fh, +diff --git a/net/sched/ematch.c b/net/sched/ematch.c +index d0140a92694a..dd3b8c11a2e0 100644 +--- a/net/sched/ematch.c ++++ b/net/sched/ematch.c +@@ -238,6 +238,9 @@ static int tcf_em_validate(struct tcf_proto *tp, + goto errout; + + if (em->ops->change) { ++ err = -EINVAL; ++ if (em_hdr->flags & TCF_EM_SIMPLE) ++ goto errout; + err = em->ops->change(net, data, data_len, em); + if (err < 0) + goto errout; +diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c +index 1047825d9f48..50794125bf02 100644 +--- a/net/sched/sch_api.c ++++ b/net/sched/sch_api.c +@@ -1891,8 +1891,9 @@ static int tclass_del_notify(struct net *net, + + struct tcf_bind_args { + struct tcf_walker w; +- u32 classid; ++ unsigned long base; + unsigned long cl; ++ u32 classid; + }; + + static int tcf_node_bind(struct tcf_proto *tp, void *n, struct tcf_walker *arg) +@@ -1903,28 +1904,30 @@ static int tcf_node_bind(struct tcf_proto *tp, void *n, struct tcf_walker *arg) + struct Qdisc *q = tcf_block_q(tp->chain->block); + + sch_tree_lock(q); +- tp->ops->bind_class(n, a->classid, a->cl); ++ tp->ops->bind_class(n, a->classid, a->cl, q, a->base); + sch_tree_unlock(q); + } + return 0; + } + +-static void tc_bind_tclass(struct Qdisc *q, u32 portid, u32 clid, +- unsigned long new_cl) ++struct tc_bind_class_args { ++ struct qdisc_walker w; ++ unsigned long new_cl; ++ u32 portid; ++ u32 clid; ++}; ++ ++static int tc_bind_class_walker(struct Qdisc *q, unsigned long cl, ++ struct qdisc_walker *w) + { ++ struct tc_bind_class_args *a = (struct tc_bind_class_args *)w; + const struct Qdisc_class_ops *cops = q->ops->cl_ops; + struct tcf_block *block; + struct tcf_chain *chain; +- unsigned long cl; + +- cl = cops->find(q, portid); +- if (!cl) +- return; +- if (!cops->tcf_block) +- return; + block = cops->tcf_block(q, cl, NULL); + if (!block) +- return; ++ return 0; + for (chain = tcf_get_next_chain(block, NULL); + chain; + chain = tcf_get_next_chain(block, chain)) { +@@ -1935,11 +1938,29 @@ static void tc_bind_tclass(struct Qdisc *q, u32 portid, u32 clid, + struct tcf_bind_args arg = {}; + + arg.w.fn = tcf_node_bind; +- arg.classid = clid; +- arg.cl = new_cl; ++ arg.classid = a->clid; ++ arg.base = cl; ++ arg.cl = a->new_cl; + tp->ops->walk(tp, &arg.w, true); + } + } ++ ++ return 0; ++} ++ ++static void tc_bind_tclass(struct Qdisc *q, u32 portid, u32 clid, ++ unsigned long new_cl) ++{ ++ const struct Qdisc_class_ops *cops = q->ops->cl_ops; ++ struct tc_bind_class_args args = {}; ++ ++ if (!cops->tcf_block) ++ return; ++ args.portid = portid; ++ args.clid = clid; ++ args.new_cl = new_cl; ++ args.w.fn = tc_bind_class_walker; ++ q->ops->cl_ops->walk(q, &args.w); + } + + #else +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index d293488dc3dd..68832f52c1ad 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -7563,20 +7563,6 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { + {0x19, 0x02a11020}, + {0x1a, 0x02a11030}, + {0x21, 0x0221101f}), +- SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, +- {0x12, 0x90a60140}, +- {0x14, 0x90170110}, +- {0x21, 0x02211020}), +- SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, +- {0x12, 0x90a60140}, +- {0x14, 0x90170150}, +- {0x21, 0x02211020}), +- SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, +- {0x21, 0x02211020}), +- SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, +- {0x12, 0x40000000}, +- {0x14, 0x90170110}, +- {0x21, 0x02211020}), + SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, + {0x14, 0x90170110}, + {0x21, 0x02211020}), +@@ -7901,6 +7887,9 @@ static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = { + SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, + {0x19, 0x40000000}, + {0x1a, 0x40000000}), ++ SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, ++ {0x19, 0x40000000}, ++ {0x1a, 0x40000000}), + {} + }; + +diff --git a/sound/soc/fsl/fsl_audmix.c b/sound/soc/fsl/fsl_audmix.c +index a1db1bce330f..5faecbeb5497 100644 +--- a/sound/soc/fsl/fsl_audmix.c ++++ b/sound/soc/fsl/fsl_audmix.c +@@ -505,15 +505,20 @@ static int fsl_audmix_probe(struct platform_device *pdev) + ARRAY_SIZE(fsl_audmix_dai)); + if (ret) { + dev_err(dev, "failed to register ASoC DAI\n"); +- return ret; ++ goto err_disable_pm; + } + + priv->pdev = platform_device_register_data(dev, mdrv, 0, NULL, 0); + if (IS_ERR(priv->pdev)) { + ret = PTR_ERR(priv->pdev); + dev_err(dev, "failed to register platform %s: %d\n", mdrv, ret); ++ goto err_disable_pm; + } + ++ return 0; ++ ++err_disable_pm: ++ pm_runtime_disable(dev); + return ret; + } + +@@ -521,6 +526,8 @@ static int fsl_audmix_remove(struct platform_device *pdev) + { + struct fsl_audmix *priv = dev_get_drvdata(&pdev->dev); + ++ pm_runtime_disable(&pdev->dev); ++ + if (priv->pdev) + platform_device_unregister(priv->pdev); + +diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c +index 8879c3be29d5..c68a5b85a4a0 100644 +--- a/sound/soc/intel/boards/cht_bsw_rt5645.c ++++ b/sound/soc/intel/boards/cht_bsw_rt5645.c +@@ -48,6 +48,7 @@ struct cht_mc_private { + #define CHT_RT5645_SSP2_AIF2 BIT(16) /* default is using AIF1 */ + #define CHT_RT5645_SSP0_AIF1 BIT(17) + #define CHT_RT5645_SSP0_AIF2 BIT(18) ++#define CHT_RT5645_PMC_PLT_CLK_0 BIT(19) + + static unsigned long cht_rt5645_quirk = 0; + +@@ -59,6 +60,8 @@ static void log_quirks(struct device *dev) + dev_info(dev, "quirk SSP0_AIF1 enabled"); + if (cht_rt5645_quirk & CHT_RT5645_SSP0_AIF2) + dev_info(dev, "quirk SSP0_AIF2 enabled"); ++ if (cht_rt5645_quirk & CHT_RT5645_PMC_PLT_CLK_0) ++ dev_info(dev, "quirk PMC_PLT_CLK_0 enabled"); + } + + static int platform_clock_control(struct snd_soc_dapm_widget *w, +@@ -226,15 +229,21 @@ static int cht_aif1_hw_params(struct snd_pcm_substream *substream, + return 0; + } + +-/* uncomment when we have a real quirk + static int cht_rt5645_quirk_cb(const struct dmi_system_id *id) + { + cht_rt5645_quirk = (unsigned long)id->driver_data; + return 1; + } +-*/ + + static const struct dmi_system_id cht_rt5645_quirk_table[] = { ++ { ++ /* Strago family Chromebooks */ ++ .callback = cht_rt5645_quirk_cb, ++ .matches = { ++ DMI_MATCH(DMI_PRODUCT_FAMILY, "Intel_Strago"), ++ }, ++ .driver_data = (void *)CHT_RT5645_PMC_PLT_CLK_0, ++ }, + { + }, + }; +@@ -526,6 +535,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev) + int dai_index = 0; + int ret_val = 0; + int i; ++ const char *mclk_name; + + drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); + if (!drv) +@@ -662,11 +672,15 @@ static int snd_cht_mc_probe(struct platform_device *pdev) + if (ret_val) + return ret_val; + +- drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3"); ++ if (cht_rt5645_quirk & CHT_RT5645_PMC_PLT_CLK_0) ++ mclk_name = "pmc_plt_clk_0"; ++ else ++ mclk_name = "pmc_plt_clk_3"; ++ ++ drv->mclk = devm_clk_get(&pdev->dev, mclk_name); + if (IS_ERR(drv->mclk)) { +- dev_err(&pdev->dev, +- "Failed to get MCLK from pmc_plt_clk_3: %ld\n", +- PTR_ERR(drv->mclk)); ++ dev_err(&pdev->dev, "Failed to get MCLK from %s: %ld\n", ++ mclk_name, PTR_ERR(drv->mclk)); + return PTR_ERR(drv->mclk); + } + +diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c +index fd2d22ddc81b..7ccbca47240d 100644 +--- a/sound/soc/soc-topology.c ++++ b/sound/soc/soc-topology.c +@@ -548,12 +548,12 @@ static void remove_link(struct snd_soc_component *comp, + if (dobj->ops && dobj->ops->link_unload) + dobj->ops->link_unload(comp, dobj); + ++ list_del(&dobj->list); ++ snd_soc_remove_dai_link(comp->card, link); ++ + kfree(link->name); + kfree(link->stream_name); + kfree(link->cpus->dai_name); +- +- list_del(&dobj->list); +- snd_soc_remove_dai_link(comp->card, link); + kfree(link); + } + +diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c +index 8796f385be76..896d21984b73 100644 +--- a/sound/soc/sof/intel/hda-dai.c ++++ b/sound/soc/sof/intel/hda-dai.c +@@ -216,6 +216,8 @@ static int hda_link_hw_params(struct snd_pcm_substream *substream, + link_dev = hda_link_stream_assign(bus, substream); + if (!link_dev) + return -EBUSY; ++ ++ snd_soc_dai_set_dma_data(dai, substream, (void *)link_dev); + } + + stream_tag = hdac_stream(link_dev)->stream_tag; +@@ -228,8 +230,6 @@ static int hda_link_hw_params(struct snd_pcm_substream *substream, + if (ret < 0) + return ret; + +- snd_soc_dai_set_dma_data(dai, substream, (void *)link_dev); +- + link = snd_hdac_ext_bus_get_link(bus, codec_dai->component->name); + if (!link) + return -EINVAL; +@@ -361,6 +361,13 @@ static int hda_link_hw_free(struct snd_pcm_substream *substream, + bus = hstream->bus; + rtd = snd_pcm_substream_chip(substream); + link_dev = snd_soc_dai_get_dma_data(dai, substream); ++ ++ if (!link_dev) { ++ dev_dbg(dai->dev, ++ "%s: link_dev is not assigned\n", __func__); ++ return -EINVAL; ++ } ++ + hda_stream = hstream_to_sof_hda_stream(link_dev); + + /* free the link DMA channel in the FW */ +diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c +index 086eeeab8679..7b6d69783e16 100644 +--- a/sound/soc/sof/ipc.c ++++ b/sound/soc/sof/ipc.c +@@ -834,6 +834,9 @@ void snd_sof_ipc_free(struct snd_sof_dev *sdev) + { + struct snd_sof_ipc *ipc = sdev->ipc; + ++ if (!ipc) ++ return; ++ + /* disable sending of ipc's */ + mutex_lock(&ipc->tx_mutex); + ipc->disable_ipc_tx = true; +diff --git a/tools/testing/selftests/bpf/bpf_helpers.h b/tools/testing/selftests/bpf/bpf_helpers.h +index 54a50699bbfd..9f77cbaac01c 100644 +--- a/tools/testing/selftests/bpf/bpf_helpers.h ++++ b/tools/testing/selftests/bpf/bpf_helpers.h +@@ -3,7 +3,7 @@ + #define __BPF_HELPERS__ + + #define __uint(name, val) int (*name)[val] +-#define __type(name, val) val *name ++#define __type(name, val) typeof(val) *name + + /* helper macro to print out debug messages */ + #define bpf_printk(fmt, ...) \ +diff --git a/tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c b/tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c +index f8ffa3f3d44b..6cc4479ac9df 100644 +--- a/tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c ++++ b/tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c +@@ -47,12 +47,11 @@ struct { + * issue and avoid complicated C programming massaging. + * This is an acceptable workaround since there is one entry here. + */ +-typedef __u64 raw_stack_trace_t[2 * MAX_STACK_RAWTP]; + struct { + __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); + __uint(max_entries, 1); + __type(key, __u32); +- __type(value, raw_stack_trace_t); ++ __type(value, __u64[2 * MAX_STACK_RAWTP]); + } rawdata_map SEC(".maps"); + + SEC("raw_tracepoint/sys_enter") diff --git a/patch/kernel/odroidxu4-current/dvfs-fixes.patch b/patch/kernel/odroidxu4-current/dvfs-fixes.patch new file mode 100644 index 000000000..56365e7be --- /dev/null +++ b/patch/kernel/odroidxu4-current/dvfs-fixes.patch @@ -0,0 +1,269 @@ +diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c +index 37bd34d56..8fa8eb541 100644 +--- a/drivers/devfreq/exynos-bus.c ++++ b/drivers/devfreq/exynos-bus.c +@@ -15,11 +15,10 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +-#include + + #define DEFAULT_SATURATION_RATIO 40 + +@@ -127,6 +126,7 @@ static int exynos_bus_get_dev_status(struct device *dev, + + ret = exynos_bus_get_event(bus, &edata); + if (ret < 0) { ++ dev_err(dev, "failed to get event from devfreq-event devices\n"); + stat->total_time = stat->busy_time = 0; + goto err; + } +@@ -243,7 +243,7 @@ static int exynos_bus_parse_of(struct device_node *np, + { + struct device *dev = bus->dev; + struct dev_pm_opp *opp; +- unsigned long rate, opp_rate; ++ unsigned long rate; + int ret; + + /* Get the clock to provide each bus with source clock */ +@@ -267,21 +267,13 @@ static int exynos_bus_parse_of(struct device_node *np, + } + + rate = clk_get_rate(bus->clk); +- opp_rate = rate; +- opp = devfreq_recommended_opp(dev, &opp_rate, 0); ++ ++ opp = devfreq_recommended_opp(dev, &rate, 0); + if (IS_ERR(opp)) { + dev_err(dev, "failed to find dev_pm_opp\n"); + ret = PTR_ERR(opp); + goto err_opp; + } +- /* +- * FIXME: U-boot leaves clock source at incorrect PLL, this results +- * in clock rate outside defined OPP rate. Work around this bug by +- * setting clock rate to recommended one. +- */ +- if (rate > opp_rate) +- clk_set_rate(bus->clk, opp_rate); +- + bus->curr_freq = dev_pm_opp_get_freq(opp); + dev_pm_opp_put(opp); + +@@ -295,52 +287,12 @@ static int exynos_bus_parse_of(struct device_node *np, + return ret; + } + +-static int exynos_bus_probe(struct platform_device *pdev) ++static int exynos_bus_profile_init(struct exynos_bus *bus, ++ struct devfreq_dev_profile *profile) + { +- struct device *dev = &pdev->dev; +- struct device_node *np = dev->of_node, *node; +- struct devfreq_dev_profile *profile; ++ struct device *dev = bus->dev; + struct devfreq_simple_ondemand_data *ondemand_data; +- struct devfreq_passive_data *passive_data; +- struct devfreq *parent_devfreq; +- struct exynos_bus *bus; +- int ret, max_state; +- unsigned long min_freq, max_freq; +- bool passive = false; +- +- if (!np) { +- dev_err(dev, "failed to find devicetree node\n"); +- return -EINVAL; +- } +- +- bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); +- if (!bus) +- return -ENOMEM; +- mutex_init(&bus->lock); +- bus->dev = &pdev->dev; +- platform_set_drvdata(pdev, bus); +- +- profile = devm_kzalloc(dev, sizeof(*profile), GFP_KERNEL); +- if (!profile) +- return -ENOMEM; +- +- node = of_parse_phandle(dev->of_node, "devfreq", 0); +- if (node) { +- of_node_put(node); +- passive = true; +- } else { +- ret = exynos_bus_parent_parse_of(np, bus); +- if (ret < 0) +- return ret; +- } +- +- /* Parse the device-tree to get the resource information */ +- ret = exynos_bus_parse_of(np, bus); +- if (ret < 0) +- goto err_reg; +- +- if (passive) +- goto passive; ++ int ret; + + /* Initialize the struct profile and governor data for parent device */ + profile->polling_ms = 50; +@@ -349,10 +301,9 @@ static int exynos_bus_probe(struct platform_device *pdev) + profile->exit = exynos_bus_exit; + + ondemand_data = devm_kzalloc(dev, sizeof(*ondemand_data), GFP_KERNEL); +- if (!ondemand_data) { +- ret = -ENOMEM; +- goto err; +- } ++ if (!ondemand_data) ++ return -ENOMEM; ++ + ondemand_data->upthreshold = 40; + ondemand_data->downdifferential = 5; + +@@ -362,15 +313,14 @@ static int exynos_bus_probe(struct platform_device *pdev) + ondemand_data); + if (IS_ERR(bus->devfreq)) { + dev_err(dev, "failed to add devfreq device\n"); +- ret = PTR_ERR(bus->devfreq); +- goto err; ++ return PTR_ERR(bus->devfreq); + } + + /* Register opp_notifier to catch the change of OPP */ + ret = devm_devfreq_register_opp_notifier(dev, bus->devfreq); + if (ret < 0) { + dev_err(dev, "failed to register opp notifier\n"); +- goto err; ++ return ret; + } + + /* +@@ -380,33 +330,44 @@ static int exynos_bus_probe(struct platform_device *pdev) + ret = exynos_bus_enable_edev(bus); + if (ret < 0) { + dev_err(dev, "failed to enable devfreq-event devices\n"); +- goto err; ++ return ret; + } + + ret = exynos_bus_set_event(bus); + if (ret < 0) { + dev_err(dev, "failed to set event to devfreq-event devices\n"); +- goto err; ++ goto err_edev; + } + +- goto out; +-passive: ++ return 0; ++ ++err_edev: ++ if (exynos_bus_disable_edev(bus)) ++ dev_warn(dev, "failed to disable the devfreq-event devices\n"); ++ ++ return ret; ++} ++ ++static int exynos_bus_profile_init_passive(struct exynos_bus *bus, ++ struct devfreq_dev_profile *profile) ++{ ++ struct device *dev = bus->dev; ++ struct devfreq_passive_data *passive_data; ++ struct devfreq *parent_devfreq; ++ + /* Initialize the struct profile and governor data for passive device */ + profile->target = exynos_bus_target; + profile->exit = exynos_bus_passive_exit; + + /* Get the instance of parent devfreq device */ + parent_devfreq = devfreq_get_devfreq_by_phandle(dev, 0); +- if (IS_ERR(parent_devfreq)) { +- ret = -EPROBE_DEFER; +- goto err; +- } ++ if (IS_ERR(parent_devfreq)) ++ return -EPROBE_DEFER; + + passive_data = devm_kzalloc(dev, sizeof(*passive_data), GFP_KERNEL); +- if (!passive_data) { +- ret = -ENOMEM; +- goto err; +- } ++ if (!passive_data) ++ return -ENOMEM; ++ + passive_data->parent = parent_devfreq; + + /* Add devfreq device for exynos bus with passive governor */ +@@ -415,11 +376,61 @@ static int exynos_bus_probe(struct platform_device *pdev) + if (IS_ERR(bus->devfreq)) { + dev_err(dev, + "failed to add devfreq dev with passive governor\n"); +- ret = PTR_ERR(bus->devfreq); +- goto err; ++ return PTR_ERR(bus->devfreq); ++ } ++ ++ return 0; ++} ++ ++static int exynos_bus_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *np = dev->of_node, *node; ++ struct devfreq_dev_profile *profile; ++ struct exynos_bus *bus; ++ int ret, max_state; ++ unsigned long min_freq, max_freq; ++ bool passive = false; ++ ++ if (!np) { ++ dev_err(dev, "failed to find devicetree node\n"); ++ return -EINVAL; ++ } ++ ++ bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); ++ if (!bus) ++ return -ENOMEM; ++ mutex_init(&bus->lock); ++ bus->dev = &pdev->dev; ++ platform_set_drvdata(pdev, bus); ++ ++ profile = devm_kzalloc(dev, sizeof(*profile), GFP_KERNEL); ++ if (!profile) ++ return -ENOMEM; ++ ++ node = of_parse_phandle(dev->of_node, "devfreq", 0); ++ if (node) { ++ of_node_put(node); ++ passive = true; ++ } else { ++ ret = exynos_bus_parent_parse_of(np, bus); ++ if (ret < 0) ++ return ret; + } + +-out: ++ /* Parse the device-tree to get the resource information */ ++ ret = exynos_bus_parse_of(np, bus); ++ if (ret < 0) ++ goto err_reg; ++ ++ if (passive) ++ ret = exynos_bus_profile_init_passive(bus, profile); ++ else ++ ret = exynos_bus_profile_init(bus, profile); ++ ++ if (ret < 0) ++ goto err; ++ + max_state = bus->devfreq->profile->max_state; + min_freq = (bus->devfreq->profile->freq_table[0] / 1000); + max_freq = (bus->devfreq->profile->freq_table[max_state - 1] / 1000); diff --git a/patch/kernel/odroidxu4-current/7.patch b/patch/kernel/odroidxu4-current/overlay.patch similarity index 100% rename from patch/kernel/odroidxu4-current/7.patch rename to patch/kernel/odroidxu4-current/overlay.patch diff --git a/patch/kernel/odroidxu4-legacy/patch-4.14.165-166.patch b/patch/kernel/odroidxu4-legacy/patch-4.14.165-166.patch new file mode 100644 index 000000000..2e6ac3e17 --- /dev/null +++ b/patch/kernel/odroidxu4-legacy/patch-4.14.165-166.patch @@ -0,0 +1,2162 @@ +diff --git a/Documentation/ABI/testing/sysfs-bus-mei b/Documentation/ABI/testing/sysfs-bus-mei +index 6bd45346ac7e..3f8701e8fa24 100644 +--- a/Documentation/ABI/testing/sysfs-bus-mei ++++ b/Documentation/ABI/testing/sysfs-bus-mei +@@ -4,7 +4,7 @@ KernelVersion: 3.10 + Contact: Samuel Ortiz + linux-mei@linux.intel.com + Description: Stores the same MODALIAS value emitted by uevent +- Format: mei::: ++ Format: mei::: + + What: /sys/bus/mei/devices/.../name + Date: May 2015 +diff --git a/Makefile b/Makefile +index 166e18aa9ca9..7c62b4078c1b 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 4 + PATCHLEVEL = 14 +-SUBLEVEL = 165 ++SUBLEVEL = 166 + EXTRAVERSION = + NAME = Petit Gorille + +diff --git a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi +index 789f3e87321e..7a510505e0c2 100644 +--- a/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi ++++ b/arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi +@@ -262,6 +262,8 @@ + l21 { + regulator-min-microvolt = <2950000>; + regulator-max-microvolt = <2950000>; ++ regulator-allow-set-load; ++ regulator-system-load = <200000>; + }; + l22 { + regulator-min-microvolt = <3300000>; +diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h +index e42c1f0ae6cf..47ba6a57dc45 100644 +--- a/arch/arm64/include/asm/kvm_mmu.h ++++ b/arch/arm64/include/asm/kvm_mmu.h +@@ -296,6 +296,11 @@ static inline bool __kvm_cpu_uses_extended_idmap(void) + return __cpu_uses_extended_idmap(); + } + ++/* ++ * Can't use pgd_populate here, because the extended idmap adds an extra level ++ * above CONFIG_PGTABLE_LEVELS (which is 2 or 3 if we're using the extended ++ * idmap), and pgd_populate is only available if CONFIG_PGTABLE_LEVELS = 4. ++ */ + static inline void __kvm_extend_hypmap(pgd_t *boot_hyp_pgd, + pgd_t *hyp_pgd, + pgd_t *merged_hyp_pgd, +diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h +index 9b676c3dd3ce..324db23b37de 100644 +--- a/arch/arm64/include/asm/pgtable.h ++++ b/arch/arm64/include/asm/pgtable.h +@@ -343,6 +343,7 @@ static inline int pmd_protnone(pmd_t pmd) + + #define pud_write(pud) pte_write(pud_pte(pud)) + #define pud_pfn(pud) (((pud_val(pud) & PUD_MASK) & PHYS_MASK) >> PAGE_SHIFT) ++#define pfn_pud(pfn,prot) (__pud(((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))) + + #define set_pmd_at(mm, addr, pmdp, pmd) set_pte_at(mm, addr, (pte_t *)pmdp, pmd_pte(pmd)) + +diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c +index 60066315d669..09c6499bc500 100644 +--- a/arch/arm64/kernel/cpufeature.c ++++ b/arch/arm64/kernel/cpufeature.c +@@ -836,6 +836,7 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry, + MIDR_ALL_VERSIONS(MIDR_CORTEX_A57), + MIDR_ALL_VERSIONS(MIDR_CORTEX_A72), + MIDR_ALL_VERSIONS(MIDR_CORTEX_A73), ++ { /* sentinel */ } + }; + char const *str = "kpti command line option"; + bool meltdown_safe; +@@ -1277,9 +1278,9 @@ static void __update_cpu_capabilities(const struct arm64_cpu_capabilities *caps, + + static void update_cpu_capabilities(u16 scope_mask) + { +- __update_cpu_capabilities(arm64_features, scope_mask, "detected:"); + __update_cpu_capabilities(arm64_errata, scope_mask, + "enabling workaround for"); ++ __update_cpu_capabilities(arm64_features, scope_mask, "detected:"); + } + + static int __enable_cpu_capability(void *arg) +@@ -1334,8 +1335,8 @@ __enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps, + + static void __init enable_cpu_capabilities(u16 scope_mask) + { +- __enable_cpu_capabilities(arm64_features, scope_mask); + __enable_cpu_capabilities(arm64_errata, scope_mask); ++ __enable_cpu_capabilities(arm64_features, scope_mask); + } + + /* +diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c +index bb444c693796..49f543ebd6cb 100644 +--- a/arch/arm64/kernel/hibernate.c ++++ b/arch/arm64/kernel/hibernate.c +@@ -246,8 +246,7 @@ static int create_safe_exec_page(void *src_start, size_t length, + } + + pte = pte_offset_kernel(pmd, dst_addr); +- set_pte(pte, __pte(virt_to_phys((void *)dst) | +- pgprot_val(PAGE_KERNEL_EXEC))); ++ set_pte(pte, pfn_pte(virt_to_pfn(dst), PAGE_KERNEL_EXEC)); + + /* + * Load our new page tables. A strict BBM approach requires that we +diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c +index abb9d2ecc675..e02a6326c800 100644 +--- a/arch/arm64/mm/mmu.c ++++ b/arch/arm64/mm/mmu.c +@@ -605,8 +605,8 @@ static void __init map_kernel(pgd_t *pgd) + * entry instead. + */ + BUG_ON(!IS_ENABLED(CONFIG_ARM64_16K_PAGES)); +- set_pud(pud_set_fixmap_offset(pgd, FIXADDR_START), +- __pud(__pa_symbol(bm_pmd) | PUD_TYPE_TABLE)); ++ pud_populate(&init_mm, pud_set_fixmap_offset(pgd, FIXADDR_START), ++ lm_alias(bm_pmd)); + pud_clear_fixmap(); + } else { + BUG(); +@@ -721,7 +721,7 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node) + if (!p) + return -ENOMEM; + +- set_pmd(pmd, __pmd(__pa(p) | PROT_SECT_NORMAL)); ++ pmd_set_huge(pmd, __pa(p), __pgprot(PROT_SECT_NORMAL)); + } else + vmemmap_verify((pte_t *)pmd, node, addr, next); + } while (addr = next, addr != end); +@@ -913,17 +913,35 @@ int __init arch_ioremap_pmd_supported(void) + return !IS_ENABLED(CONFIG_ARM64_PTDUMP_DEBUGFS); + } + +-int pud_set_huge(pud_t *pud, phys_addr_t phys, pgprot_t prot) ++int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot) + { ++ pgprot_t sect_prot = __pgprot(PUD_TYPE_SECT | ++ pgprot_val(mk_sect_prot(prot))); ++ pud_t new_pud = pfn_pud(__phys_to_pfn(phys), sect_prot); ++ ++ /* Only allow permission changes for now */ ++ if (!pgattr_change_is_safe(READ_ONCE(pud_val(*pudp)), ++ pud_val(new_pud))) ++ return 0; ++ + BUG_ON(phys & ~PUD_MASK); +- set_pud(pud, __pud(phys | PUD_TYPE_SECT | pgprot_val(mk_sect_prot(prot)))); ++ set_pud(pudp, new_pud); + return 1; + } + +-int pmd_set_huge(pmd_t *pmd, phys_addr_t phys, pgprot_t prot) ++int pmd_set_huge(pmd_t *pmdp, phys_addr_t phys, pgprot_t prot) + { ++ pgprot_t sect_prot = __pgprot(PMD_TYPE_SECT | ++ pgprot_val(mk_sect_prot(prot))); ++ pmd_t new_pmd = pfn_pmd(__phys_to_pfn(phys), sect_prot); ++ ++ /* Only allow permission changes for now */ ++ if (!pgattr_change_is_safe(READ_ONCE(pmd_val(*pmdp)), ++ pmd_val(new_pmd))) ++ return 0; ++ + BUG_ON(phys & ~PMD_MASK); +- set_pmd(pmd, __pmd(phys | PMD_TYPE_SECT | pgprot_val(mk_sect_prot(prot)))); ++ set_pmd(pmdp, new_pmd); + return 1; + } + +diff --git a/arch/hexagon/include/asm/atomic.h b/arch/hexagon/include/asm/atomic.h +index fb3dfb2a667e..d4e283b4f335 100644 +--- a/arch/hexagon/include/asm/atomic.h ++++ b/arch/hexagon/include/asm/atomic.h +@@ -105,7 +105,7 @@ static inline void atomic_##op(int i, atomic_t *v) \ + "1: %0 = memw_locked(%1);\n" \ + " %0 = "#op "(%0,%2);\n" \ + " memw_locked(%1,P3)=%0;\n" \ +- " if !P3 jump 1b;\n" \ ++ " if (!P3) jump 1b;\n" \ + : "=&r" (output) \ + : "r" (&v->counter), "r" (i) \ + : "memory", "p3" \ +@@ -121,7 +121,7 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \ + "1: %0 = memw_locked(%1);\n" \ + " %0 = "#op "(%0,%2);\n" \ + " memw_locked(%1,P3)=%0;\n" \ +- " if !P3 jump 1b;\n" \ ++ " if (!P3) jump 1b;\n" \ + : "=&r" (output) \ + : "r" (&v->counter), "r" (i) \ + : "memory", "p3" \ +@@ -138,7 +138,7 @@ static inline int atomic_fetch_##op(int i, atomic_t *v) \ + "1: %0 = memw_locked(%2);\n" \ + " %1 = "#op "(%0,%3);\n" \ + " memw_locked(%2,P3)=%1;\n" \ +- " if !P3 jump 1b;\n" \ ++ " if (!P3) jump 1b;\n" \ + : "=&r" (output), "=&r" (val) \ + : "r" (&v->counter), "r" (i) \ + : "memory", "p3" \ +@@ -187,7 +187,7 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u) + " }" + " memw_locked(%2, p3) = %1;" + " {" +- " if !p3 jump 1b;" ++ " if (!p3) jump 1b;" + " }" + "2:" + : "=&r" (__oldval), "=&r" (tmp) +diff --git a/arch/hexagon/include/asm/bitops.h b/arch/hexagon/include/asm/bitops.h +index 2691a1857d20..634306cda006 100644 +--- a/arch/hexagon/include/asm/bitops.h ++++ b/arch/hexagon/include/asm/bitops.h +@@ -52,7 +52,7 @@ static inline int test_and_clear_bit(int nr, volatile void *addr) + "1: R12 = memw_locked(R10);\n" + " { P0 = tstbit(R12,R11); R12 = clrbit(R12,R11); }\n" + " memw_locked(R10,P1) = R12;\n" +- " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n" ++ " {if (!P1) jump 1b; %0 = mux(P0,#1,#0);}\n" + : "=&r" (oldval) + : "r" (addr), "r" (nr) + : "r10", "r11", "r12", "p0", "p1", "memory" +@@ -76,7 +76,7 @@ static inline int test_and_set_bit(int nr, volatile void *addr) + "1: R12 = memw_locked(R10);\n" + " { P0 = tstbit(R12,R11); R12 = setbit(R12,R11); }\n" + " memw_locked(R10,P1) = R12;\n" +- " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n" ++ " {if (!P1) jump 1b; %0 = mux(P0,#1,#0);}\n" + : "=&r" (oldval) + : "r" (addr), "r" (nr) + : "r10", "r11", "r12", "p0", "p1", "memory" +@@ -102,7 +102,7 @@ static inline int test_and_change_bit(int nr, volatile void *addr) + "1: R12 = memw_locked(R10);\n" + " { P0 = tstbit(R12,R11); R12 = togglebit(R12,R11); }\n" + " memw_locked(R10,P1) = R12;\n" +- " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n" ++ " {if (!P1) jump 1b; %0 = mux(P0,#1,#0);}\n" + : "=&r" (oldval) + : "r" (addr), "r" (nr) + : "r10", "r11", "r12", "p0", "p1", "memory" +@@ -237,7 +237,7 @@ static inline int ffs(int x) + int r; + + asm("{ P0 = cmp.eq(%1,#0); %0 = ct0(%1);}\n" +- "{ if P0 %0 = #0; if !P0 %0 = add(%0,#1);}\n" ++ "{ if (P0) %0 = #0; if (!P0) %0 = add(%0,#1);}\n" + : "=&r" (r) + : "r" (x) + : "p0"); +diff --git a/arch/hexagon/include/asm/cmpxchg.h b/arch/hexagon/include/asm/cmpxchg.h +index a6e34e2acbba..db258424059f 100644 +--- a/arch/hexagon/include/asm/cmpxchg.h ++++ b/arch/hexagon/include/asm/cmpxchg.h +@@ -44,7 +44,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, + __asm__ __volatile__ ( + "1: %0 = memw_locked(%1);\n" /* load into retval */ + " memw_locked(%1,P0) = %2;\n" /* store into memory */ +- " if !P0 jump 1b;\n" ++ " if (!P0) jump 1b;\n" + : "=&r" (retval) + : "r" (ptr), "r" (x) + : "memory", "p0" +diff --git a/arch/hexagon/include/asm/futex.h b/arch/hexagon/include/asm/futex.h +index c889f5993ecd..e8e5e47afb37 100644 +--- a/arch/hexagon/include/asm/futex.h ++++ b/arch/hexagon/include/asm/futex.h +@@ -16,7 +16,7 @@ + /* For example: %1 = %4 */ \ + insn \ + "2: memw_locked(%3,p2) = %1;\n" \ +- " if !p2 jump 1b;\n" \ ++ " if (!p2) jump 1b;\n" \ + " %1 = #0;\n" \ + "3:\n" \ + ".section .fixup,\"ax\"\n" \ +@@ -84,10 +84,10 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval, + "1: %1 = memw_locked(%3)\n" + " {\n" + " p2 = cmp.eq(%1,%4)\n" +- " if !p2.new jump:NT 3f\n" ++ " if (!p2.new) jump:NT 3f\n" + " }\n" + "2: memw_locked(%3,p2) = %5\n" +- " if !p2 jump 1b\n" ++ " if (!p2) jump 1b\n" + "3:\n" + ".section .fixup,\"ax\"\n" + "4: %0 = #%6\n" +diff --git a/arch/hexagon/include/asm/spinlock.h b/arch/hexagon/include/asm/spinlock.h +index 53a8d5885887..007056263b8e 100644 +--- a/arch/hexagon/include/asm/spinlock.h ++++ b/arch/hexagon/include/asm/spinlock.h +@@ -44,9 +44,9 @@ static inline void arch_read_lock(arch_rwlock_t *lock) + __asm__ __volatile__( + "1: R6 = memw_locked(%0);\n" + " { P3 = cmp.ge(R6,#0); R6 = add(R6,#1);}\n" +- " { if !P3 jump 1b; }\n" ++ " { if (!P3) jump 1b; }\n" + " memw_locked(%0,P3) = R6;\n" +- " { if !P3 jump 1b; }\n" ++ " { if (!P3) jump 1b; }\n" + : + : "r" (&lock->lock) + : "memory", "r6", "p3" +@@ -60,7 +60,7 @@ static inline void arch_read_unlock(arch_rwlock_t *lock) + "1: R6 = memw_locked(%0);\n" + " R6 = add(R6,#-1);\n" + " memw_locked(%0,P3) = R6\n" +- " if !P3 jump 1b;\n" ++ " if (!P3) jump 1b;\n" + : + : "r" (&lock->lock) + : "memory", "r6", "p3" +@@ -75,7 +75,7 @@ static inline int arch_read_trylock(arch_rwlock_t *lock) + __asm__ __volatile__( + " R6 = memw_locked(%1);\n" + " { %0 = #0; P3 = cmp.ge(R6,#0); R6 = add(R6,#1);}\n" +- " { if !P3 jump 1f; }\n" ++ " { if (!P3) jump 1f; }\n" + " memw_locked(%1,P3) = R6;\n" + " { %0 = P3 }\n" + "1:\n" +@@ -102,9 +102,9 @@ static inline void arch_write_lock(arch_rwlock_t *lock) + __asm__ __volatile__( + "1: R6 = memw_locked(%0)\n" + " { P3 = cmp.eq(R6,#0); R6 = #-1;}\n" +- " { if !P3 jump 1b; }\n" ++ " { if (!P3) jump 1b; }\n" + " memw_locked(%0,P3) = R6;\n" +- " { if !P3 jump 1b; }\n" ++ " { if (!P3) jump 1b; }\n" + : + : "r" (&lock->lock) + : "memory", "r6", "p3" +@@ -118,7 +118,7 @@ static inline int arch_write_trylock(arch_rwlock_t *lock) + __asm__ __volatile__( + " R6 = memw_locked(%1)\n" + " { %0 = #0; P3 = cmp.eq(R6,#0); R6 = #-1;}\n" +- " { if !P3 jump 1f; }\n" ++ " { if (!P3) jump 1f; }\n" + " memw_locked(%1,P3) = R6;\n" + " %0 = P3;\n" + "1:\n" +@@ -141,9 +141,9 @@ static inline void arch_spin_lock(arch_spinlock_t *lock) + __asm__ __volatile__( + "1: R6 = memw_locked(%0);\n" + " P3 = cmp.eq(R6,#0);\n" +- " { if !P3 jump 1b; R6 = #1; }\n" ++ " { if (!P3) jump 1b; R6 = #1; }\n" + " memw_locked(%0,P3) = R6;\n" +- " { if !P3 jump 1b; }\n" ++ " { if (!P3) jump 1b; }\n" + : + : "r" (&lock->lock) + : "memory", "r6", "p3" +@@ -163,7 +163,7 @@ static inline unsigned int arch_spin_trylock(arch_spinlock_t *lock) + __asm__ __volatile__( + " R6 = memw_locked(%1);\n" + " P3 = cmp.eq(R6,#0);\n" +- " { if !P3 jump 1f; R6 = #1; %0 = #0; }\n" ++ " { if (!P3) jump 1f; R6 = #1; %0 = #0; }\n" + " memw_locked(%1,P3) = R6;\n" + " %0 = P3;\n" + "1:\n" +diff --git a/arch/hexagon/kernel/stacktrace.c b/arch/hexagon/kernel/stacktrace.c +index 41866a06adf7..ec4ef682923d 100644 +--- a/arch/hexagon/kernel/stacktrace.c ++++ b/arch/hexagon/kernel/stacktrace.c +@@ -24,8 +24,6 @@ + #include + #include + +-register unsigned long current_frame_pointer asm("r30"); +- + struct stackframe { + unsigned long fp; + unsigned long rets; +@@ -43,7 +41,7 @@ void save_stack_trace(struct stack_trace *trace) + + low = (unsigned long)task_stack_page(current); + high = low + THREAD_SIZE; +- fp = current_frame_pointer; ++ fp = (unsigned long)__builtin_frame_address(0); + + while (fp >= low && fp <= (high - sizeof(*frame))) { + frame = (struct stackframe *)fp; +diff --git a/arch/hexagon/kernel/vm_entry.S b/arch/hexagon/kernel/vm_entry.S +index 67c6ccc14770..9f4a73ff7203 100644 +--- a/arch/hexagon/kernel/vm_entry.S ++++ b/arch/hexagon/kernel/vm_entry.S +@@ -382,7 +382,7 @@ ret_from_fork: + R26.L = #LO(do_work_pending); + R0 = #VM_INT_DISABLE; + } +- if P0 jump check_work_pending ++ if (P0) jump check_work_pending + { + R0 = R25; + callr R24 +diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile +index 331b9e0a8072..baa34e4deb78 100644 +--- a/arch/mips/boot/compressed/Makefile ++++ b/arch/mips/boot/compressed/Makefile +@@ -29,6 +29,9 @@ KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY__ \ + -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \ + -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS) + ++# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in. ++KCOV_INSTRUMENT := n ++ + # decompressor objects (linked with vmlinuz) + vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o + +diff --git a/arch/mips/kernel/cacheinfo.c b/arch/mips/kernel/cacheinfo.c +index 428ef2189203..3ea95568ece4 100644 +--- a/arch/mips/kernel/cacheinfo.c ++++ b/arch/mips/kernel/cacheinfo.c +@@ -61,6 +61,25 @@ static int __init_cache_level(unsigned int cpu) + return 0; + } + ++static void fill_cpumask_siblings(int cpu, cpumask_t *cpu_map) ++{ ++ int cpu1; ++ ++ for_each_possible_cpu(cpu1) ++ if (cpus_are_siblings(cpu, cpu1)) ++ cpumask_set_cpu(cpu1, cpu_map); ++} ++ ++static void fill_cpumask_cluster(int cpu, cpumask_t *cpu_map) ++{ ++ int cpu1; ++ int cluster = cpu_cluster(&cpu_data[cpu]); ++ ++ for_each_possible_cpu(cpu1) ++ if (cpu_cluster(&cpu_data[cpu1]) == cluster) ++ cpumask_set_cpu(cpu1, cpu_map); ++} ++ + static int __populate_cache_leaves(unsigned int cpu) + { + struct cpuinfo_mips *c = ¤t_cpu_data; +@@ -68,14 +87,20 @@ static int __populate_cache_leaves(unsigned int cpu) + struct cacheinfo *this_leaf = this_cpu_ci->info_list; + + if (c->icache.waysize) { ++ /* L1 caches are per core */ ++ fill_cpumask_siblings(cpu, &this_leaf->shared_cpu_map); + populate_cache(dcache, this_leaf, 1, CACHE_TYPE_DATA); ++ fill_cpumask_siblings(cpu, &this_leaf->shared_cpu_map); + populate_cache(icache, this_leaf, 1, CACHE_TYPE_INST); + } else { + populate_cache(dcache, this_leaf, 1, CACHE_TYPE_UNIFIED); + } + +- if (c->scache.waysize) ++ if (c->scache.waysize) { ++ /* L2 cache is per cluster */ ++ fill_cpumask_cluster(cpu, &this_leaf->shared_cpu_map); + populate_cache(scache, this_leaf, 2, CACHE_TYPE_UNIFIED); ++ } + + if (c->tcache.waysize) + populate_cache(tcache, this_leaf, 3, CACHE_TYPE_UNIFIED); +diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c +index e2d031a3ec15..961c131a5b7e 100644 +--- a/arch/powerpc/platforms/powernv/pci.c ++++ b/arch/powerpc/platforms/powernv/pci.c +@@ -1118,6 +1118,23 @@ void __init pnv_pci_init(void) + if (!firmware_has_feature(FW_FEATURE_OPAL)) + return; + ++#ifdef CONFIG_PCIEPORTBUS ++ /* ++ * On PowerNV PCIe devices are (currently) managed in cooperation ++ * with firmware. This isn't *strictly* required, but there's enough ++ * assumptions baked into both firmware and the platform code that ++ * it's unwise to allow the portbus services to be used. ++ * ++ * We need to fix this eventually, but for now set this flag to disable ++ * the portbus driver. The AER service isn't required since that AER ++ * events are handled via EEH. The pciehp hotplug driver can't work ++ * without kernel changes (and portbus binding breaks pnv_php). The ++ * other services also require some thinking about how we're going ++ * to integrate them. ++ */ ++ pcie_ports_disabled = true; ++#endif ++ + /* Look for IODA IO-Hubs. */ + for_each_compatible_node(np, NULL, "ibm,ioda-hub") { + pnv_pci_init_ioda_hub(np); +diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c +index 47a14f93f869..2f54df5bef8e 100644 +--- a/drivers/clk/samsung/clk-exynos5420.c ++++ b/drivers/clk/samsung/clk-exynos5420.c +@@ -170,6 +170,8 @@ static const unsigned long exynos5x_clk_regs[] __initconst = { + GATE_BUS_CPU, + GATE_SCLK_CPU, + CLKOUT_CMU_CPU, ++ APLL_CON0, ++ KPLL_CON0, + CPLL_CON0, + DPLL_CON0, + EPLL_CON0, +diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c +index f70cc74032ea..e3899ae429e0 100644 +--- a/drivers/dma/ioat/dma.c ++++ b/drivers/dma/ioat/dma.c +@@ -388,10 +388,11 @@ ioat_alloc_ring(struct dma_chan *c, int order, gfp_t flags) + + descs->virt = dma_alloc_coherent(to_dev(ioat_chan), + SZ_2M, &descs->hw, flags); +- if (!descs->virt && (i > 0)) { ++ if (!descs->virt) { + int idx; + + for (idx = 0; idx < i; idx++) { ++ descs = &ioat_chan->descs[idx]; + dma_free_coherent(to_dev(ioat_chan), SZ_2M, + descs->virt, descs->hw); + descs->virt = NULL; +diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c +index 219ae3b545db..803045c92f3b 100644 +--- a/drivers/dma/k3dma.c ++++ b/drivers/dma/k3dma.c +@@ -222,9 +222,11 @@ static irqreturn_t k3_dma_int_handler(int irq, void *dev_id) + c = p->vchan; + if (c && (tc1 & BIT(i))) { + spin_lock_irqsave(&c->vc.lock, flags); +- vchan_cookie_complete(&p->ds_run->vd); +- p->ds_done = p->ds_run; +- p->ds_run = NULL; ++ if (p->ds_run != NULL) { ++ vchan_cookie_complete(&p->ds_run->vd); ++ p->ds_done = p->ds_run; ++ p->ds_run = NULL; ++ } + spin_unlock_irqrestore(&c->vc.lock, flags); + } + if (c && (tc2 & BIT(i))) { +@@ -264,6 +266,10 @@ static int k3_dma_start_txd(struct k3_dma_chan *c) + if (BIT(c->phy->idx) & k3_dma_get_chan_stat(d)) + return -EAGAIN; + ++ /* Avoid losing track of ds_run if a transaction is in flight */ ++ if (c->phy->ds_run) ++ return -EAGAIN; ++ + if (vd) { + struct k3_dma_desc_sw *ds = + container_of(vd, struct k3_dma_desc_sw, vd); +diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c +index e7783b852d69..d5f735ce0dd4 100644 +--- a/drivers/gpio/gpio-mpc8xxx.c ++++ b/drivers/gpio/gpio-mpc8xxx.c +@@ -306,6 +306,7 @@ static int mpc8xxx_probe(struct platform_device *pdev) + return -ENOMEM; + + gc = &mpc8xxx_gc->gc; ++ gc->parent = &pdev->dev; + + if (of_property_read_bool(np, "little-endian")) { + ret = bgpio_init(gc, &pdev->dev, 4, +diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c +index b3cc948a2d8b..f1d7066b6637 100644 +--- a/drivers/gpio/gpio-zynq.c ++++ b/drivers/gpio/gpio-zynq.c +@@ -639,6 +639,8 @@ static void zynq_gpio_restore_context(struct zynq_gpio *gpio) + unsigned int bank_num; + + for (bank_num = 0; bank_num < gpio->p_data->max_bank; bank_num++) { ++ writel_relaxed(ZYNQ_GPIO_IXR_DISABLE_ALL, gpio->base_addr + ++ ZYNQ_GPIO_INTDIS_OFFSET(bank_num)); + writel_relaxed(gpio->context.datalsw[bank_num], + gpio->base_addr + + ZYNQ_GPIO_DATA_LSW_OFFSET(bank_num)); +@@ -648,9 +650,6 @@ static void zynq_gpio_restore_context(struct zynq_gpio *gpio) + writel_relaxed(gpio->context.dirm[bank_num], + gpio->base_addr + + ZYNQ_GPIO_DIRM_OFFSET(bank_num)); +- writel_relaxed(gpio->context.int_en[bank_num], +- gpio->base_addr + +- ZYNQ_GPIO_INTEN_OFFSET(bank_num)); + writel_relaxed(gpio->context.int_type[bank_num], + gpio->base_addr + + ZYNQ_GPIO_INTTYPE_OFFSET(bank_num)); +@@ -660,6 +659,9 @@ static void zynq_gpio_restore_context(struct zynq_gpio *gpio) + writel_relaxed(gpio->context.int_any[bank_num], + gpio->base_addr + + ZYNQ_GPIO_INTANY_OFFSET(bank_num)); ++ writel_relaxed(~(gpio->context.int_en[bank_num]), ++ gpio->base_addr + ++ ZYNQ_GPIO_INTEN_OFFSET(bank_num)); + } + } + +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c +index 2b75aab8b3a0..f0777a7a4305 100644 +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -3167,8 +3167,9 @@ static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, + + if (chip->ngpio <= p->chip_hwnum) { + dev_err(dev, +- "requested GPIO %d is out of range [0..%d] for chip %s\n", +- idx, chip->ngpio, chip->label); ++ "requested GPIO %u (%u) is out of range [0..%u] for chip %s\n", ++ idx, p->chip_hwnum, chip->ngpio - 1, ++ chip->label); + return ERR_PTR(-EINVAL); + } + +diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c +index 3925a63c1661..cdb67889817c 100644 +--- a/drivers/gpu/drm/i915/i915_gem_context.c ++++ b/drivers/gpu/drm/i915/i915_gem_context.c +@@ -993,18 +993,19 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, + if (args->ctx_id == DEFAULT_CONTEXT_HANDLE) + return -ENOENT; + ++ ret = i915_mutex_lock_interruptible(dev); ++ if (ret) ++ return ret; ++ + ctx = i915_gem_context_lookup(file_priv, args->ctx_id); +- if (!ctx) ++ if (!ctx) { ++ mutex_unlock(&dev->struct_mutex); + return -ENOENT; +- +- ret = mutex_lock_interruptible(&dev->struct_mutex); +- if (ret) +- goto out; ++ } + + __destroy_hw_context(ctx, file_priv); + mutex_unlock(&dev->struct_mutex); + +-out: + i915_gem_context_put(ctx); + return 0; + } +diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c +index 5652bd0ffb4d..5243c4120819 100644 +--- a/drivers/hid/hidraw.c ++++ b/drivers/hid/hidraw.c +@@ -257,13 +257,14 @@ out: + static unsigned int hidraw_poll(struct file *file, poll_table *wait) + { + struct hidraw_list *list = file->private_data; ++ unsigned int mask = POLLOUT | POLLWRNORM; /* hidraw is always writable */ + + poll_wait(file, &list->hidraw->wait, wait); + if (list->head != list->tail) +- return POLLIN | POLLRDNORM; ++ mask |= POLLIN | POLLRDNORM; + if (!list->hidraw->exist) +- return POLLERR | POLLHUP; +- return 0; ++ mask |= POLLERR | POLLHUP; ++ return mask; + } + + static int hidraw_open(struct inode *inode, struct file *file) +diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c +index e63b761f600a..c749f449c7cb 100644 +--- a/drivers/hid/uhid.c ++++ b/drivers/hid/uhid.c +@@ -769,13 +769,14 @@ unlock: + static unsigned int uhid_char_poll(struct file *file, poll_table *wait) + { + struct uhid_device *uhid = file->private_data; ++ unsigned int mask = POLLOUT | POLLWRNORM; /* uhid is always writable */ + + poll_wait(file, &uhid->waitq, wait); + + if (uhid->head != uhid->tail) +- return POLLIN | POLLRDNORM; ++ mask |= POLLIN | POLLRDNORM; + +- return EPOLLOUT | EPOLLWRNORM; ++ return mask; + } + + static const struct file_operations uhid_fops = { +diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c +index c950aa10d0ae..5abe095901c8 100644 +--- a/drivers/iio/imu/adis16480.c ++++ b/drivers/iio/imu/adis16480.c +@@ -372,12 +372,14 @@ static int adis16480_get_calibbias(struct iio_dev *indio_dev, + case IIO_MAGN: + case IIO_PRESSURE: + ret = adis_read_reg_16(&st->adis, reg, &val16); +- *bias = sign_extend32(val16, 15); ++ if (ret == 0) ++ *bias = sign_extend32(val16, 15); + break; + case IIO_ANGL_VEL: + case IIO_ACCEL: + ret = adis_read_reg_32(&st->adis, reg, &val32); +- *bias = sign_extend32(val32, 31); ++ if (ret == 0) ++ *bias = sign_extend32(val32, 31); + break; + default: + ret = -EINVAL; +diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c +index e8afc47f8949..908803fe8276 100644 +--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c ++++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c +@@ -2024,13 +2024,13 @@ static int bnxt_qplib_cq_process_req(struct bnxt_qplib_cq *cq, + bnxt_qplib_mark_qp_error(qp); + bnxt_qplib_unlock_buddy_cq(qp, cq); + } else { ++ /* Before we complete, do WA 9060 */ ++ if (do_wa9060(qp, cq, cq_cons, sw_sq_cons, ++ cqe_sq_cons)) { ++ *lib_qp = qp; ++ goto out; ++ } + if (swq->flags & SQ_SEND_FLAGS_SIGNAL_COMP) { +- /* Before we complete, do WA 9060 */ +- if (do_wa9060(qp, cq, cq_cons, sw_sq_cons, +- cqe_sq_cons)) { +- *lib_qp = qp; +- goto out; +- } + cqe->status = CQ_REQ_STATUS_OK; + cqe++; + (*budget)--; +diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c +index cfddca850cb4..fb45bfa4f845 100644 +--- a/drivers/infiniband/hw/mlx5/mr.c ++++ b/drivers/infiniband/hw/mlx5/mr.c +@@ -460,7 +460,7 @@ struct mlx5_ib_mr *mlx5_mr_cache_alloc(struct mlx5_ib_dev *dev, int entry) + + if (entry < 0 || entry >= MAX_MR_CACHE_ENTRIES) { + mlx5_ib_err(dev, "cache entry %d is out of range\n", entry); +- return NULL; ++ return ERR_PTR(-EINVAL); + } + + ent = &cache->ent[entry]; +diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c +index 94161ca526fc..1446e1cc69ae 100644 +--- a/drivers/infiniband/ulp/srpt/ib_srpt.c ++++ b/drivers/infiniband/ulp/srpt/ib_srpt.c +@@ -1246,9 +1246,11 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch, + struct srpt_send_ioctx *ioctx, u64 tag, + int status) + { ++ struct se_cmd *cmd = &ioctx->cmd; + struct srp_rsp *srp_rsp; + const u8 *sense_data; + int sense_data_len, max_sense_len; ++ u32 resid = cmd->residual_count; + + /* + * The lowest bit of all SAM-3 status codes is zero (see also +@@ -1270,6 +1272,28 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch, + srp_rsp->tag = tag; + srp_rsp->status = status; + ++ if (cmd->se_cmd_flags & SCF_UNDERFLOW_BIT) { ++ if (cmd->data_direction == DMA_TO_DEVICE) { ++ /* residual data from an underflow write */ ++ srp_rsp->flags = SRP_RSP_FLAG_DOUNDER; ++ srp_rsp->data_out_res_cnt = cpu_to_be32(resid); ++ } else if (cmd->data_direction == DMA_FROM_DEVICE) { ++ /* residual data from an underflow read */ ++ srp_rsp->flags = SRP_RSP_FLAG_DIUNDER; ++ srp_rsp->data_in_res_cnt = cpu_to_be32(resid); ++ } ++ } else if (cmd->se_cmd_flags & SCF_OVERFLOW_BIT) { ++ if (cmd->data_direction == DMA_TO_DEVICE) { ++ /* residual data from an overflow write */ ++ srp_rsp->flags = SRP_RSP_FLAG_DOOVER; ++ srp_rsp->data_out_res_cnt = cpu_to_be32(resid); ++ } else if (cmd->data_direction == DMA_FROM_DEVICE) { ++ /* residual data from an overflow read */ ++ srp_rsp->flags = SRP_RSP_FLAG_DIOVER; ++ srp_rsp->data_in_res_cnt = cpu_to_be32(resid); ++ } ++ } ++ + if (sense_data_len) { + BUILD_BUG_ON(MIN_MAX_RSP_SIZE <= sizeof(*srp_rsp)); + max_sense_len = ch->max_ti_iu_len - sizeof(*srp_rsp); +diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c +index 1620a6f49989..4b761678a18b 100644 +--- a/drivers/iommu/iommu.c ++++ b/drivers/iommu/iommu.c +@@ -613,6 +613,7 @@ err_put_group: + mutex_unlock(&group->mutex); + dev->iommu_group = NULL; + kobject_put(group->devices_kobj); ++ sysfs_remove_link(group->devices_kobj, device->name); + err_free_name: + kfree(device->name); + err_remove_link: +diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c +index 348296be4925..4f67a515bdd8 100644 +--- a/drivers/media/i2c/ov6650.c ++++ b/drivers/media/i2c/ov6650.c +@@ -203,7 +203,6 @@ struct ov6650 { + unsigned long pclk_max; /* from resolution and format */ + struct v4l2_fract tpf; /* as requested with s_parm */ + u32 code; +- enum v4l2_colorspace colorspace; + }; + + +@@ -216,6 +215,17 @@ static u32 ov6650_codes[] = { + MEDIA_BUS_FMT_Y8_1X8, + }; + ++static const struct v4l2_mbus_framefmt ov6650_def_fmt = { ++ .width = W_CIF, ++ .height = H_CIF, ++ .code = MEDIA_BUS_FMT_SBGGR8_1X8, ++ .colorspace = V4L2_COLORSPACE_SRGB, ++ .field = V4L2_FIELD_NONE, ++ .ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT, ++ .quantization = V4L2_QUANTIZATION_DEFAULT, ++ .xfer_func = V4L2_XFER_FUNC_DEFAULT, ++}; ++ + /* read a register */ + static int ov6650_reg_read(struct i2c_client *client, u8 reg, u8 *val) + { +@@ -517,12 +527,20 @@ static int ov6650_get_fmt(struct v4l2_subdev *sd, + if (format->pad) + return -EINVAL; + +- mf->width = priv->rect.width >> priv->half_scale; +- mf->height = priv->rect.height >> priv->half_scale; +- mf->code = priv->code; +- mf->colorspace = priv->colorspace; +- mf->field = V4L2_FIELD_NONE; ++ /* initialize response with default media bus frame format */ ++ *mf = ov6650_def_fmt; + ++ /* update media bus format code and frame size */ ++ if (format->which == V4L2_SUBDEV_FORMAT_TRY) { ++ mf->width = cfg->try_fmt.width; ++ mf->height = cfg->try_fmt.height; ++ mf->code = cfg->try_fmt.code; ++ ++ } else { ++ mf->width = priv->rect.width >> priv->half_scale; ++ mf->height = priv->rect.height >> priv->half_scale; ++ mf->code = priv->code; ++ } + return 0; + } + +@@ -627,11 +645,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) + priv->pclk_max = 8000000; + } + +- if (code == MEDIA_BUS_FMT_SBGGR8_1X8) +- priv->colorspace = V4L2_COLORSPACE_SRGB; +- else if (code != 0) +- priv->colorspace = V4L2_COLORSPACE_JPEG; +- + if (half_scale) { + dev_dbg(&client->dev, "max resolution: QCIF\n"); + coma_set |= COMA_QCIF; +@@ -665,11 +678,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) + if (!ret) + priv->code = code; + +- if (!ret) { +- mf->colorspace = priv->colorspace; +- mf->width = priv->rect.width >> half_scale; +- mf->height = priv->rect.height >> half_scale; +- } + return ret; + } + +@@ -688,8 +696,6 @@ static int ov6650_set_fmt(struct v4l2_subdev *sd, + v4l_bound_align_image(&mf->width, 2, W_CIF, 1, + &mf->height, 2, H_CIF, 1, 0); + +- mf->field = V4L2_FIELD_NONE; +- + switch (mf->code) { + case MEDIA_BUS_FMT_Y10_1X10: + mf->code = MEDIA_BUS_FMT_Y8_1X8; +@@ -699,20 +705,39 @@ static int ov6650_set_fmt(struct v4l2_subdev *sd, + case MEDIA_BUS_FMT_YUYV8_2X8: + case MEDIA_BUS_FMT_VYUY8_2X8: + case MEDIA_BUS_FMT_UYVY8_2X8: +- mf->colorspace = V4L2_COLORSPACE_JPEG; + break; + default: + mf->code = MEDIA_BUS_FMT_SBGGR8_1X8; + /* fall through */ + case MEDIA_BUS_FMT_SBGGR8_1X8: +- mf->colorspace = V4L2_COLORSPACE_SRGB; + break; + } + +- if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) +- return ov6650_s_fmt(sd, mf); +- cfg->try_fmt = *mf; ++ if (format->which == V4L2_SUBDEV_FORMAT_TRY) { ++ /* store media bus format code and frame size in pad config */ ++ cfg->try_fmt.width = mf->width; ++ cfg->try_fmt.height = mf->height; ++ cfg->try_fmt.code = mf->code; + ++ /* return default mbus frame format updated with pad config */ ++ *mf = ov6650_def_fmt; ++ mf->width = cfg->try_fmt.width; ++ mf->height = cfg->try_fmt.height; ++ mf->code = cfg->try_fmt.code; ++ ++ } else { ++ /* apply new media bus format code and frame size */ ++ int ret = ov6650_s_fmt(sd, mf); ++ ++ if (ret) ++ return ret; ++ ++ /* return default format updated with active size and code */ ++ *mf = ov6650_def_fmt; ++ mf->width = priv->rect.width >> priv->half_scale; ++ mf->height = priv->rect.height >> priv->half_scale; ++ mf->code = priv->code; ++ } + return 0; + } + +@@ -1020,7 +1045,6 @@ static int ov6650_probe(struct i2c_client *client, + priv->rect.height = H_CIF; + priv->half_scale = false; + priv->code = MEDIA_BUS_FMT_YUYV8_2X8; +- priv->colorspace = V4L2_COLORSPACE_JPEG; + + ret = ov6650_video_probe(client); + if (ret) +diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c +index a920164f53f1..39340abefd14 100644 +--- a/drivers/media/platform/exynos4-is/fimc-isp-video.c ++++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c +@@ -316,7 +316,7 @@ static int isp_video_release(struct file *file) + ivc->streaming = 0; + } + +- vb2_fop_release(file); ++ _vb2_fop_release(file, NULL); + + if (v4l2_fh_is_singular_file(file)) { + fimc_pipeline_call(&ivc->ve, close); +diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c +index 4ff8d0aed015..d30f129a9db7 100644 +--- a/drivers/media/usb/zr364xx/zr364xx.c ++++ b/drivers/media/usb/zr364xx/zr364xx.c +@@ -706,7 +706,8 @@ static int zr364xx_vidioc_querycap(struct file *file, void *priv, + struct zr364xx_camera *cam = video_drvdata(file); + + strlcpy(cap->driver, DRIVER_DESC, sizeof(cap->driver)); +- strlcpy(cap->card, cam->udev->product, sizeof(cap->card)); ++ if (cam->udev->product) ++ strlcpy(cap->card, cam->udev->product, sizeof(cap->card)); + strlcpy(cap->bus_info, dev_name(&cam->udev->dev), + sizeof(cap->bus_info)); + cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | +diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c +index eb29113e0bac..b11737f7bdca 100644 +--- a/drivers/misc/enclosure.c ++++ b/drivers/misc/enclosure.c +@@ -419,10 +419,9 @@ int enclosure_remove_device(struct enclosure_device *edev, struct device *dev) + cdev = &edev->component[i]; + if (cdev->dev == dev) { + enclosure_remove_links(cdev); +- device_del(&cdev->cdev); + put_device(dev); + cdev->dev = NULL; +- return device_add(&cdev->cdev); ++ return 0; + } + } + return -ENODEV; +diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c +index d550148177a0..0fe3e39f870f 100644 +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -1216,7 +1216,7 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len, + size_t *retlen, u_char *buf) + { + struct spi_nor *nor = mtd_to_spi_nor(mtd); +- int ret; ++ ssize_t ret; + + dev_dbg(nor->dev, "from 0x%08x, len %zd\n", (u32)from, len); + +@@ -1445,7 +1445,7 @@ static int macronix_quad_enable(struct spi_nor *nor) + */ + static int write_sr_cr(struct spi_nor *nor, u8 *sr_cr) + { +- int ret; ++ ssize_t ret; + + write_enable(nor); + +diff --git a/drivers/net/wimax/i2400m/op-rfkill.c b/drivers/net/wimax/i2400m/op-rfkill.c +index b0dba35a8ad2..dc6fe93ce71f 100644 +--- a/drivers/net/wimax/i2400m/op-rfkill.c ++++ b/drivers/net/wimax/i2400m/op-rfkill.c +@@ -147,6 +147,7 @@ error_msg_to_dev: + error_alloc: + d_fnend(4, dev, "(wimax_dev %p state %d) = %d\n", + wimax_dev, state, result); ++ kfree(cmd); + return result; + } + +diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c +index 4650b9e5da2b..ba9e7bfeca2c 100644 +--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c ++++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c +@@ -532,6 +532,7 @@ static struct scatterlist *alloc_sgtable(int size) + if (new_page) + __free_page(new_page); + } ++ kfree(table); + return NULL; + } + alloc_size = min_t(int, size, PAGE_SIZE); +diff --git a/drivers/net/wireless/realtek/rtlwifi/regd.c b/drivers/net/wireless/realtek/rtlwifi/regd.c +index 1bf3eb25c1da..72ca370331fb 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/regd.c ++++ b/drivers/net/wireless/realtek/rtlwifi/regd.c +@@ -427,7 +427,7 @@ int rtl_regd_init(struct ieee80211_hw *hw, + struct wiphy *wiphy = hw->wiphy; + struct country_code_to_enum_rd *country = NULL; + +- if (wiphy == NULL || &rtlpriv->regd == NULL) ++ if (!wiphy) + return -EINVAL; + + /* init country_code from efuse channel plan */ +diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c +index fa12c05d9e23..233b2239311d 100644 +--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c ++++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c +@@ -218,6 +218,7 @@ void rsi_mac80211_detach(struct rsi_hw *adapter) + ieee80211_stop_queues(hw); + ieee80211_unregister_hw(hw); + ieee80211_free_hw(hw); ++ adapter->hw = NULL; + } + + for (band = 0; band < NUM_NL80211_BANDS; band++) { +diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c +index bab8ac63c4f3..3008bba360f3 100644 +--- a/drivers/pci/pcie/ptm.c ++++ b/drivers/pci/pcie/ptm.c +@@ -29,7 +29,7 @@ static void pci_ptm_info(struct pci_dev *dev) + snprintf(clock_desc, sizeof(clock_desc), ">254ns"); + break; + default: +- snprintf(clock_desc, sizeof(clock_desc), "%udns", ++ snprintf(clock_desc, sizeof(clock_desc), "%uns", + dev->ptm_granularity); + break; + } +diff --git a/drivers/pinctrl/intel/pinctrl-lewisburg.c b/drivers/pinctrl/intel/pinctrl-lewisburg.c +index 14d56ea6cfdc..c2164db14e9c 100644 +--- a/drivers/pinctrl/intel/pinctrl-lewisburg.c ++++ b/drivers/pinctrl/intel/pinctrl-lewisburg.c +@@ -34,6 +34,7 @@ + .npins = ((e) - (s) + 1), \ + } + ++/* Lewisburg */ + static const struct pinctrl_pin_desc lbg_pins[] = { + /* GPP_A */ + PINCTRL_PIN(0, "RCINB"), +@@ -73,7 +74,7 @@ static const struct pinctrl_pin_desc lbg_pins[] = { + PINCTRL_PIN(33, "SRCCLKREQB_4"), + PINCTRL_PIN(34, "SRCCLKREQB_5"), + PINCTRL_PIN(35, "GPP_B_11"), +- PINCTRL_PIN(36, "GLB_RST_WARN_N"), ++ PINCTRL_PIN(36, "SLP_S0B"), + PINCTRL_PIN(37, "PLTRSTB"), + PINCTRL_PIN(38, "SPKR"), + PINCTRL_PIN(39, "GPP_B_15"), +@@ -186,96 +187,96 @@ static const struct pinctrl_pin_desc lbg_pins[] = { + PINCTRL_PIN(141, "GBE_PCI_DIS"), + PINCTRL_PIN(142, "GBE_LAN_DIS"), + PINCTRL_PIN(143, "GPP_I_10"), +- PINCTRL_PIN(144, "GPIO_RCOMP_3P3"), + /* GPP_J */ +- PINCTRL_PIN(145, "GBE_LED_0_0"), +- PINCTRL_PIN(146, "GBE_LED_0_1"), +- PINCTRL_PIN(147, "GBE_LED_1_0"), +- PINCTRL_PIN(148, "GBE_LED_1_1"), +- PINCTRL_PIN(149, "GBE_LED_2_0"), +- PINCTRL_PIN(150, "GBE_LED_2_1"), +- PINCTRL_PIN(151, "GBE_LED_3_0"), +- PINCTRL_PIN(152, "GBE_LED_3_1"), +- PINCTRL_PIN(153, "GBE_SCL_0"), +- PINCTRL_PIN(154, "GBE_SDA_0"), +- PINCTRL_PIN(155, "GBE_SCL_1"), +- PINCTRL_PIN(156, "GBE_SDA_1"), +- PINCTRL_PIN(157, "GBE_SCL_2"), +- PINCTRL_PIN(158, "GBE_SDA_2"), +- PINCTRL_PIN(159, "GBE_SCL_3"), +- PINCTRL_PIN(160, "GBE_SDA_3"), +- PINCTRL_PIN(161, "GBE_SDP_0_0"), +- PINCTRL_PIN(162, "GBE_SDP_0_1"), +- PINCTRL_PIN(163, "GBE_SDP_1_0"), +- PINCTRL_PIN(164, "GBE_SDP_1_1"), +- PINCTRL_PIN(165, "GBE_SDP_2_0"), +- PINCTRL_PIN(166, "GBE_SDP_2_1"), +- PINCTRL_PIN(167, "GBE_SDP_3_0"), +- PINCTRL_PIN(168, "GBE_SDP_3_1"), ++ PINCTRL_PIN(144, "GBE_LED_0_0"), ++ PINCTRL_PIN(145, "GBE_LED_0_1"), ++ PINCTRL_PIN(146, "GBE_LED_1_0"), ++ PINCTRL_PIN(147, "GBE_LED_1_1"), ++ PINCTRL_PIN(148, "GBE_LED_2_0"), ++ PINCTRL_PIN(149, "GBE_LED_2_1"), ++ PINCTRL_PIN(150, "GBE_LED_3_0"), ++ PINCTRL_PIN(151, "GBE_LED_3_1"), ++ PINCTRL_PIN(152, "GBE_SCL_0"), ++ PINCTRL_PIN(153, "GBE_SDA_0"), ++ PINCTRL_PIN(154, "GBE_SCL_1"), ++ PINCTRL_PIN(155, "GBE_SDA_1"), ++ PINCTRL_PIN(156, "GBE_SCL_2"), ++ PINCTRL_PIN(157, "GBE_SDA_2"), ++ PINCTRL_PIN(158, "GBE_SCL_3"), ++ PINCTRL_PIN(159, "GBE_SDA_3"), ++ PINCTRL_PIN(160, "GBE_SDP_0_0"), ++ PINCTRL_PIN(161, "GBE_SDP_0_1"), ++ PINCTRL_PIN(162, "GBE_SDP_1_0"), ++ PINCTRL_PIN(163, "GBE_SDP_1_1"), ++ PINCTRL_PIN(164, "GBE_SDP_2_0"), ++ PINCTRL_PIN(165, "GBE_SDP_2_1"), ++ PINCTRL_PIN(166, "GBE_SDP_3_0"), ++ PINCTRL_PIN(167, "GBE_SDP_3_1"), + /* GPP_K */ +- PINCTRL_PIN(169, "GBE_RMIICLK"), +- PINCTRL_PIN(170, "GBE_RMII_TXD_0"), +- PINCTRL_PIN(171, "GBE_RMII_TXD_1"), ++ PINCTRL_PIN(168, "GBE_RMIICLK"), ++ PINCTRL_PIN(169, "GBE_RMII_RXD_0"), ++ PINCTRL_PIN(170, "GBE_RMII_RXD_1"), ++ PINCTRL_PIN(171, "GBE_RMII_CRS_DV"), + PINCTRL_PIN(172, "GBE_RMII_TX_EN"), +- PINCTRL_PIN(173, "GBE_RMII_CRS_DV"), +- PINCTRL_PIN(174, "GBE_RMII_RXD_0"), +- PINCTRL_PIN(175, "GBE_RMII_RXD_1"), +- PINCTRL_PIN(176, "GBE_RMII_RX_ER"), +- PINCTRL_PIN(177, "GBE_RMII_ARBIN"), +- PINCTRL_PIN(178, "GBE_RMII_ARB_OUT"), +- PINCTRL_PIN(179, "PE_RST_N"), +- PINCTRL_PIN(180, "GPIO_RCOMP_1P8_3P3"), ++ PINCTRL_PIN(173, "GBE_RMII_TXD_0"), ++ PINCTRL_PIN(174, "GBE_RMII_TXD_1"), ++ PINCTRL_PIN(175, "GBE_RMII_RX_ER"), ++ PINCTRL_PIN(176, "GBE_RMII_ARBIN"), ++ PINCTRL_PIN(177, "GBE_RMII_ARB_OUT"), ++ PINCTRL_PIN(178, "PE_RST_N"), + /* GPP_G */ +- PINCTRL_PIN(181, "FAN_TACH_0"), +- PINCTRL_PIN(182, "FAN_TACH_1"), +- PINCTRL_PIN(183, "FAN_TACH_2"), +- PINCTRL_PIN(184, "FAN_TACH_3"), +- PINCTRL_PIN(185, "FAN_TACH_4"), +- PINCTRL_PIN(186, "FAN_TACH_5"), +- PINCTRL_PIN(187, "FAN_TACH_6"), +- PINCTRL_PIN(188, "FAN_TACH_7"), +- PINCTRL_PIN(189, "FAN_PWM_0"), +- PINCTRL_PIN(190, "FAN_PWM_1"), +- PINCTRL_PIN(191, "FAN_PWM_2"), +- PINCTRL_PIN(192, "FAN_PWM_3"), +- PINCTRL_PIN(193, "GSXDOUT"), +- PINCTRL_PIN(194, "GSXSLOAD"), +- PINCTRL_PIN(195, "GSXDIN"), +- PINCTRL_PIN(196, "GSXSRESETB"), +- PINCTRL_PIN(197, "GSXCLK"), +- PINCTRL_PIN(198, "ADR_COMPLETE"), +- PINCTRL_PIN(199, "NMIB"), +- PINCTRL_PIN(200, "SMIB"), +- PINCTRL_PIN(201, "SSATA_DEVSLP_0"), +- PINCTRL_PIN(202, "SSATA_DEVSLP_1"), +- PINCTRL_PIN(203, "SSATA_DEVSLP_2"), +- PINCTRL_PIN(204, "SSATAXPCIE0_SSATAGP0"), ++ PINCTRL_PIN(179, "FAN_TACH_0"), ++ PINCTRL_PIN(180, "FAN_TACH_1"), ++ PINCTRL_PIN(181, "FAN_TACH_2"), ++ PINCTRL_PIN(182, "FAN_TACH_3"), ++ PINCTRL_PIN(183, "FAN_TACH_4"), ++ PINCTRL_PIN(184, "FAN_TACH_5"), ++ PINCTRL_PIN(185, "FAN_TACH_6"), ++ PINCTRL_PIN(186, "FAN_TACH_7"), ++ PINCTRL_PIN(187, "FAN_PWM_0"), ++ PINCTRL_PIN(188, "FAN_PWM_1"), ++ PINCTRL_PIN(189, "FAN_PWM_2"), ++ PINCTRL_PIN(190, "FAN_PWM_3"), ++ PINCTRL_PIN(191, "GSXDOUT"), ++ PINCTRL_PIN(192, "GSXSLOAD"), ++ PINCTRL_PIN(193, "GSXDIN"), ++ PINCTRL_PIN(194, "GSXSRESETB"), ++ PINCTRL_PIN(195, "GSXCLK"), ++ PINCTRL_PIN(196, "ADR_COMPLETE"), ++ PINCTRL_PIN(197, "NMIB"), ++ PINCTRL_PIN(198, "SMIB"), ++ PINCTRL_PIN(199, "SSATA_DEVSLP_0"), ++ PINCTRL_PIN(200, "SSATA_DEVSLP_1"), ++ PINCTRL_PIN(201, "SSATA_DEVSLP_2"), ++ PINCTRL_PIN(202, "SSATAXPCIE0_SSATAGP0"), + /* GPP_H */ +- PINCTRL_PIN(205, "SRCCLKREQB_6"), +- PINCTRL_PIN(206, "SRCCLKREQB_7"), +- PINCTRL_PIN(207, "SRCCLKREQB_8"), +- PINCTRL_PIN(208, "SRCCLKREQB_9"), +- PINCTRL_PIN(209, "SRCCLKREQB_10"), +- PINCTRL_PIN(210, "SRCCLKREQB_11"), +- PINCTRL_PIN(211, "SRCCLKREQB_12"), +- PINCTRL_PIN(212, "SRCCLKREQB_13"), +- PINCTRL_PIN(213, "SRCCLKREQB_14"), +- PINCTRL_PIN(214, "SRCCLKREQB_15"), +- PINCTRL_PIN(215, "SML2CLK"), +- PINCTRL_PIN(216, "SML2DATA"), +- PINCTRL_PIN(217, "SML2ALERTB"), +- PINCTRL_PIN(218, "SML3CLK"), +- PINCTRL_PIN(219, "SML3DATA"), +- PINCTRL_PIN(220, "SML3ALERTB"), +- PINCTRL_PIN(221, "SML4CLK"), +- PINCTRL_PIN(222, "SML4DATA"), +- PINCTRL_PIN(223, "SML4ALERTB"), +- PINCTRL_PIN(224, "SSATAXPCIE1_SSATAGP1"), +- PINCTRL_PIN(225, "SSATAXPCIE2_SSATAGP2"), +- PINCTRL_PIN(226, "SSATAXPCIE3_SSATAGP3"), +- PINCTRL_PIN(227, "SSATAXPCIE4_SSATAGP4"), +- PINCTRL_PIN(228, "SSATAXPCIE5_SSATAGP5"), ++ PINCTRL_PIN(203, "SRCCLKREQB_6"), ++ PINCTRL_PIN(204, "SRCCLKREQB_7"), ++ PINCTRL_PIN(205, "SRCCLKREQB_8"), ++ PINCTRL_PIN(206, "SRCCLKREQB_9"), ++ PINCTRL_PIN(207, "SRCCLKREQB_10"), ++ PINCTRL_PIN(208, "SRCCLKREQB_11"), ++ PINCTRL_PIN(209, "SRCCLKREQB_12"), ++ PINCTRL_PIN(210, "SRCCLKREQB_13"), ++ PINCTRL_PIN(211, "SRCCLKREQB_14"), ++ PINCTRL_PIN(212, "SRCCLKREQB_15"), ++ PINCTRL_PIN(213, "SML2CLK"), ++ PINCTRL_PIN(214, "SML2DATA"), ++ PINCTRL_PIN(215, "SML2ALERTB"), ++ PINCTRL_PIN(216, "SML3CLK"), ++ PINCTRL_PIN(217, "SML3DATA"), ++ PINCTRL_PIN(218, "SML3ALERTB"), ++ PINCTRL_PIN(219, "SML4CLK"), ++ PINCTRL_PIN(220, "SML4DATA"), ++ PINCTRL_PIN(221, "SML4ALERTB"), ++ PINCTRL_PIN(222, "SSATAXPCIE1_SSATAGP1"), ++ PINCTRL_PIN(223, "SSATAXPCIE2_SSATAGP2"), ++ PINCTRL_PIN(224, "SSATAXPCIE3_SSATAGP3"), ++ PINCTRL_PIN(225, "SSATAXPCIE4_SSATAGP4"), ++ PINCTRL_PIN(226, "SSATAXPCIE5_SSATAGP5"), + /* GPP_L */ ++ PINCTRL_PIN(227, "GPP_L_0"), ++ PINCTRL_PIN(228, "EC_CSME_INTR_OUT"), + PINCTRL_PIN(229, "VISA2CH0_D0"), + PINCTRL_PIN(230, "VISA2CH0_D1"), + PINCTRL_PIN(231, "VISA2CH0_D2"), +diff --git a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c +index 5c1b6325d80d..8ac1f1ce4442 100644 +--- a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c ++++ b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c +@@ -496,7 +496,7 @@ static int ti_iodelay_dt_node_to_map(struct pinctrl_dev *pctldev, + return -EINVAL; + + rows = pinctrl_count_index_with_args(np, name); +- if (rows == -EINVAL) ++ if (rows < 0) + return rows; + + *map = devm_kzalloc(iod->dev, sizeof(**map), GFP_KERNEL); +diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c +index 1c1999600717..af26ca49996d 100644 +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -457,13 +457,7 @@ static void kbd_led_update(struct work_struct *work) + + asus = container_of(work, struct asus_wmi, kbd_led_work); + +- /* +- * bits 0-2: level +- * bit 7: light on/off +- */ +- if (asus->kbd_led_wk > 0) +- ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F); +- ++ ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F); + asus_wmi_set_devstate(ASUS_WMI_DEVID_KBD_BACKLIGHT, ctrl_param, NULL); + } + +diff --git a/drivers/rtc/rtc-msm6242.c b/drivers/rtc/rtc-msm6242.c +index c1c5c4e3b3b4..c981301efbe5 100644 +--- a/drivers/rtc/rtc-msm6242.c ++++ b/drivers/rtc/rtc-msm6242.c +@@ -132,7 +132,8 @@ static int msm6242_read_time(struct device *dev, struct rtc_time *tm) + msm6242_read(priv, MSM6242_SECOND1); + tm->tm_min = msm6242_read(priv, MSM6242_MINUTE10) * 10 + + msm6242_read(priv, MSM6242_MINUTE1); +- tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10 & 3)) * 10 + ++ tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10) & ++ MSM6242_HOUR10_HR_MASK) * 10 + + msm6242_read(priv, MSM6242_HOUR1); + tm->tm_mday = msm6242_read(priv, MSM6242_DAY10) * 10 + + msm6242_read(priv, MSM6242_DAY1); +diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c +index e82df43e5ca2..c696d9186451 100644 +--- a/drivers/rtc/rtc-mt6397.c ++++ b/drivers/rtc/rtc-mt6397.c +@@ -55,6 +55,14 @@ + + #define RTC_AL_SEC 0x0018 + ++#define RTC_AL_SEC_MASK 0x003f ++#define RTC_AL_MIN_MASK 0x003f ++#define RTC_AL_HOU_MASK 0x001f ++#define RTC_AL_DOM_MASK 0x001f ++#define RTC_AL_DOW_MASK 0x0007 ++#define RTC_AL_MTH_MASK 0x000f ++#define RTC_AL_YEA_MASK 0x007f ++ + #define RTC_PDN2 0x002e + #define RTC_PDN2_PWRON_ALARM BIT(4) + +@@ -111,7 +119,7 @@ static irqreturn_t mtk_rtc_irq_handler_thread(int irq, void *data) + irqen = irqsta & ~RTC_IRQ_EN_AL; + mutex_lock(&rtc->lock); + if (regmap_write(rtc->regmap, rtc->addr_base + RTC_IRQ_EN, +- irqen) < 0) ++ irqen) == 0) + mtk_rtc_write_trigger(rtc); + mutex_unlock(&rtc->lock); + +@@ -233,12 +241,12 @@ static int mtk_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) + alm->pending = !!(pdn2 & RTC_PDN2_PWRON_ALARM); + mutex_unlock(&rtc->lock); + +- tm->tm_sec = data[RTC_OFFSET_SEC]; +- tm->tm_min = data[RTC_OFFSET_MIN]; +- tm->tm_hour = data[RTC_OFFSET_HOUR]; +- tm->tm_mday = data[RTC_OFFSET_DOM]; +- tm->tm_mon = data[RTC_OFFSET_MTH]; +- tm->tm_year = data[RTC_OFFSET_YEAR]; ++ tm->tm_sec = data[RTC_OFFSET_SEC] & RTC_AL_SEC_MASK; ++ tm->tm_min = data[RTC_OFFSET_MIN] & RTC_AL_MIN_MASK; ++ tm->tm_hour = data[RTC_OFFSET_HOUR] & RTC_AL_HOU_MASK; ++ tm->tm_mday = data[RTC_OFFSET_DOM] & RTC_AL_DOM_MASK; ++ tm->tm_mon = data[RTC_OFFSET_MTH] & RTC_AL_MTH_MASK; ++ tm->tm_year = data[RTC_OFFSET_YEAR] & RTC_AL_YEA_MASK; + + tm->tm_year += RTC_MIN_YEAR_OFFSET; + tm->tm_mon--; +@@ -259,14 +267,25 @@ static int mtk_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) + tm->tm_year -= RTC_MIN_YEAR_OFFSET; + tm->tm_mon++; + +- data[RTC_OFFSET_SEC] = tm->tm_sec; +- data[RTC_OFFSET_MIN] = tm->tm_min; +- data[RTC_OFFSET_HOUR] = tm->tm_hour; +- data[RTC_OFFSET_DOM] = tm->tm_mday; +- data[RTC_OFFSET_MTH] = tm->tm_mon; +- data[RTC_OFFSET_YEAR] = tm->tm_year; +- + mutex_lock(&rtc->lock); ++ ret = regmap_bulk_read(rtc->regmap, rtc->addr_base + RTC_AL_SEC, ++ data, RTC_OFFSET_COUNT); ++ if (ret < 0) ++ goto exit; ++ ++ data[RTC_OFFSET_SEC] = ((data[RTC_OFFSET_SEC] & ~(RTC_AL_SEC_MASK)) | ++ (tm->tm_sec & RTC_AL_SEC_MASK)); ++ data[RTC_OFFSET_MIN] = ((data[RTC_OFFSET_MIN] & ~(RTC_AL_MIN_MASK)) | ++ (tm->tm_min & RTC_AL_MIN_MASK)); ++ data[RTC_OFFSET_HOUR] = ((data[RTC_OFFSET_HOUR] & ~(RTC_AL_HOU_MASK)) | ++ (tm->tm_hour & RTC_AL_HOU_MASK)); ++ data[RTC_OFFSET_DOM] = ((data[RTC_OFFSET_DOM] & ~(RTC_AL_DOM_MASK)) | ++ (tm->tm_mday & RTC_AL_DOM_MASK)); ++ data[RTC_OFFSET_MTH] = ((data[RTC_OFFSET_MTH] & ~(RTC_AL_MTH_MASK)) | ++ (tm->tm_mon & RTC_AL_MTH_MASK)); ++ data[RTC_OFFSET_YEAR] = ((data[RTC_OFFSET_YEAR] & ~(RTC_AL_YEA_MASK)) | ++ (tm->tm_year & RTC_AL_YEA_MASK)); ++ + if (alm->enabled) { + ret = regmap_bulk_write(rtc->regmap, + rtc->addr_base + RTC_AL_SEC, +diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c +index 902f5e03ec94..0d45658f163a 100644 +--- a/drivers/scsi/cxgbi/libcxgbi.c ++++ b/drivers/scsi/cxgbi/libcxgbi.c +@@ -121,7 +121,8 @@ static inline void cxgbi_device_destroy(struct cxgbi_device *cdev) + "cdev 0x%p, p# %u.\n", cdev, cdev->nports); + cxgbi_hbas_remove(cdev); + cxgbi_device_portmap_cleanup(cdev); +- cxgbi_ppm_release(cdev->cdev2ppm(cdev)); ++ if (cdev->cdev2ppm) ++ cxgbi_ppm_release(cdev->cdev2ppm(cdev)); + if (cdev->pmap.max_connect) + cxgbi_free_big_mem(cdev->pmap.port_csk); + kfree(cdev); +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c +index 35cea5827a7a..2955b856e9ec 100644 +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -1697,20 +1697,30 @@ static void sd_rescan(struct device *dev) + static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode, + unsigned int cmd, unsigned long arg) + { +- struct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device; ++ struct gendisk *disk = bdev->bd_disk; ++ struct scsi_disk *sdkp = scsi_disk(disk); ++ struct scsi_device *sdev = sdkp->device; ++ void __user *p = compat_ptr(arg); + int error; + ++ error = scsi_verify_blk_ioctl(bdev, cmd); ++ if (error < 0) ++ return error; ++ + error = scsi_ioctl_block_when_processing_errors(sdev, cmd, + (mode & FMODE_NDELAY) != 0); + if (error) + return error; ++ ++ if (is_sed_ioctl(cmd)) ++ return sed_ioctl(sdkp->opal_dev, cmd, p); + + /* + * Let the static ioctl translation table take care of it. + */ + if (!sdev->host->hostt->compat_ioctl) + return -ENOIOCTLCMD; +- return sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg); ++ return sdev->host->hostt->compat_ioctl(sdev, cmd, p); + } + #endif + +@@ -2206,8 +2216,10 @@ static int sd_read_protection_type(struct scsi_disk *sdkp, unsigned char *buffer + u8 type; + int ret = 0; + +- if (scsi_device_protection(sdp) == 0 || (buffer[12] & 1) == 0) ++ if (scsi_device_protection(sdp) == 0 || (buffer[12] & 1) == 0) { ++ sdkp->protection_type = 0; + return ret; ++ } + + type = ((buffer[12] >> 1) & 7) + 1; /* P_TYPE 0 = Type 1 */ + +diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c +index d19331b66222..7b739c449227 100644 +--- a/drivers/spi/spi-atmel.c ++++ b/drivers/spi/spi-atmel.c +@@ -301,7 +301,6 @@ struct atmel_spi { + bool use_cs_gpios; + + bool keep_cs; +- bool cs_active; + + u32 fifo_size; + }; +@@ -1338,11 +1337,9 @@ static int atmel_spi_one_transfer(struct spi_master *master, + &msg->transfers)) { + as->keep_cs = true; + } else { +- as->cs_active = !as->cs_active; +- if (as->cs_active) +- cs_activate(as, msg->spi); +- else +- cs_deactivate(as, msg->spi); ++ cs_deactivate(as, msg->spi); ++ udelay(10); ++ cs_activate(as, msg->spi); + } + } + +@@ -1365,7 +1362,6 @@ static int atmel_spi_transfer_one_message(struct spi_master *master, + atmel_spi_lock(as); + cs_activate(as, spi); + +- as->cs_active = true; + as->keep_cs = false; + + msg->status = 0; +diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c +index aae68230fb7b..a81a5be0cf7a 100644 +--- a/drivers/tty/serial/imx.c ++++ b/drivers/tty/serial/imx.c +@@ -542,7 +542,7 @@ static void imx_dma_tx(struct imx_port *sport) + dev_err(dev, "DMA mapping error for TX.\n"); + return; + } +- desc = dmaengine_prep_slave_sg(chan, sgl, sport->dma_tx_nents, ++ desc = dmaengine_prep_slave_sg(chan, sgl, ret, + DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT); + if (!desc) { + dma_unmap_sg(dev, sgl, sport->dma_tx_nents, +diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c +index d9123f995705..15ddcbd1f9d2 100644 +--- a/drivers/tty/serial/pch_uart.c ++++ b/drivers/tty/serial/pch_uart.c +@@ -247,6 +247,7 @@ struct eg20t_port { + struct dma_chan *chan_rx; + struct scatterlist *sg_tx_p; + int nent; ++ int orig_nent; + struct scatterlist sg_rx; + int tx_dma_use; + void *rx_buf_virt; +@@ -801,9 +802,10 @@ static void pch_dma_tx_complete(void *arg) + } + xmit->tail &= UART_XMIT_SIZE - 1; + async_tx_ack(priv->desc_tx); +- dma_unmap_sg(port->dev, sg, priv->nent, DMA_TO_DEVICE); ++ dma_unmap_sg(port->dev, sg, priv->orig_nent, DMA_TO_DEVICE); + priv->tx_dma_use = 0; + priv->nent = 0; ++ priv->orig_nent = 0; + kfree(priv->sg_tx_p); + pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); + } +@@ -1027,6 +1029,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) + dev_err(priv->port.dev, "%s:dma_map_sg Failed\n", __func__); + return 0; + } ++ priv->orig_nent = num; + priv->nent = nent; + + for (i = 0; i < nent; i++, sg++) { +diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c +index bf654d48eb46..97be32da857a 100644 +--- a/fs/btrfs/file.c ++++ b/fs/btrfs/file.c +@@ -1890,9 +1890,10 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb, + (iocb->ki_flags & IOCB_NOWAIT)) + return -EOPNOTSUPP; + +- if (!inode_trylock(inode)) { +- if (iocb->ki_flags & IOCB_NOWAIT) ++ if (iocb->ki_flags & IOCB_NOWAIT) { ++ if (!inode_trylock(inode)) + return -EAGAIN; ++ } else { + inode_lock(inode); + } + +diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c +index 2c809233084b..e270812927cf 100644 +--- a/fs/cifs/smb2file.c ++++ b/fs/cifs/smb2file.c +@@ -69,7 +69,7 @@ smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, + goto out; + + +- if (oparms->tcon->use_resilient) { ++ if (oparms->tcon->use_resilient) { + nr_ioctl_req.Timeout = 0; /* use server default (120 seconds) */ + nr_ioctl_req.Reserved = 0; + rc = SMB2_ioctl(xid, oparms->tcon, fid->persistent_fid, +diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c +index 0e1c36c92f60..4eb0a9e7194b 100644 +--- a/fs/cifs/smb2pdu.c ++++ b/fs/cifs/smb2pdu.c +@@ -575,6 +575,7 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses) + } else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) { + /* ops set to 3.0 by default for default so update */ + ses->server->ops = &smb21_operations; ++ ses->server->vals = &smb21_values; + } + } else if (le16_to_cpu(rsp->DialectRevision) != + ses->server->vals->protocol_id) { +diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c +index ac3fa4bbed2d..afe7dcfff036 100644 +--- a/fs/f2fs/data.c ++++ b/fs/f2fs/data.c +@@ -1512,7 +1512,7 @@ static int __write_data_page(struct page *page, bool *submitted, + loff_t i_size = i_size_read(inode); + const pgoff_t end_index = ((unsigned long long) i_size) + >> PAGE_SHIFT; +- loff_t psize = (page->index + 1) << PAGE_SHIFT; ++ loff_t psize = (loff_t)(page->index + 1) << PAGE_SHIFT; + unsigned offset = 0; + bool need_balance_fs = false; + int err = 0; +diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c +index a90173b856f6..d98acc20a38a 100644 +--- a/fs/f2fs/file.c ++++ b/fs/f2fs/file.c +@@ -1059,7 +1059,7 @@ static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode, + } + dn.ofs_in_node++; + i++; +- new_size = (dst + i) << PAGE_SHIFT; ++ new_size = (loff_t)(dst + i) << PAGE_SHIFT; + if (dst_inode->i_size < new_size) + f2fs_i_size_write(dst_inode, new_size); + } while (--ilen && (do_replace[i] || blkaddr[i] == NULL_ADDR)); +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c +index f1526f65cc58..3dd403943b07 100644 +--- a/fs/nfs/nfs4proc.c ++++ b/fs/nfs/nfs4proc.c +@@ -5797,8 +5797,10 @@ static void nfs4_delegreturn_prepare(struct rpc_task *task, void *data) + + d_data = (struct nfs4_delegreturndata *)data; + +- if (!d_data->lr.roc && nfs4_wait_on_layoutreturn(d_data->inode, task)) ++ if (!d_data->lr.roc && nfs4_wait_on_layoutreturn(d_data->inode, task)) { ++ nfs4_sequence_done(task, &d_data->res.seq_res); + return; ++ } + + nfs4_setup_sequence(d_data->res.server->nfs_client, + &d_data->args.seq_args, +diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c +index 2459ae9d2234..39bb80fb2934 100644 +--- a/fs/ocfs2/journal.c ++++ b/fs/ocfs2/journal.c +@@ -1080,6 +1080,14 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local, int replayed) + + ocfs2_clear_journal_error(osb->sb, journal->j_journal, osb->slot_num); + ++ if (replayed) { ++ jbd2_journal_lock_updates(journal->j_journal); ++ status = jbd2_journal_flush(journal->j_journal); ++ jbd2_journal_unlock_updates(journal->j_journal); ++ if (status < 0) ++ mlog_errno(status); ++ } ++ + status = ocfs2_journal_toggle_dirty(osb, 1, replayed); + if (status < 0) { + mlog_errno(status); +diff --git a/include/linux/poll.h b/include/linux/poll.h +index d384f12abdd5..c7acd7c09747 100644 +--- a/include/linux/poll.h ++++ b/include/linux/poll.h +@@ -15,7 +15,11 @@ + extern struct ctl_table epoll_table[]; /* for sysctl */ + /* ~832 bytes of stack space used max in sys_select/sys_poll before allocating + additional memory. */ ++#ifdef __clang__ ++#define MAX_STACK_ALLOC 768 ++#else + #define MAX_STACK_ALLOC 832 ++#endif + #define FRONTEND_STACK_ALLOC 256 + #define SELECT_STACK_ALLOC FRONTEND_STACK_ALLOC + #define POLL_STACK_ALLOC FRONTEND_STACK_ALLOC +diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h +index ea0ed58db97e..a4c8e9d7dd06 100644 +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -4479,6 +4479,17 @@ static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len) + const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type, + const u8 *ies, int len); + ++/** ++ * cfg80211_send_layer2_update - send layer 2 update frame ++ * ++ * @dev: network device ++ * @addr: STA MAC address ++ * ++ * Wireless drivers can use this function to update forwarding tables in bridge ++ * devices upon STA association. ++ */ ++void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr); ++ + /** + * DOC: Regulatory enforcement infrastructure + * +diff --git a/net/core/ethtool.c b/net/core/ethtool.c +index 7822defa5a5d..749d48393d06 100644 +--- a/net/core/ethtool.c ++++ b/net/core/ethtool.c +@@ -2343,9 +2343,10 @@ static int ethtool_set_tunable(struct net_device *dev, void __user *useraddr) + return ret; + } + +-static int ethtool_get_per_queue_coalesce(struct net_device *dev, +- void __user *useraddr, +- struct ethtool_per_queue_op *per_queue_opt) ++static noinline_for_stack int ++ethtool_get_per_queue_coalesce(struct net_device *dev, ++ void __user *useraddr, ++ struct ethtool_per_queue_op *per_queue_opt) + { + u32 bit; + int ret; +@@ -2375,9 +2376,10 @@ static int ethtool_get_per_queue_coalesce(struct net_device *dev, + return 0; + } + +-static int ethtool_set_per_queue_coalesce(struct net_device *dev, +- void __user *useraddr, +- struct ethtool_per_queue_op *per_queue_opt) ++static noinline_for_stack int ++ethtool_set_per_queue_coalesce(struct net_device *dev, ++ void __user *useraddr, ++ struct ethtool_per_queue_op *per_queue_opt) + { + u32 bit; + int i, ret = 0; +@@ -2434,7 +2436,7 @@ roll_back: + return ret; + } + +-static int ethtool_set_per_queue(struct net_device *dev, ++static int noinline_for_stack ethtool_set_per_queue(struct net_device *dev, + void __user *useraddr, u32 sub_cmd) + { + struct ethtool_per_queue_op per_queue_opt; +diff --git a/net/dccp/feat.c b/net/dccp/feat.c +index f227f002c73d..db87d9f58019 100644 +--- a/net/dccp/feat.c ++++ b/net/dccp/feat.c +@@ -738,7 +738,12 @@ static int __feat_register_sp(struct list_head *fn, u8 feat, u8 is_local, + if (dccp_feat_clone_sp_val(&fval, sp_val, sp_len)) + return -ENOMEM; + +- return dccp_feat_push_change(fn, feat, is_local, mandatory, &fval); ++ if (dccp_feat_push_change(fn, feat, is_local, mandatory, &fval)) { ++ kfree(fval.sp.vec); ++ return -ENOMEM; ++ } ++ ++ return 0; + } + + /** +diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c +index cfe20f15f618..c962c406d7b1 100644 +--- a/net/hsr/hsr_device.c ++++ b/net/hsr/hsr_device.c +@@ -281,6 +281,8 @@ static void send_hsr_supervision_frame(struct hsr_port *master, + skb->dev->dev_addr, skb->len) <= 0) + goto out; + skb_reset_mac_header(skb); ++ skb_reset_network_header(skb); ++ skb_reset_transport_header(skb); + + if (hsrVer > 0) { + hsr_tag = skb_put(skb, sizeof(struct hsr_tag)); +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c +index 8168c667d91d..d437007b15bb 100644 +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -1089,50 +1089,6 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev) + return 0; + } + +-/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ +-struct iapp_layer2_update { +- u8 da[ETH_ALEN]; /* broadcast */ +- u8 sa[ETH_ALEN]; /* STA addr */ +- __be16 len; /* 6 */ +- u8 dsap; /* 0 */ +- u8 ssap; /* 0 */ +- u8 control; +- u8 xid_info[3]; +-} __packed; +- +-static void ieee80211_send_layer2_update(struct sta_info *sta) +-{ +- struct iapp_layer2_update *msg; +- struct sk_buff *skb; +- +- /* Send Level 2 Update Frame to update forwarding tables in layer 2 +- * bridge devices */ +- +- skb = dev_alloc_skb(sizeof(*msg)); +- if (!skb) +- return; +- msg = skb_put(skb, sizeof(*msg)); +- +- /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) +- * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ +- +- eth_broadcast_addr(msg->da); +- memcpy(msg->sa, sta->sta.addr, ETH_ALEN); +- msg->len = htons(6); +- msg->dsap = 0; +- msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */ +- msg->control = 0xaf; /* XID response lsb.1111F101. +- * F=0 (no poll command; unsolicited frame) */ +- msg->xid_info[0] = 0x81; /* XID format identifier */ +- msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */ +- msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */ +- +- skb->dev = sta->sdata->dev; +- skb->protocol = eth_type_trans(skb, sta->sdata->dev); +- memset(skb->cb, 0, sizeof(skb->cb)); +- netif_rx_ni(skb); +-} +- + static int sta_apply_auth_flags(struct ieee80211_local *local, + struct sta_info *sta, + u32 mask, u32 set) +@@ -1442,7 +1398,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, + struct sta_info *sta; + struct ieee80211_sub_if_data *sdata; + int err; +- int layer2_update; + + if (params->vlan) { + sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); +@@ -1486,18 +1441,12 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, + test_sta_flag(sta, WLAN_STA_ASSOC)) + rate_control_rate_init(sta); + +- layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN || +- sdata->vif.type == NL80211_IFTYPE_AP; +- + err = sta_info_insert_rcu(sta); + if (err) { + rcu_read_unlock(); + return err; + } + +- if (layer2_update) +- ieee80211_send_layer2_update(sta); +- + rcu_read_unlock(); + + return 0; +@@ -1595,10 +1544,11 @@ static int ieee80211_change_station(struct wiphy *wiphy, + sta->sdata = vlansdata; + ieee80211_check_fast_xmit(sta); + +- if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) ++ if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) { + ieee80211_vif_inc_num_mcast(sta->sdata); +- +- ieee80211_send_layer2_update(sta); ++ cfg80211_send_layer2_update(sta->sdata->dev, ++ sta->sta.addr); ++ } + } + + err = sta_apply_parameters(local, sta, params); +diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c +index 1a86974b02e3..627dc642f894 100644 +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -1899,6 +1899,10 @@ int sta_info_move_state(struct sta_info *sta, + ieee80211_check_fast_xmit(sta); + ieee80211_check_fast_rx(sta); + } ++ if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN || ++ sta->sdata->vif.type == NL80211_IFTYPE_AP) ++ cfg80211_send_layer2_update(sta->sdata->dev, ++ sta->sta.addr); + break; + default: + break; +diff --git a/net/socket.c b/net/socket.c +index 5b134a6b6216..6a5ec658fcd8 100644 +--- a/net/socket.c ++++ b/net/socket.c +@@ -3267,6 +3267,7 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, + case SIOCSARP: + case SIOCGARP: + case SIOCDARP: ++ case SIOCOUTQNSD: + case SIOCATMARK: + return sock_do_ioctl(net, sock, cmd, arg); + } +diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c +index 2aaf46599126..c5e991d14888 100644 +--- a/net/sunrpc/xprtrdma/verbs.c ++++ b/net/sunrpc/xprtrdma/verbs.c +@@ -264,6 +264,7 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event) + ia->ri_device->name, + sap, rpc_get_port(sap)); + #endif ++ init_completion(&ia->ri_remove_done); + set_bit(RPCRDMA_IAF_REMOVING, &ia->ri_flags); + ep->rep_connected = -ENODEV; + xprt_force_disconnect(&xprt->rx_xprt); +@@ -319,7 +320,6 @@ rpcrdma_create_id(struct rpcrdma_xprt *xprt, + int rc; + + init_completion(&ia->ri_done); +- init_completion(&ia->ri_remove_done); + + id = rdma_create_id(&init_net, rpcrdma_conn_upcall, xprt, RDMA_PS_TCP, + IB_QPT_RC); +diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c +index 99f581a61cfa..091e93798eac 100644 +--- a/net/unix/af_unix.c ++++ b/net/unix/af_unix.c +@@ -644,6 +644,9 @@ static unsigned int unix_poll(struct file *, struct socket *, poll_table *); + static unsigned int unix_dgram_poll(struct file *, struct socket *, + poll_table *); + static int unix_ioctl(struct socket *, unsigned int, unsigned long); ++#ifdef CONFIG_COMPAT ++static int unix_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); ++#endif + static int unix_shutdown(struct socket *, int); + static int unix_stream_sendmsg(struct socket *, struct msghdr *, size_t); + static int unix_stream_recvmsg(struct socket *, struct msghdr *, size_t, int); +@@ -685,6 +688,9 @@ static const struct proto_ops unix_stream_ops = { + .getname = unix_getname, + .poll = unix_poll, + .ioctl = unix_ioctl, ++#ifdef CONFIG_COMPAT ++ .compat_ioctl = unix_compat_ioctl, ++#endif + .listen = unix_listen, + .shutdown = unix_shutdown, + .setsockopt = sock_no_setsockopt, +@@ -708,6 +714,9 @@ static const struct proto_ops unix_dgram_ops = { + .getname = unix_getname, + .poll = unix_dgram_poll, + .ioctl = unix_ioctl, ++#ifdef CONFIG_COMPAT ++ .compat_ioctl = unix_compat_ioctl, ++#endif + .listen = sock_no_listen, + .shutdown = unix_shutdown, + .setsockopt = sock_no_setsockopt, +@@ -730,6 +739,9 @@ static const struct proto_ops unix_seqpacket_ops = { + .getname = unix_getname, + .poll = unix_dgram_poll, + .ioctl = unix_ioctl, ++#ifdef CONFIG_COMPAT ++ .compat_ioctl = unix_compat_ioctl, ++#endif + .listen = unix_listen, + .shutdown = unix_shutdown, + .setsockopt = sock_no_setsockopt, +@@ -2650,6 +2662,13 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) + return err; + } + ++#ifdef CONFIG_COMPAT ++static int unix_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ++{ ++ return unix_ioctl(sock, cmd, (unsigned long)compat_ptr(arg)); ++} ++#endif ++ + static unsigned int unix_poll(struct file *file, struct socket *sock, poll_table *wait) + { + struct sock *sk = sock->sk; +diff --git a/net/wireless/util.c b/net/wireless/util.c +index 0f6c34ff9b55..2234817f5dbb 100644 +--- a/net/wireless/util.c ++++ b/net/wireless/util.c +@@ -1873,3 +1873,48 @@ EXPORT_SYMBOL(rfc1042_header); + const unsigned char bridge_tunnel_header[] __aligned(2) = + { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; + EXPORT_SYMBOL(bridge_tunnel_header); ++ ++/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ ++struct iapp_layer2_update { ++ u8 da[ETH_ALEN]; /* broadcast */ ++ u8 sa[ETH_ALEN]; /* STA addr */ ++ __be16 len; /* 6 */ ++ u8 dsap; /* 0 */ ++ u8 ssap; /* 0 */ ++ u8 control; ++ u8 xid_info[3]; ++} __packed; ++ ++void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr) ++{ ++ struct iapp_layer2_update *msg; ++ struct sk_buff *skb; ++ ++ /* Send Level 2 Update Frame to update forwarding tables in layer 2 ++ * bridge devices */ ++ ++ skb = dev_alloc_skb(sizeof(*msg)); ++ if (!skb) ++ return; ++ msg = skb_put(skb, sizeof(*msg)); ++ ++ /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) ++ * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ ++ ++ eth_broadcast_addr(msg->da); ++ ether_addr_copy(msg->sa, addr); ++ msg->len = htons(6); ++ msg->dsap = 0; ++ msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */ ++ msg->control = 0xaf; /* XID response lsb.1111F101. ++ * F=0 (no poll command; unsolicited frame) */ ++ msg->xid_info[0] = 0x81; /* XID format identifier */ ++ msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */ ++ msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */ ++ ++ skb->dev = dev; ++ skb->protocol = eth_type_trans(skb, dev); ++ memset(skb->cb, 0, sizeof(skb->cb)); ++ netif_rx_ni(skb); ++} ++EXPORT_SYMBOL(cfg80211_send_layer2_update); +diff --git a/sound/soc/stm/stm32_spdifrx.c b/sound/soc/stm/stm32_spdifrx.c +index 84cc5678beba..7bc57651e186 100644 +--- a/sound/soc/stm/stm32_spdifrx.c ++++ b/sound/soc/stm/stm32_spdifrx.c +@@ -213,6 +213,7 @@ + * @slave_config: dma slave channel runtime config pointer + * @phys_addr: SPDIFRX registers physical base address + * @lock: synchronization enabling lock ++ * @irq_lock: prevent race condition with IRQ on stream state + * @cs: channel status buffer + * @ub: user data buffer + * @irq: SPDIFRX interrupt line +@@ -233,6 +234,7 @@ struct stm32_spdifrx_data { + struct dma_slave_config slave_config; + dma_addr_t phys_addr; + spinlock_t lock; /* Sync enabling lock */ ++ spinlock_t irq_lock; /* Prevent race condition on stream state */ + unsigned char cs[SPDIFRX_CS_BYTES_NB]; + unsigned char ub[SPDIFRX_UB_BYTES_NB]; + int irq; +@@ -313,6 +315,7 @@ static void stm32_spdifrx_dma_ctrl_stop(struct stm32_spdifrx_data *spdifrx) + static int stm32_spdifrx_start_sync(struct stm32_spdifrx_data *spdifrx) + { + int cr, cr_mask, imr, ret; ++ unsigned long flags; + + /* Enable IRQs */ + imr = SPDIFRX_IMR_IFEIE | SPDIFRX_IMR_SYNCDIE | SPDIFRX_IMR_PERRIE; +@@ -320,7 +323,7 @@ static int stm32_spdifrx_start_sync(struct stm32_spdifrx_data *spdifrx) + if (ret) + return ret; + +- spin_lock(&spdifrx->lock); ++ spin_lock_irqsave(&spdifrx->lock, flags); + + spdifrx->refcount++; + +@@ -353,7 +356,7 @@ static int stm32_spdifrx_start_sync(struct stm32_spdifrx_data *spdifrx) + "Failed to start synchronization\n"); + } + +- spin_unlock(&spdifrx->lock); ++ spin_unlock_irqrestore(&spdifrx->lock, flags); + + return ret; + } +@@ -361,11 +364,12 @@ static int stm32_spdifrx_start_sync(struct stm32_spdifrx_data *spdifrx) + static void stm32_spdifrx_stop(struct stm32_spdifrx_data *spdifrx) + { + int cr, cr_mask, reg; ++ unsigned long flags; + +- spin_lock(&spdifrx->lock); ++ spin_lock_irqsave(&spdifrx->lock, flags); + + if (--spdifrx->refcount) { +- spin_unlock(&spdifrx->lock); ++ spin_unlock_irqrestore(&spdifrx->lock, flags); + return; + } + +@@ -384,7 +388,7 @@ static void stm32_spdifrx_stop(struct stm32_spdifrx_data *spdifrx) + regmap_read(spdifrx->regmap, STM32_SPDIFRX_DR, ®); + regmap_read(spdifrx->regmap, STM32_SPDIFRX_CSR, ®); + +- spin_unlock(&spdifrx->lock); ++ spin_unlock_irqrestore(&spdifrx->lock, flags); + } + + static int stm32_spdifrx_dma_ctrl_register(struct device *dev, +@@ -644,7 +648,6 @@ static const struct regmap_config stm32_h7_spdifrx_regmap_conf = { + static irqreturn_t stm32_spdifrx_isr(int irq, void *devid) + { + struct stm32_spdifrx_data *spdifrx = (struct stm32_spdifrx_data *)devid; +- struct snd_pcm_substream *substream = spdifrx->substream; + struct platform_device *pdev = spdifrx->pdev; + unsigned int cr, mask, sr, imr; + unsigned int flags; +@@ -712,14 +715,19 @@ static irqreturn_t stm32_spdifrx_isr(int irq, void *devid) + regmap_update_bits(spdifrx->regmap, STM32_SPDIFRX_CR, + SPDIFRX_CR_SPDIFEN_MASK, cr); + +- if (substream) +- snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED); ++ spin_lock(&spdifrx->irq_lock); ++ if (spdifrx->substream) ++ snd_pcm_stop(spdifrx->substream, ++ SNDRV_PCM_STATE_DISCONNECTED); ++ spin_unlock(&spdifrx->irq_lock); + + return IRQ_HANDLED; + } + +- if (err_xrun && substream) +- snd_pcm_stop_xrun(substream); ++ spin_lock(&spdifrx->irq_lock); ++ if (err_xrun && spdifrx->substream) ++ snd_pcm_stop_xrun(spdifrx->substream); ++ spin_unlock(&spdifrx->irq_lock); + + return IRQ_HANDLED; + } +@@ -728,9 +736,12 @@ static int stm32_spdifrx_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *cpu_dai) + { + struct stm32_spdifrx_data *spdifrx = snd_soc_dai_get_drvdata(cpu_dai); ++ unsigned long flags; + int ret; + ++ spin_lock_irqsave(&spdifrx->irq_lock, flags); + spdifrx->substream = substream; ++ spin_unlock_irqrestore(&spdifrx->irq_lock, flags); + + ret = clk_prepare_enable(spdifrx->kclk); + if (ret) +@@ -802,8 +813,12 @@ static void stm32_spdifrx_shutdown(struct snd_pcm_substream *substream, + struct snd_soc_dai *cpu_dai) + { + struct stm32_spdifrx_data *spdifrx = snd_soc_dai_get_drvdata(cpu_dai); ++ unsigned long flags; + ++ spin_lock_irqsave(&spdifrx->irq_lock, flags); + spdifrx->substream = NULL; ++ spin_unlock_irqrestore(&spdifrx->irq_lock, flags); ++ + clk_disable_unprepare(spdifrx->kclk); + } + +@@ -908,6 +923,7 @@ static int stm32_spdifrx_probe(struct platform_device *pdev) + spdifrx->pdev = pdev; + init_completion(&spdifrx->cs_completion); + spin_lock_init(&spdifrx->lock); ++ spin_lock_init(&spdifrx->irq_lock); + + platform_set_drvdata(pdev, spdifrx); + +diff --git a/tools/testing/selftests/rseq/settings b/tools/testing/selftests/rseq/settings +new file mode 100644 +index 000000000000..e7b9417537fb +--- /dev/null ++++ b/tools/testing/selftests/rseq/settings +@@ -0,0 +1 @@ ++timeout=0 diff --git a/patch/kernel/odroidxu4-legacy/patch-4.14.166-167.patch b/patch/kernel/odroidxu4-legacy/patch-4.14.166-167.patch new file mode 100644 index 000000000..179628e2d --- /dev/null +++ b/patch/kernel/odroidxu4-legacy/patch-4.14.166-167.patch @@ -0,0 +1,2219 @@ +diff --git a/Makefile b/Makefile +index 7c62b4078c1b..3e8eaabf2bcb 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 4 + PATCHLEVEL = 14 +-SUBLEVEL = 166 ++SUBLEVEL = 167 + EXTRAVERSION = + NAME = Petit Gorille + +diff --git a/arch/arm/boot/dts/am571x-idk.dts b/arch/arm/boot/dts/am571x-idk.dts +index debf9464403e..96a4df4109d7 100644 +--- a/arch/arm/boot/dts/am571x-idk.dts ++++ b/arch/arm/boot/dts/am571x-idk.dts +@@ -93,7 +93,7 @@ + + &pcie1_rc { + status = "okay"; +- gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; ++ gpios = <&gpio5 18 GPIO_ACTIVE_HIGH>; + }; + + &pcie1_ep { +diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +index e79f3defe002..c2ad4f97cef0 100644 +--- a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi ++++ b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +@@ -56,10 +56,10 @@ + + pmu { + compatible = "arm,armv8-pmuv3"; +- interrupts = <0 120 8>, +- <0 121 8>, +- <0 122 8>, +- <0 123 8>; ++ interrupts = <0 170 4>, ++ <0 171 4>, ++ <0 172 4>, ++ <0 173 4>; + interrupt-affinity = <&cpu0>, + <&cpu1>, + <&cpu2>, +diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts +index fb5db5f33e8c..ce4a116382bf 100644 +--- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts ++++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-khadas-vim.dts +@@ -33,11 +33,9 @@ + + gpio-keys-polled { + compatible = "gpio-keys-polled"; +- #address-cells = <1>; +- #size-cells = <0>; + poll-interval = <100>; + +- button@0 { ++ power-button { + label = "power"; + linux,code = ; + gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>; +diff --git a/arch/arm64/boot/dts/arm/juno-base.dtsi b/arch/arm64/boot/dts/arm/juno-base.dtsi +index f165f04db0c9..13ee8ffa9bbf 100644 +--- a/arch/arm64/boot/dts/arm/juno-base.dtsi ++++ b/arch/arm64/boot/dts/arm/juno-base.dtsi +@@ -5,7 +5,6 @@ + /* + * Devices shared by all Juno boards + */ +- dma-ranges = <0 0 0 0 0x100 0>; + + memtimer: timer@2a810000 { + compatible = "arm,armv7-timer-mem"; +diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S +index 4b3d92a37c80..39fdede523f2 100644 +--- a/arch/x86/boot/compressed/head_64.S ++++ b/arch/x86/boot/compressed/head_64.S +@@ -227,6 +227,11 @@ ENTRY(efi32_stub_entry) + leal efi32_config(%ebp), %eax + movl %eax, efi_config(%ebp) + ++ /* Disable paging */ ++ movl %cr0, %eax ++ btrl $X86_CR0_PG_BIT, %eax ++ movl %eax, %cr0 ++ + jmp startup_32 + ENDPROC(efi32_stub_entry) + #endif +diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c +index 665d0f6cd62f..3f731d7f04bf 100644 +--- a/arch/x86/kernel/cpu/intel_rdt.c ++++ b/arch/x86/kernel/cpu/intel_rdt.c +@@ -526,7 +526,7 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r) + if (static_branch_unlikely(&rdt_mon_enable_key)) + rmdir_mondata_subdir_allrdtgrp(r, d->id); + list_del(&d->list); +- if (is_mbm_enabled()) ++ if (r->mon_capable && is_mbm_enabled()) + cancel_delayed_work(&d->mbm_over); + if (is_llc_occupancy_enabled() && has_busy_rmid(r, d)) { + /* +diff --git a/block/blk-settings.c b/block/blk-settings.c +index 474b0b95fcd1..6c2faaa38cc1 100644 +--- a/block/blk-settings.c ++++ b/block/blk-settings.c +@@ -379,7 +379,7 @@ EXPORT_SYMBOL(blk_queue_max_segment_size); + * storage device can address. The default of 512 covers most + * hardware. + **/ +-void blk_queue_logical_block_size(struct request_queue *q, unsigned short size) ++void blk_queue_logical_block_size(struct request_queue *q, unsigned int size) + { + q->limits.logical_block_size = size; + +diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c +index 32ac5f551e55..e6887714fe0a 100644 +--- a/drivers/block/xen-blkfront.c ++++ b/drivers/block/xen-blkfront.c +@@ -1115,8 +1115,8 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity, + if (!VDEV_IS_EXTENDED(info->vdevice)) { + err = xen_translate_vdev(info->vdevice, &minor, &offset); + if (err) +- return err; +- nr_parts = PARTS_PER_DISK; ++ return err; ++ nr_parts = PARTS_PER_DISK; + } else { + minor = BLKIF_MINOR_EXT(info->vdevice); + nr_parts = PARTS_PER_EXT_DISK; +diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c +index a3f52f678211..8341a128dab1 100644 +--- a/drivers/clk/clk.c ++++ b/drivers/clk/clk.c +@@ -2482,11 +2482,17 @@ static int __clk_core_init(struct clk_core *core) + if (core->flags & CLK_IS_CRITICAL) { + unsigned long flags; + +- clk_core_prepare(core); ++ ret = clk_core_prepare(core); ++ if (ret) ++ goto out; + + flags = clk_enable_lock(); +- clk_core_enable(core); ++ ret = clk_core_enable(core); + clk_enable_unlock(flags); ++ if (ret) { ++ clk_core_unprepare(core); ++ goto out; ++ } + } + + /* +diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c +index d50125766093..c3badf634378 100644 +--- a/drivers/iio/industrialio-buffer.c ++++ b/drivers/iio/industrialio-buffer.c +@@ -570,7 +570,7 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev, + const unsigned long *mask, bool timestamp) + { + unsigned bytes = 0; +- int length, i; ++ int length, i, largest = 0; + + /* How much space will the demuxed element take? */ + for_each_set_bit(i, mask, +@@ -578,13 +578,17 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev, + length = iio_storage_bytes_for_si(indio_dev, i); + bytes = ALIGN(bytes, length); + bytes += length; ++ largest = max(largest, length); + } + + if (timestamp) { + length = iio_storage_bytes_for_timestamp(indio_dev); + bytes = ALIGN(bytes, length); + bytes += length; ++ largest = max(largest, length); + } ++ ++ bytes = ALIGN(bytes, largest); + return bytes; + } + +diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c +index c5534d294773..00025569e807 100644 +--- a/drivers/md/dm-snap-persistent.c ++++ b/drivers/md/dm-snap-persistent.c +@@ -17,7 +17,7 @@ + #include "dm-bufio.h" + + #define DM_MSG_PREFIX "persistent snapshot" +-#define DM_CHUNK_SIZE_DEFAULT_SECTORS 32 /* 16KB */ ++#define DM_CHUNK_SIZE_DEFAULT_SECTORS 32U /* 16KB */ + + #define DM_PREFETCH_CHUNKS 12 + +diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c +index 204adde004a3..cdafa5e0ea6d 100644 +--- a/drivers/md/raid0.c ++++ b/drivers/md/raid0.c +@@ -94,7 +94,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) + char b[BDEVNAME_SIZE]; + char b2[BDEVNAME_SIZE]; + struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL); +- unsigned short blksize = 512; ++ unsigned blksize = 512; + + *private_conf = ERR_PTR(-ENOMEM); + if (!conf) +diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c +index cf6ce9f600ca..f9b2e652c399 100644 +--- a/drivers/message/fusion/mptctl.c ++++ b/drivers/message/fusion/mptctl.c +@@ -100,19 +100,19 @@ struct buflist { + * Function prototypes. Called from OS entry point mptctl_ioctl. + * arg contents specific to function. + */ +-static int mptctl_fw_download(unsigned long arg); +-static int mptctl_getiocinfo(unsigned long arg, unsigned int cmd); +-static int mptctl_gettargetinfo(unsigned long arg); +-static int mptctl_readtest(unsigned long arg); +-static int mptctl_mpt_command(unsigned long arg); +-static int mptctl_eventquery(unsigned long arg); +-static int mptctl_eventenable(unsigned long arg); +-static int mptctl_eventreport(unsigned long arg); +-static int mptctl_replace_fw(unsigned long arg); +- +-static int mptctl_do_reset(unsigned long arg); +-static int mptctl_hp_hostinfo(unsigned long arg, unsigned int cmd); +-static int mptctl_hp_targetinfo(unsigned long arg); ++static int mptctl_fw_download(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_getiocinfo(MPT_ADAPTER *iocp, unsigned long arg, unsigned int cmd); ++static int mptctl_gettargetinfo(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_readtest(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_mpt_command(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_eventquery(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_eventenable(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_eventreport(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_replace_fw(MPT_ADAPTER *iocp, unsigned long arg); ++ ++static int mptctl_do_reset(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_hp_hostinfo(MPT_ADAPTER *iocp, unsigned long arg, unsigned int cmd); ++static int mptctl_hp_targetinfo(MPT_ADAPTER *iocp, unsigned long arg); + + static int mptctl_probe(struct pci_dev *, const struct pci_device_id *); + static void mptctl_remove(struct pci_dev *); +@@ -123,8 +123,8 @@ static long compat_mpctl_ioctl(struct file *f, unsigned cmd, unsigned long arg); + /* + * Private function calls. + */ +-static int mptctl_do_mpt_command(struct mpt_ioctl_command karg, void __user *mfPtr); +-static int mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen); ++static int mptctl_do_mpt_command(MPT_ADAPTER *iocp, struct mpt_ioctl_command karg, void __user *mfPtr); ++static int mptctl_do_fw_download(MPT_ADAPTER *iocp, char __user *ufwbuf, size_t fwlen); + static MptSge_t *kbuf_alloc_2_sgl(int bytes, u32 dir, int sge_offset, int *frags, + struct buflist **blp, dma_addr_t *sglbuf_dma, MPT_ADAPTER *ioc); + static void kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, +@@ -656,19 +656,19 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + * by TM and FW reloads. + */ + if ((cmd & ~IOCSIZE_MASK) == (MPTIOCINFO & ~IOCSIZE_MASK)) { +- return mptctl_getiocinfo(arg, _IOC_SIZE(cmd)); ++ return mptctl_getiocinfo(iocp, arg, _IOC_SIZE(cmd)); + } else if (cmd == MPTTARGETINFO) { +- return mptctl_gettargetinfo(arg); ++ return mptctl_gettargetinfo(iocp, arg); + } else if (cmd == MPTTEST) { +- return mptctl_readtest(arg); ++ return mptctl_readtest(iocp, arg); + } else if (cmd == MPTEVENTQUERY) { +- return mptctl_eventquery(arg); ++ return mptctl_eventquery(iocp, arg); + } else if (cmd == MPTEVENTENABLE) { +- return mptctl_eventenable(arg); ++ return mptctl_eventenable(iocp, arg); + } else if (cmd == MPTEVENTREPORT) { +- return mptctl_eventreport(arg); ++ return mptctl_eventreport(iocp, arg); + } else if (cmd == MPTFWREPLACE) { +- return mptctl_replace_fw(arg); ++ return mptctl_replace_fw(iocp, arg); + } + + /* All of these commands require an interrupt or +@@ -678,15 +678,15 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + return ret; + + if (cmd == MPTFWDOWNLOAD) +- ret = mptctl_fw_download(arg); ++ ret = mptctl_fw_download(iocp, arg); + else if (cmd == MPTCOMMAND) +- ret = mptctl_mpt_command(arg); ++ ret = mptctl_mpt_command(iocp, arg); + else if (cmd == MPTHARDRESET) +- ret = mptctl_do_reset(arg); ++ ret = mptctl_do_reset(iocp, arg); + else if ((cmd & ~IOCSIZE_MASK) == (HP_GETHOSTINFO & ~IOCSIZE_MASK)) +- ret = mptctl_hp_hostinfo(arg, _IOC_SIZE(cmd)); ++ ret = mptctl_hp_hostinfo(iocp, arg, _IOC_SIZE(cmd)); + else if (cmd == HP_GETTARGETINFO) +- ret = mptctl_hp_targetinfo(arg); ++ ret = mptctl_hp_targetinfo(iocp, arg); + else + ret = -EINVAL; + +@@ -705,11 +705,10 @@ mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + return ret; + } + +-static int mptctl_do_reset(unsigned long arg) ++static int mptctl_do_reset(MPT_ADAPTER *iocp, unsigned long arg) + { + struct mpt_ioctl_diag_reset __user *urinfo = (void __user *) arg; + struct mpt_ioctl_diag_reset krinfo; +- MPT_ADAPTER *iocp; + + if (copy_from_user(&krinfo, urinfo, sizeof(struct mpt_ioctl_diag_reset))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_do_reset - " +@@ -718,12 +717,6 @@ static int mptctl_do_reset(unsigned long arg) + return -EFAULT; + } + +- if (mpt_verify_adapter(krinfo.hdr.iocnum, &iocp) < 0) { +- printk(KERN_DEBUG MYNAM "%s@%d::mptctl_do_reset - ioc%d not found!\n", +- __FILE__, __LINE__, krinfo.hdr.iocnum); +- return -ENODEV; /* (-6) No such device or address */ +- } +- + dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "mptctl_do_reset called.\n", + iocp->name)); + +@@ -754,7 +747,7 @@ static int mptctl_do_reset(unsigned long arg) + * -ENOMSG if FW upload returned bad status + */ + static int +-mptctl_fw_download(unsigned long arg) ++mptctl_fw_download(MPT_ADAPTER *iocp, unsigned long arg) + { + struct mpt_fw_xfer __user *ufwdl = (void __user *) arg; + struct mpt_fw_xfer kfwdl; +@@ -766,7 +759,7 @@ mptctl_fw_download(unsigned long arg) + return -EFAULT; + } + +- return mptctl_do_fw_download(kfwdl.iocnum, kfwdl.bufp, kfwdl.fwlen); ++ return mptctl_do_fw_download(iocp, kfwdl.bufp, kfwdl.fwlen); + } + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ +@@ -784,11 +777,10 @@ mptctl_fw_download(unsigned long arg) + * -ENOMSG if FW upload returned bad status + */ + static int +-mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) ++mptctl_do_fw_download(MPT_ADAPTER *iocp, char __user *ufwbuf, size_t fwlen) + { + FWDownload_t *dlmsg; + MPT_FRAME_HDR *mf; +- MPT_ADAPTER *iocp; + FWDownloadTCSGE_t *ptsge; + MptSge_t *sgl, *sgIn; + char *sgOut; +@@ -808,17 +800,10 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) + pFWDownloadReply_t ReplyMsg = NULL; + unsigned long timeleft; + +- if (mpt_verify_adapter(ioc, &iocp) < 0) { +- printk(KERN_DEBUG MYNAM "ioctl_fwdl - ioc%d not found!\n", +- ioc); +- return -ENODEV; /* (-6) No such device or address */ +- } else { +- +- /* Valid device. Get a message frame and construct the FW download message. +- */ +- if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL) +- return -EAGAIN; +- } ++ /* Valid device. Get a message frame and construct the FW download message. ++ */ ++ if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL) ++ return -EAGAIN; + + dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT + "mptctl_do_fwdl called. mptctl_id = %xh.\n", iocp->name, mptctl_id)); +@@ -826,8 +811,6 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) + iocp->name, ufwbuf)); + dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.fwlen = %d\n", + iocp->name, (int)fwlen)); +- dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.ioc = %04xh\n", +- iocp->name, ioc)); + + dlmsg = (FWDownload_t*) mf; + ptsge = (FWDownloadTCSGE_t *) &dlmsg->SGL; +@@ -1238,13 +1221,11 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE + * -ENODEV if no such device/adapter + */ + static int +-mptctl_getiocinfo (unsigned long arg, unsigned int data_size) ++mptctl_getiocinfo (MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size) + { + struct mpt_ioctl_iocinfo __user *uarg = (void __user *) arg; + struct mpt_ioctl_iocinfo *karg; +- MPT_ADAPTER *ioc; + struct pci_dev *pdev; +- int iocnum; + unsigned int port; + int cim_rev; + struct scsi_device *sdev; +@@ -1272,14 +1253,6 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) + return PTR_ERR(karg); + } + +- if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- kfree(karg); +- return -ENODEV; +- } +- + /* Verify the data transfer size is correct. */ + if (karg->hdr.maxDataSize != data_size) { + printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_getiocinfo - " +@@ -1385,15 +1358,13 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) + * -ENODEV if no such device/adapter + */ + static int +-mptctl_gettargetinfo (unsigned long arg) ++mptctl_gettargetinfo (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_targetinfo __user *uarg = (void __user *) arg; + struct mpt_ioctl_targetinfo karg; +- MPT_ADAPTER *ioc; + VirtDevice *vdevice; + char *pmem; + int *pdata; +- int iocnum; + int numDevices = 0; + int lun; + int maxWordsLeft; +@@ -1408,13 +1379,6 @@ mptctl_gettargetinfo (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_gettargetinfo called.\n", + ioc->name)); + /* Get the port number and set the maximum number of bytes +@@ -1510,12 +1474,10 @@ mptctl_gettargetinfo (unsigned long arg) + * -ENODEV if no such device/adapter + */ + static int +-mptctl_readtest (unsigned long arg) ++mptctl_readtest (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_test __user *uarg = (void __user *) arg; + struct mpt_ioctl_test karg; +- MPT_ADAPTER *ioc; +- int iocnum; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_readtest - " +@@ -1524,13 +1486,6 @@ mptctl_readtest (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_readtest() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_readtest called.\n", + ioc->name)); + /* Fill in the data and return the structure to the calling +@@ -1571,12 +1526,10 @@ mptctl_readtest (unsigned long arg) + * -ENODEV if no such device/adapter + */ + static int +-mptctl_eventquery (unsigned long arg) ++mptctl_eventquery (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_eventquery __user *uarg = (void __user *) arg; + struct mpt_ioctl_eventquery karg; +- MPT_ADAPTER *ioc; +- int iocnum; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventquery))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_eventquery - " +@@ -1585,13 +1538,6 @@ mptctl_eventquery (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_eventquery() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventquery called.\n", + ioc->name)); + karg.eventEntries = MPTCTL_EVENT_LOG_SIZE; +@@ -1610,12 +1556,10 @@ mptctl_eventquery (unsigned long arg) + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ + static int +-mptctl_eventenable (unsigned long arg) ++mptctl_eventenable (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_eventenable __user *uarg = (void __user *) arg; + struct mpt_ioctl_eventenable karg; +- MPT_ADAPTER *ioc; +- int iocnum; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_eventenable - " +@@ -1624,13 +1568,6 @@ mptctl_eventenable (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_eventenable() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventenable called.\n", + ioc->name)); + if (ioc->events == NULL) { +@@ -1658,12 +1595,10 @@ mptctl_eventenable (unsigned long arg) + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ + static int +-mptctl_eventreport (unsigned long arg) ++mptctl_eventreport (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_eventreport __user *uarg = (void __user *) arg; + struct mpt_ioctl_eventreport karg; +- MPT_ADAPTER *ioc; +- int iocnum; + int numBytes, maxEvents, max; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventreport))) { +@@ -1673,12 +1608,6 @@ mptctl_eventreport (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_eventreport() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventreport called.\n", + ioc->name)); + +@@ -1712,12 +1641,10 @@ mptctl_eventreport (unsigned long arg) + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ + static int +-mptctl_replace_fw (unsigned long arg) ++mptctl_replace_fw (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_replace_fw __user *uarg = (void __user *) arg; + struct mpt_ioctl_replace_fw karg; +- MPT_ADAPTER *ioc; +- int iocnum; + int newFwSize; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) { +@@ -1727,13 +1654,6 @@ mptctl_replace_fw (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_replace_fw() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_replace_fw called.\n", + ioc->name)); + /* If caching FW, Free the old FW image +@@ -1780,12 +1700,10 @@ mptctl_replace_fw (unsigned long arg) + * -ENOMEM if memory allocation error + */ + static int +-mptctl_mpt_command (unsigned long arg) ++mptctl_mpt_command (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_command __user *uarg = (void __user *) arg; + struct mpt_ioctl_command karg; +- MPT_ADAPTER *ioc; +- int iocnum; + int rc; + + +@@ -1796,14 +1714,7 @@ mptctl_mpt_command (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_mpt_command() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- +- rc = mptctl_do_mpt_command (karg, &uarg->MF); ++ rc = mptctl_do_mpt_command (ioc, karg, &uarg->MF); + + return rc; + } +@@ -1821,9 +1732,8 @@ mptctl_mpt_command (unsigned long arg) + * -EPERM if SCSI I/O and target is untagged + */ + static int +-mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) ++mptctl_do_mpt_command (MPT_ADAPTER *ioc, struct mpt_ioctl_command karg, void __user *mfPtr) + { +- MPT_ADAPTER *ioc; + MPT_FRAME_HDR *mf = NULL; + MPIHeader_t *hdr; + char *psge; +@@ -1832,7 +1742,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) + dma_addr_t dma_addr_in; + dma_addr_t dma_addr_out; + int sgSize = 0; /* Num SG elements */ +- int iocnum, flagsLength; ++ int flagsLength; + int sz, rc = 0; + int msgContext; + u16 req_idx; +@@ -1847,13 +1757,6 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) + bufIn.kptr = bufOut.kptr = NULL; + bufIn.len = bufOut.len = 0; + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + spin_lock_irqsave(&ioc->taskmgmt_lock, flags); + if (ioc->ioc_reset_in_progress) { + spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags); +@@ -2418,17 +2321,15 @@ done_free_mem: + * -ENOMEM if memory allocation error + */ + static int +-mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) ++mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size) + { + hp_host_info_t __user *uarg = (void __user *) arg; +- MPT_ADAPTER *ioc; + struct pci_dev *pdev; + char *pbuf=NULL; + dma_addr_t buf_dma; + hp_host_info_t karg; + CONFIGPARMS cfg; + ConfigPageHeader_t hdr; +- int iocnum; + int rc, cim_rev; + ToolboxIstwiReadWriteRequest_t *IstwiRWRequest; + MPT_FRAME_HDR *mf = NULL; +@@ -2452,12 +2353,6 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": mptctl_hp_hostinfo called.\n", + ioc->name)); + +@@ -2670,15 +2565,13 @@ retry_wait: + * -ENOMEM if memory allocation error + */ + static int +-mptctl_hp_targetinfo(unsigned long arg) ++mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg) + { + hp_target_info_t __user *uarg = (void __user *) arg; + SCSIDevicePage0_t *pg0_alloc; + SCSIDevicePage3_t *pg3_alloc; +- MPT_ADAPTER *ioc; + MPT_SCSI_HOST *hd = NULL; + hp_target_info_t karg; +- int iocnum; + int data_sz; + dma_addr_t page_dma; + CONFIGPARMS cfg; +@@ -2692,12 +2585,6 @@ mptctl_hp_targetinfo(unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } + if (karg.hdr.id >= MPT_MAX_FC_DEVICES) + return -EINVAL; + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_hp_targetinfo called.\n", +@@ -2865,7 +2752,7 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd, + kfw.fwlen = kfw32.fwlen; + kfw.bufp = compat_ptr(kfw32.bufp); + +- ret = mptctl_do_fw_download(kfw.iocnum, kfw.bufp, kfw.fwlen); ++ ret = mptctl_do_fw_download(iocp, kfw.bufp, kfw.fwlen); + + mutex_unlock(&iocp->ioctl_cmds.mutex); + +@@ -2919,7 +2806,7 @@ compat_mpt_command(struct file *filp, unsigned int cmd, + + /* Pass new structure to do_mpt_command + */ +- ret = mptctl_do_mpt_command (karg, &uarg->MF); ++ ret = mptctl_do_mpt_command (iocp, karg, &uarg->MF); + + mutex_unlock(&iocp->ioctl_cmds.mutex); + +diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c +index b681c07b33fb..0733745f4be6 100644 +--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c ++++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c +@@ -669,7 +669,6 @@ static int hns_nic_poll_rx_skb(struct hns_nic_ring_data *ring_data, + skb = *out_skb = napi_alloc_skb(&ring_data->napi, + HNS_RX_HEAD_SIZE); + if (unlikely(!skb)) { +- netdev_err(ndev, "alloc rx skb fail\n"); + ring->stats.sw_err_cnt++; + return -ENOMEM; + } +@@ -1180,7 +1179,6 @@ static int hns_nic_common_poll(struct napi_struct *napi, int budget) + container_of(napi, struct hns_nic_ring_data, napi); + struct hnae_ring *ring = ring_data->ring; + +-try_again: + clean_complete += ring_data->poll_one( + ring_data, budget - clean_complete, + ring_data->ex_process); +@@ -1190,7 +1188,7 @@ try_again: + napi_complete(napi); + ring->q->handle->dev->ops->toggle_ring_irq(ring, 0); + } else { +- goto try_again; ++ return budget; + } + } + +diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h +index efc4a1a8343a..e51b50d94074 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/common.h ++++ b/drivers/net/ethernet/stmicro/stmmac/common.h +@@ -338,9 +338,8 @@ struct dma_features { + unsigned int rx_fifo_size; + }; + +-/* GMAC TX FIFO is 8K, Rx FIFO is 16K */ +-#define BUF_SIZE_16KiB 16384 +-/* RX Buffer size must be < 8191 and multiple of 4/8/16 bytes */ ++/* RX Buffer size must be multiple of 4/8/16 bytes */ ++#define BUF_SIZE_16KiB 16368 + #define BUF_SIZE_8KiB 8188 + #define BUF_SIZE_4KiB 4096 + #define BUF_SIZE_2KiB 2048 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +index e89466bd432d..81d446469a35 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -1043,7 +1043,9 @@ static int stmmac_set_bfsize(int mtu, int bufsize) + { + int ret = bufsize; + +- if (mtu >= BUF_SIZE_4KiB) ++ if (mtu >= BUF_SIZE_8KiB) ++ ret = BUF_SIZE_16KiB; ++ else if (mtu >= BUF_SIZE_4KiB) + ret = BUF_SIZE_8KiB; + else if (mtu >= BUF_SIZE_2KiB) + ret = BUF_SIZE_4KiB; +diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c +index b19557c035f2..aa0bbffe4900 100644 +--- a/drivers/net/hyperv/rndis_filter.c ++++ b/drivers/net/hyperv/rndis_filter.c +@@ -1331,8 +1331,6 @@ void rndis_filter_device_remove(struct hv_device *dev, + /* Halt and release the rndis device */ + rndis_filter_halt_device(rndis_dev); + +- net_dev->extension = NULL; +- + netvsc_device_remove(dev); + } + +diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c +index 2b977655834c..ab539136d5bf 100644 +--- a/drivers/net/macvlan.c ++++ b/drivers/net/macvlan.c +@@ -263,7 +263,7 @@ static void macvlan_broadcast(struct sk_buff *skb, + struct net_device *src, + enum macvlan_mode mode) + { +- const struct ethhdr *eth = skb_eth_hdr(skb); ++ const struct ethhdr *eth = eth_hdr(skb); + const struct macvlan_dev *vlan; + struct sk_buff *nskb; + unsigned int i; +@@ -515,10 +515,11 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev) + const struct macvlan_dev *dest; + + if (vlan->mode == MACVLAN_MODE_BRIDGE) { +- const struct ethhdr *eth = (void *)skb->data; ++ const struct ethhdr *eth = skb_eth_hdr(skb); + + /* send to other bridge ports directly */ + if (is_multicast_ether_addr(eth->h_dest)) { ++ skb_reset_mac_header(skb); + macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE); + goto xmit_world; + } +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c +index c23f35dba718..ee7194a9e231 100644 +--- a/drivers/net/usb/lan78xx.c ++++ b/drivers/net/usb/lan78xx.c +@@ -3612,6 +3612,7 @@ static int lan78xx_probe(struct usb_interface *intf, + + /* MTU range: 68 - 9000 */ + netdev->max_mtu = MAX_SINGLE_PACKET_SIZE; ++ netif_set_gso_max_size(netdev, MAX_SINGLE_PACKET_SIZE - MAX_HEADER); + + dev->ep_blkin = (intf->cur_altsetting)->endpoint + 0; + dev->ep_blkout = (intf->cur_altsetting)->endpoint + 1; +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c +index 6a86a03c5e95..0083c60f5cdf 100644 +--- a/drivers/net/usb/r8152.c ++++ b/drivers/net/usb/r8152.c +@@ -5158,6 +5158,9 @@ static int rtl8152_probe(struct usb_interface *intf, + return -ENODEV; + } + ++ if (intf->cur_altsetting->desc.bNumEndpoints < 3) ++ return -ENODEV; ++ + usb_reset_device(udev); + netdev = alloc_etherdev(sizeof(struct r8152)); + if (!netdev) { +diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c +index 289dff262948..571a1ff8f81f 100644 +--- a/drivers/net/wan/fsl_ucc_hdlc.c ++++ b/drivers/net/wan/fsl_ucc_hdlc.c +@@ -76,7 +76,7 @@ static struct ucc_tdm_info utdm_primary_info = { + }, + }; + +-static struct ucc_tdm_info utdm_info[MAX_HDLC_NUM]; ++static struct ucc_tdm_info utdm_info[UCC_MAX_NUM]; + + static int uhdlc_init(struct ucc_hdlc_private *priv) + { +diff --git a/drivers/net/wireless/st/cw1200/fwio.c b/drivers/net/wireless/st/cw1200/fwio.c +index 30e7646d04af..16be7fa82a23 100644 +--- a/drivers/net/wireless/st/cw1200/fwio.c ++++ b/drivers/net/wireless/st/cw1200/fwio.c +@@ -323,12 +323,12 @@ int cw1200_load_firmware(struct cw1200_common *priv) + goto out; + } + +- priv->hw_type = cw1200_get_hw_type(val32, &major_revision); +- if (priv->hw_type < 0) { ++ ret = cw1200_get_hw_type(val32, &major_revision); ++ if (ret < 0) { + pr_err("Can't deduce hardware type.\n"); +- ret = -ENOTSUPP; + goto out; + } ++ priv->hw_type = ret; + + /* Set DPLL Reg value, and read back to confirm writes work */ + ret = cw1200_reg_write_32(priv, ST90TDS_TSET_GEN_R_W_REG_ID, +diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c +index fcb57d64d97e..a2c9b3f3bc23 100644 +--- a/drivers/nfc/pn533/usb.c ++++ b/drivers/nfc/pn533/usb.c +@@ -403,7 +403,7 @@ static int pn533_acr122_poweron_rdr(struct pn533_usb_phy *phy) + cmd, sizeof(cmd), false); + + rc = usb_bulk_msg(phy->udev, phy->out_urb->pipe, buffer, sizeof(cmd), +- &transferred, 0); ++ &transferred, 5000); + kfree(buffer); + if (rc || (transferred != sizeof(cmd))) { + nfc_err(&phy->udev->dev, +diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c +index b818f65480c1..e232233beb8f 100644 +--- a/drivers/ptp/ptp_clock.c ++++ b/drivers/ptp/ptp_clock.c +@@ -179,6 +179,7 @@ static void ptp_clock_release(struct device *dev) + { + struct ptp_clock *ptp = container_of(dev, struct ptp_clock, dev); + ++ ptp_cleanup_pin_groups(ptp); + mutex_destroy(&ptp->tsevq_mux); + mutex_destroy(&ptp->pincfg_mux); + ida_simple_remove(&ptp_clocks_map, ptp->index); +@@ -315,9 +316,8 @@ int ptp_clock_unregister(struct ptp_clock *ptp) + if (ptp->pps_source) + pps_unregister_source(ptp->pps_source); + +- ptp_cleanup_pin_groups(ptp); +- + posix_clock_unregister(&ptp->clock); ++ + return 0; + } + EXPORT_SYMBOL(ptp_clock_unregister); +diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c +index 03c104b47f31..b832bd0ce202 100644 +--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c ++++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c +@@ -915,12 +915,12 @@ void bnx2i_free_hba(struct bnx2i_hba *hba) + INIT_LIST_HEAD(&hba->ep_ofld_list); + INIT_LIST_HEAD(&hba->ep_active_list); + INIT_LIST_HEAD(&hba->ep_destroy_list); +- pci_dev_put(hba->pcidev); + + if (hba->regview) { + pci_iounmap(hba->pcidev, hba->regview); + hba->regview = NULL; + } ++ pci_dev_put(hba->pcidev); + bnx2i_free_mp_bdt(hba); + bnx2i_release_free_cid_que(hba); + iscsi_host_free(shost); +diff --git a/drivers/scsi/esas2r/esas2r_flash.c b/drivers/scsi/esas2r/esas2r_flash.c +index 7bd376d95ed5..b02ac389e6c6 100644 +--- a/drivers/scsi/esas2r/esas2r_flash.c ++++ b/drivers/scsi/esas2r/esas2r_flash.c +@@ -1197,6 +1197,7 @@ bool esas2r_nvram_read_direct(struct esas2r_adapter *a) + if (!esas2r_read_flash_block(a, a->nvram, FLS_OFFSET_NVR, + sizeof(struct esas2r_sas_nvram))) { + esas2r_hdebug("NVRAM read failed, using defaults"); ++ up(&a->nvram_semaphore); + return false; + } + +diff --git a/drivers/scsi/fnic/vnic_dev.c b/drivers/scsi/fnic/vnic_dev.c +index ba69d6112fa1..c5b89a003d2a 100644 +--- a/drivers/scsi/fnic/vnic_dev.c ++++ b/drivers/scsi/fnic/vnic_dev.c +@@ -445,26 +445,26 @@ int vnic_dev_soft_reset_done(struct vnic_dev *vdev, int *done) + + int vnic_dev_hang_notify(struct vnic_dev *vdev) + { +- u64 a0, a1; ++ u64 a0 = 0, a1 = 0; + int wait = 1000; + return vnic_dev_cmd(vdev, CMD_HANG_NOTIFY, &a0, &a1, wait); + } + + int vnic_dev_mac_addr(struct vnic_dev *vdev, u8 *mac_addr) + { +- u64 a0, a1; ++ u64 a[2] = {}; + int wait = 1000; + int err, i; + + for (i = 0; i < ETH_ALEN; i++) + mac_addr[i] = 0; + +- err = vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a0, &a1, wait); ++ err = vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a[0], &a[1], wait); + if (err) + return err; + + for (i = 0; i < ETH_ALEN; i++) +- mac_addr[i] = ((u8 *)&a0)[i]; ++ mac_addr[i] = ((u8 *)&a)[i]; + + return 0; + } +@@ -489,30 +489,30 @@ void vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast, + + void vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr) + { +- u64 a0 = 0, a1 = 0; ++ u64 a[2] = {}; + int wait = 1000; + int err; + int i; + + for (i = 0; i < ETH_ALEN; i++) +- ((u8 *)&a0)[i] = addr[i]; ++ ((u8 *)&a)[i] = addr[i]; + +- err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait); ++ err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a[0], &a[1], wait); + if (err) + pr_err("Can't add addr [%pM], %d\n", addr, err); + } + + void vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr) + { +- u64 a0 = 0, a1 = 0; ++ u64 a[2] = {}; + int wait = 1000; + int err; + int i; + + for (i = 0; i < ETH_ALEN; i++) +- ((u8 *)&a0)[i] = addr[i]; ++ ((u8 *)&a)[i] = addr[i]; + +- err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait); ++ err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a[0], &a[1], wait); + if (err) + pr_err("Can't del addr [%pM], %d\n", addr, err); + } +diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c +index bd2421863510..a66f7cec797c 100644 +--- a/drivers/scsi/qla2xxx/qla_init.c ++++ b/drivers/scsi/qla2xxx/qla_init.c +@@ -5145,8 +5145,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha) + if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) + break; + +- if ((fcport->flags & FCF_FABRIC_DEVICE) == 0 || +- (fcport->flags & FCF_LOGIN_NEEDED) == 0) ++ if ((fcport->flags & FCF_FABRIC_DEVICE) == 0) + continue; + + if (fcport->scan_state == QLA_FCPORT_SCAN) { +@@ -5171,7 +5170,8 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha) + } + } + +- if (fcport->scan_state == QLA_FCPORT_FOUND) ++ if (fcport->scan_state == QLA_FCPORT_FOUND && ++ (fcport->flags & FCF_LOGIN_NEEDED) != 0) + qla24xx_fcport_handle_login(vha, fcport); + } + return (rval); +diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c +index 7f2da56274bd..648916a9082c 100644 +--- a/drivers/scsi/qla2xxx/qla_isr.c ++++ b/drivers/scsi/qla2xxx/qla_isr.c +@@ -3519,7 +3519,7 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp) + skip_msix: + + ql_log(ql_log_info, vha, 0x0037, +- "Falling back-to MSI mode -%d.\n", ret); ++ "Falling back-to MSI mode -- ret=%d.\n", ret); + + if (!IS_QLA24XX(ha) && !IS_QLA2532(ha) && !IS_QLA8432(ha) && + !IS_QLA8001(ha) && !IS_P3P_TYPE(ha) && !IS_QLAFX00(ha) && +@@ -3527,13 +3527,13 @@ skip_msix: + goto skip_msi; + + ret = pci_alloc_irq_vectors(ha->pdev, 1, 1, PCI_IRQ_MSI); +- if (!ret) { ++ if (ret > 0) { + ql_dbg(ql_dbg_init, vha, 0x0038, + "MSI: Enabled.\n"); + ha->flags.msi_enabled = 1; + } else + ql_log(ql_log_warn, vha, 0x0039, +- "Falling back-to INTa mode -- %d.\n", ret); ++ "Falling back-to INTa mode -- ret=%d.\n", ret); + skip_msi: + + /* Skip INTx on ISP82xx. */ +diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c +index 1da04f323d38..c402fc583da3 100644 +--- a/drivers/scsi/qla4xxx/ql4_mbx.c ++++ b/drivers/scsi/qla4xxx/ql4_mbx.c +@@ -641,9 +641,6 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha) + + if (qla4xxx_get_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma) != + QLA_SUCCESS) { +- dma_free_coherent(&ha->pdev->dev, +- sizeof(struct addr_ctrl_blk), +- init_fw_cb, init_fw_cb_dma); + goto exit_init_fw_cb; + } + +diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c +index 617a60737590..22472d140ef7 100644 +--- a/drivers/scsi/scsi_trace.c ++++ b/drivers/scsi/scsi_trace.c +@@ -21,7 +21,7 @@ + #include + + #define SERVICE_ACTION16(cdb) (cdb[1] & 0x1f) +-#define SERVICE_ACTION32(cdb) ((cdb[8] << 8) | cdb[9]) ++#define SERVICE_ACTION32(cdb) (get_unaligned_be16(&cdb[8])) + + static const char * + scsi_trace_misc(struct trace_seq *, unsigned char *, int); +@@ -51,17 +51,12 @@ static const char * + scsi_trace_rw10(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- sector_t lba = 0, txlen = 0; ++ u32 lba, txlen; + +- lba |= (cdb[2] << 24); +- lba |= (cdb[3] << 16); +- lba |= (cdb[4] << 8); +- lba |= cdb[5]; +- txlen |= (cdb[7] << 8); +- txlen |= cdb[8]; ++ lba = get_unaligned_be32(&cdb[2]); ++ txlen = get_unaligned_be16(&cdb[7]); + +- trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u", +- (unsigned long long)lba, (unsigned long long)txlen, ++ trace_seq_printf(p, "lba=%u txlen=%u protect=%u", lba, txlen, + cdb[1] >> 5); + + if (cdb[0] == WRITE_SAME) +@@ -76,19 +71,12 @@ static const char * + scsi_trace_rw12(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- sector_t lba = 0, txlen = 0; +- +- lba |= (cdb[2] << 24); +- lba |= (cdb[3] << 16); +- lba |= (cdb[4] << 8); +- lba |= cdb[5]; +- txlen |= (cdb[6] << 24); +- txlen |= (cdb[7] << 16); +- txlen |= (cdb[8] << 8); +- txlen |= cdb[9]; +- +- trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u", +- (unsigned long long)lba, (unsigned long long)txlen, ++ u32 lba, txlen; ++ ++ lba = get_unaligned_be32(&cdb[2]); ++ txlen = get_unaligned_be32(&cdb[6]); ++ ++ trace_seq_printf(p, "lba=%u txlen=%u protect=%u", lba, txlen, + cdb[1] >> 5); + trace_seq_putc(p, 0); + +@@ -99,23 +87,13 @@ static const char * + scsi_trace_rw16(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- sector_t lba = 0, txlen = 0; +- +- lba |= ((u64)cdb[2] << 56); +- lba |= ((u64)cdb[3] << 48); +- lba |= ((u64)cdb[4] << 40); +- lba |= ((u64)cdb[5] << 32); +- lba |= (cdb[6] << 24); +- lba |= (cdb[7] << 16); +- lba |= (cdb[8] << 8); +- lba |= cdb[9]; +- txlen |= (cdb[10] << 24); +- txlen |= (cdb[11] << 16); +- txlen |= (cdb[12] << 8); +- txlen |= cdb[13]; +- +- trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u", +- (unsigned long long)lba, (unsigned long long)txlen, ++ u64 lba; ++ u32 txlen; ++ ++ lba = get_unaligned_be64(&cdb[2]); ++ txlen = get_unaligned_be32(&cdb[10]); ++ ++ trace_seq_printf(p, "lba=%llu txlen=%u protect=%u", lba, txlen, + cdb[1] >> 5); + + if (cdb[0] == WRITE_SAME_16) +@@ -130,8 +108,8 @@ static const char * + scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p), *cmd; +- sector_t lba = 0, txlen = 0; +- u32 ei_lbrt = 0; ++ u64 lba; ++ u32 ei_lbrt, txlen; + + switch (SERVICE_ACTION32(cdb)) { + case READ_32: +@@ -151,26 +129,12 @@ scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len) + goto out; + } + +- lba |= ((u64)cdb[12] << 56); +- lba |= ((u64)cdb[13] << 48); +- lba |= ((u64)cdb[14] << 40); +- lba |= ((u64)cdb[15] << 32); +- lba |= (cdb[16] << 24); +- lba |= (cdb[17] << 16); +- lba |= (cdb[18] << 8); +- lba |= cdb[19]; +- ei_lbrt |= (cdb[20] << 24); +- ei_lbrt |= (cdb[21] << 16); +- ei_lbrt |= (cdb[22] << 8); +- ei_lbrt |= cdb[23]; +- txlen |= (cdb[28] << 24); +- txlen |= (cdb[29] << 16); +- txlen |= (cdb[30] << 8); +- txlen |= cdb[31]; +- +- trace_seq_printf(p, "%s_32 lba=%llu txlen=%llu protect=%u ei_lbrt=%u", +- cmd, (unsigned long long)lba, +- (unsigned long long)txlen, cdb[10] >> 5, ei_lbrt); ++ lba = get_unaligned_be64(&cdb[12]); ++ ei_lbrt = get_unaligned_be32(&cdb[20]); ++ txlen = get_unaligned_be32(&cdb[28]); ++ ++ trace_seq_printf(p, "%s_32 lba=%llu txlen=%u protect=%u ei_lbrt=%u", ++ cmd, lba, txlen, cdb[10] >> 5, ei_lbrt); + + if (SERVICE_ACTION32(cdb) == WRITE_SAME_32) + trace_seq_printf(p, " unmap=%u", cdb[10] >> 3 & 1); +@@ -185,7 +149,7 @@ static const char * + scsi_trace_unmap(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- unsigned int regions = cdb[7] << 8 | cdb[8]; ++ unsigned int regions = get_unaligned_be16(&cdb[7]); + + trace_seq_printf(p, "regions=%u", (regions - 8) / 16); + trace_seq_putc(p, 0); +@@ -197,8 +161,8 @@ static const char * + scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p), *cmd; +- sector_t lba = 0; +- u32 alloc_len = 0; ++ u64 lba; ++ u32 alloc_len; + + switch (SERVICE_ACTION16(cdb)) { + case SAI_READ_CAPACITY_16: +@@ -212,21 +176,10 @@ scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len) + goto out; + } + +- lba |= ((u64)cdb[2] << 56); +- lba |= ((u64)cdb[3] << 48); +- lba |= ((u64)cdb[4] << 40); +- lba |= ((u64)cdb[5] << 32); +- lba |= (cdb[6] << 24); +- lba |= (cdb[7] << 16); +- lba |= (cdb[8] << 8); +- lba |= cdb[9]; +- alloc_len |= (cdb[10] << 24); +- alloc_len |= (cdb[11] << 16); +- alloc_len |= (cdb[12] << 8); +- alloc_len |= cdb[13]; +- +- trace_seq_printf(p, "%s lba=%llu alloc_len=%u", cmd, +- (unsigned long long)lba, alloc_len); ++ lba = get_unaligned_be64(&cdb[2]); ++ alloc_len = get_unaligned_be32(&cdb[10]); ++ ++ trace_seq_printf(p, "%s lba=%llu alloc_len=%u", cmd, lba, alloc_len); + + out: + trace_seq_putc(p, 0); +diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c +index 508da345b73f..95aa47ac4dcd 100644 +--- a/drivers/target/target_core_fabric_lib.c ++++ b/drivers/target/target_core_fabric_lib.c +@@ -131,7 +131,7 @@ static int srp_get_pr_transport_id( + memset(buf + 8, 0, leading_zero_bytes); + rc = hex2bin(buf + 8 + leading_zero_bytes, p, count); + if (rc < 0) { +- pr_debug("hex2bin failed for %s: %d\n", __func__, rc); ++ pr_debug("hex2bin failed for %s: %d\n", p, rc); + return rc; + } + +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index 4efccf8bf99f..7d5ecf36a33c 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -1164,6 +1164,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) + * PORT_OVER_CURRENT is not. So check for any of them. + */ + if (udev || (portstatus & USB_PORT_STAT_CONNECTION) || ++ (portchange & USB_PORT_STAT_C_CONNECTION) || + (portstatus & USB_PORT_STAT_OVERCURRENT) || + (portchange & USB_PORT_STAT_C_OVERCURRENT)) + set_bit(port1, hub->change_bits); +diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c +index 578596d301b8..31cd798d2dac 100644 +--- a/drivers/usb/serial/ch341.c ++++ b/drivers/usb/serial/ch341.c +@@ -592,9 +592,13 @@ static int ch341_tiocmget(struct tty_struct *tty) + static int ch341_reset_resume(struct usb_serial *serial) + { + struct usb_serial_port *port = serial->port[0]; +- struct ch341_private *priv = usb_get_serial_port_data(port); ++ struct ch341_private *priv; + int ret; + ++ priv = usb_get_serial_port_data(port); ++ if (!priv) ++ return 0; ++ + /* reconfigure ch341 serial port after bus-reset */ + ch341_configure(serial->dev, priv); + +diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c +index 51b61545ccf2..3705b64ab948 100644 +--- a/drivers/usb/serial/io_edgeport.c ++++ b/drivers/usb/serial/io_edgeport.c +@@ -652,6 +652,7 @@ static void edge_interrupt_callback(struct urb *urb) + struct usb_serial_port *port; + unsigned char *data = urb->transfer_buffer; + int length = urb->actual_length; ++ unsigned long flags; + int bytes_avail; + int position; + int txCredits; +@@ -683,7 +684,7 @@ static void edge_interrupt_callback(struct urb *urb) + if (length > 1) { + bytes_avail = data[0] | (data[1] << 8); + if (bytes_avail) { +- spin_lock(&edge_serial->es_lock); ++ spin_lock_irqsave(&edge_serial->es_lock, flags); + edge_serial->rxBytesAvail += bytes_avail; + dev_dbg(dev, + "%s - bytes_avail=%d, rxBytesAvail=%d, read_in_progress=%d\n", +@@ -706,7 +707,8 @@ static void edge_interrupt_callback(struct urb *urb) + edge_serial->read_in_progress = false; + } + } +- spin_unlock(&edge_serial->es_lock); ++ spin_unlock_irqrestore(&edge_serial->es_lock, ++ flags); + } + } + /* grab the txcredits for the ports if available */ +@@ -718,10 +720,12 @@ static void edge_interrupt_callback(struct urb *urb) + if (txCredits) { + port = edge_serial->serial->port[portNumber]; + edge_port = usb_get_serial_port_data(port); +- if (edge_port->open) { +- spin_lock(&edge_port->ep_lock); ++ if (edge_port && edge_port->open) { ++ spin_lock_irqsave(&edge_port->ep_lock, ++ flags); + edge_port->txCredits += txCredits; +- spin_unlock(&edge_port->ep_lock); ++ spin_unlock_irqrestore(&edge_port->ep_lock, ++ flags); + dev_dbg(dev, "%s - txcredits for port%d = %d\n", + __func__, portNumber, + edge_port->txCredits); +@@ -762,6 +766,7 @@ static void edge_bulk_in_callback(struct urb *urb) + int retval; + __u16 raw_data_length; + int status = urb->status; ++ unsigned long flags; + + if (status) { + dev_dbg(&urb->dev->dev, "%s - nonzero read bulk status received: %d\n", +@@ -781,7 +786,7 @@ static void edge_bulk_in_callback(struct urb *urb) + + usb_serial_debug_data(dev, __func__, raw_data_length, data); + +- spin_lock(&edge_serial->es_lock); ++ spin_lock_irqsave(&edge_serial->es_lock, flags); + + /* decrement our rxBytes available by the number that we just got */ + edge_serial->rxBytesAvail -= raw_data_length; +@@ -805,7 +810,7 @@ static void edge_bulk_in_callback(struct urb *urb) + edge_serial->read_in_progress = false; + } + +- spin_unlock(&edge_serial->es_lock); ++ spin_unlock_irqrestore(&edge_serial->es_lock, flags); + } + + +@@ -1733,7 +1738,8 @@ static void edge_break(struct tty_struct *tty, int break_state) + static void process_rcvd_data(struct edgeport_serial *edge_serial, + unsigned char *buffer, __u16 bufferLength) + { +- struct device *dev = &edge_serial->serial->dev->dev; ++ struct usb_serial *serial = edge_serial->serial; ++ struct device *dev = &serial->dev->dev; + struct usb_serial_port *port; + struct edgeport_port *edge_port; + __u16 lastBufferLength; +@@ -1838,11 +1844,10 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial, + + /* spit this data back into the tty driver if this + port is open */ +- if (rxLen) { +- port = edge_serial->serial->port[ +- edge_serial->rxPort]; ++ if (rxLen && edge_serial->rxPort < serial->num_ports) { ++ port = serial->port[edge_serial->rxPort]; + edge_port = usb_get_serial_port_data(port); +- if (edge_port->open) { ++ if (edge_port && edge_port->open) { + dev_dbg(dev, "%s - Sending %d bytes to TTY for port %d\n", + __func__, rxLen, + edge_serial->rxPort); +@@ -1850,8 +1855,8 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial, + rxLen); + edge_port->port->icount.rx += rxLen; + } +- buffer += rxLen; + } ++ buffer += rxLen; + break; + + case EXPECT_HDR3: /* Expect 3rd byte of status header */ +@@ -1886,6 +1891,8 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial, + __u8 code = edge_serial->rxStatusCode; + + /* switch the port pointer to the one being currently talked about */ ++ if (edge_serial->rxPort >= edge_serial->serial->num_ports) ++ return; + port = edge_serial->serial->port[edge_serial->rxPort]; + edge_port = usb_get_serial_port_data(port); + if (edge_port == NULL) { +diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c +index 2c5a53bdccd4..55a768487990 100644 +--- a/drivers/usb/serial/keyspan.c ++++ b/drivers/usb/serial/keyspan.c +@@ -1062,6 +1062,8 @@ static void usa49_glocont_callback(struct urb *urb) + for (i = 0; i < serial->num_ports; ++i) { + port = serial->port[i]; + p_priv = usb_get_serial_port_data(port); ++ if (!p_priv) ++ continue; + + if (p_priv->resend_cont) { + dev_dbg(&port->dev, "%s - sending setup\n", __func__); +@@ -1463,6 +1465,8 @@ static void usa67_glocont_callback(struct urb *urb) + for (i = 0; i < serial->num_ports; ++i) { + port = serial->port[i]; + p_priv = usb_get_serial_port_data(port); ++ if (!p_priv) ++ continue; + + if (p_priv->resend_cont) { + dev_dbg(&port->dev, "%s - sending setup\n", __func__); +diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c +index 58657d64678b..c37572a8bb06 100644 +--- a/drivers/usb/serial/opticon.c ++++ b/drivers/usb/serial/opticon.c +@@ -116,7 +116,7 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype, + retval = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), + requesttype, + USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, +- 0, 0, buffer, 1, 0); ++ 0, 0, buffer, 1, USB_CTRL_SET_TIMEOUT); + kfree(buffer); + + if (retval < 0) +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c +index e69e31539914..eff353de47cd 100644 +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -251,6 +251,7 @@ static void option_instat_callback(struct urb *urb); + #define QUECTEL_PRODUCT_BG96 0x0296 + #define QUECTEL_PRODUCT_EP06 0x0306 + #define QUECTEL_PRODUCT_EM12 0x0512 ++#define QUECTEL_PRODUCT_RM500Q 0x0800 + + #define CMOTECH_VENDOR_ID 0x16d8 + #define CMOTECH_PRODUCT_6001 0x6001 +@@ -1107,6 +1108,11 @@ static const struct usb_device_id option_ids[] = { + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0xff, 0xff), + .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0, 0) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x30) }, ++ { 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(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003), +diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c +index 60e17d1444c3..f16e0b8c1ed4 100644 +--- a/drivers/usb/serial/quatech2.c ++++ b/drivers/usb/serial/quatech2.c +@@ -867,7 +867,10 @@ static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch) + u8 newMSR = (u8) *ch; + unsigned long flags; + ++ /* May be called from qt2_process_read_urb() for an unbound port. */ + port_priv = usb_get_serial_port_data(port); ++ if (!port_priv) ++ return; + + spin_lock_irqsave(&port_priv->lock, flags); + port_priv->shadowMSR = newMSR; +@@ -895,7 +898,10 @@ static void qt2_update_lsr(struct usb_serial_port *port, unsigned char *ch) + unsigned long flags; + u8 newLSR = (u8) *ch; + ++ /* May be called from qt2_process_read_urb() for an unbound port. */ + port_priv = usb_get_serial_port_data(port); ++ if (!port_priv) ++ return; + + if (newLSR & UART_LSR_BI) + newLSR &= (u8) (UART_LSR_OE | UART_LSR_BI); +diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c +index 511242111403..15e05ebf37ac 100644 +--- a/drivers/usb/serial/usb-serial-simple.c ++++ b/drivers/usb/serial/usb-serial-simple.c +@@ -89,6 +89,8 @@ DEVICE(moto_modem, MOTO_IDS); + #define MOTOROLA_TETRA_IDS() \ + { USB_DEVICE(0x0cad, 0x9011) }, /* Motorola Solutions TETRA PEI */ \ + { USB_DEVICE(0x0cad, 0x9012) }, /* MTP6550 */ \ ++ { USB_DEVICE(0x0cad, 0x9013) }, /* MTP3xxx */ \ ++ { USB_DEVICE(0x0cad, 0x9015) }, /* MTP85xx */ \ + { USB_DEVICE(0x0cad, 0x9016) } /* TPG2200 */ + DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS); + +diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c +index 8115b7cccf1a..3dc3464626fb 100644 +--- a/drivers/usb/serial/usb-serial.c ++++ b/drivers/usb/serial/usb-serial.c +@@ -1332,6 +1332,9 @@ static int usb_serial_register(struct usb_serial_driver *driver) + return -EINVAL; + } + ++ /* Prevent individual ports from being unbound. */ ++ driver->driver.suppress_bind_attrs = true; ++ + usb_serial_operations_init(driver); + + /* Add this device to our list of devices */ +diff --git a/firmware/Makefile b/firmware/Makefile +index 168094a3fae7..30e6b738839e 100644 +--- a/firmware/Makefile ++++ b/firmware/Makefile +@@ -19,7 +19,7 @@ quiet_cmd_fwbin = MK_FW $@ + PROGBITS=$(if $(CONFIG_ARM),%,@)progbits; \ + echo "/* Generated by firmware/Makefile */" > $@;\ + echo " .section .rodata" >>$@;\ +- echo " .p2align $${ASM_ALIGN}" >>$@;\ ++ echo " .p2align 4" >>$@;\ + echo "_fw_$${FWSTR}_bin:" >>$@;\ + echo " .incbin \"$(2)\"" >>$@;\ + echo "_fw_end:" >>$@;\ +diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c +index cb6e8cb0de94..39a00b57ff01 100644 +--- a/fs/btrfs/qgroup.c ++++ b/fs/btrfs/qgroup.c +@@ -1928,8 +1928,12 @@ btrfs_qgroup_account_extent(struct btrfs_trans_handle *trans, + u64 nr_old_roots = 0; + int ret = 0; + ++ /* ++ * If quotas get disabled meanwhile, the resouces need to be freed and ++ * we can't just exit here. ++ */ + if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) +- return 0; ++ goto out_free; + + if (new_roots) { + if (!maybe_fs_roots(new_roots)) +diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c +index 29a0c0969e91..28f6daf371d3 100644 +--- a/fs/reiserfs/xattr.c ++++ b/fs/reiserfs/xattr.c +@@ -319,8 +319,12 @@ static int reiserfs_for_each_xattr(struct inode *inode, + out_dir: + dput(dir); + out: +- /* -ENODATA isn't an error */ +- if (err == -ENODATA) ++ /* ++ * -ENODATA: this object doesn't have any xattrs ++ * -EOPNOTSUPP: this file system doesn't have xattrs enabled on disk. ++ * Neither are errors ++ */ ++ if (err == -ENODATA || err == -EOPNOTSUPP) + err = 0; + return err; + } +diff --git a/include/dt-bindings/reset/amlogic,meson8b-reset.h b/include/dt-bindings/reset/amlogic,meson8b-reset.h +index 614aff2c7aff..a03e86fe2c57 100644 +--- a/include/dt-bindings/reset/amlogic,meson8b-reset.h ++++ b/include/dt-bindings/reset/amlogic,meson8b-reset.h +@@ -95,9 +95,9 @@ + #define RESET_VD_RMEM 64 + #define RESET_AUDIN 65 + #define RESET_DBLK 66 +-#define RESET_PIC_DC 66 +-#define RESET_PSC 66 +-#define RESET_NAND 66 ++#define RESET_PIC_DC 67 ++#define RESET_PSC 68 ++#define RESET_NAND 69 + #define RESET_GE2D 70 + #define RESET_PARSER_REG 71 + #define RESET_PARSER_FETCH 72 +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h +index 4d4af0e94059..ad940102451c 100644 +--- a/include/linux/blkdev.h ++++ b/include/linux/blkdev.h +@@ -343,6 +343,7 @@ struct queue_limits { + unsigned int max_sectors; + unsigned int max_segment_size; + unsigned int physical_block_size; ++ unsigned int logical_block_size; + unsigned int alignment_offset; + unsigned int io_min; + unsigned int io_opt; +@@ -353,7 +354,6 @@ struct queue_limits { + unsigned int discard_granularity; + unsigned int discard_alignment; + +- unsigned short logical_block_size; + unsigned short max_segments; + unsigned short max_integrity_segments; + unsigned short max_discard_segments; +@@ -1178,7 +1178,7 @@ extern void blk_queue_max_write_same_sectors(struct request_queue *q, + unsigned int max_write_same_sectors); + extern void blk_queue_max_write_zeroes_sectors(struct request_queue *q, + unsigned int max_write_same_sectors); +-extern void blk_queue_logical_block_size(struct request_queue *, unsigned short); ++extern void blk_queue_logical_block_size(struct request_queue *, unsigned int); + extern void blk_queue_physical_block_size(struct request_queue *, unsigned int); + extern void blk_queue_alignment_offset(struct request_queue *q, + unsigned int alignment); +@@ -1436,7 +1436,7 @@ static inline unsigned int queue_max_segment_size(struct request_queue *q) + return q->limits.max_segment_size; + } + +-static inline unsigned short queue_logical_block_size(struct request_queue *q) ++static inline unsigned queue_logical_block_size(struct request_queue *q) + { + int retval = 512; + +@@ -1446,7 +1446,7 @@ static inline unsigned short queue_logical_block_size(struct request_queue *q) + return retval; + } + +-static inline unsigned short bdev_logical_block_size(struct block_device *bdev) ++static inline unsigned int bdev_logical_block_size(struct block_device *bdev) + { + return queue_logical_block_size(bdev_get_queue(bdev)); + } +diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h +index 260c4aa1d976..3f6b8b9ef49d 100644 +--- a/include/linux/regulator/ab8500.h ++++ b/include/linux/regulator/ab8500.h +@@ -43,8 +43,6 @@ enum ab8505_regulator_id { + AB8505_LDO_ANAMIC2, + AB8505_LDO_AUX8, + AB8505_LDO_ANA, +- AB8505_SYSCLKREQ_2, +- AB8505_SYSCLKREQ_4, + AB8505_NUM_REGULATORS, + }; + +diff --git a/kernel/ptrace.c b/kernel/ptrace.c +index 09fb3f58a838..43a283041296 100644 +--- a/kernel/ptrace.c ++++ b/kernel/ptrace.c +@@ -258,12 +258,17 @@ static int ptrace_check_attach(struct task_struct *child, bool ignore_state) + return ret; + } + +-static int ptrace_has_cap(struct user_namespace *ns, unsigned int mode) ++static bool ptrace_has_cap(const struct cred *cred, struct user_namespace *ns, ++ unsigned int mode) + { ++ int ret; ++ + if (mode & PTRACE_MODE_NOAUDIT) +- return has_ns_capability_noaudit(current, ns, CAP_SYS_PTRACE); ++ ret = security_capable(cred, ns, CAP_SYS_PTRACE); + else +- return has_ns_capability(current, ns, CAP_SYS_PTRACE); ++ ret = security_capable(cred, ns, CAP_SYS_PTRACE); ++ ++ return ret == 0; + } + + /* Returns 0 on success, -errno on denial. */ +@@ -315,7 +320,7 @@ static int __ptrace_may_access(struct task_struct *task, unsigned int mode) + gid_eq(caller_gid, tcred->sgid) && + gid_eq(caller_gid, tcred->gid)) + goto ok; +- if (ptrace_has_cap(tcred->user_ns, mode)) ++ if (ptrace_has_cap(cred, tcred->user_ns, mode)) + goto ok; + rcu_read_unlock(); + return -EPERM; +@@ -334,7 +339,7 @@ ok: + mm = task->mm; + if (mm && + ((get_dumpable(mm) != SUID_DUMP_USER) && +- !ptrace_has_cap(mm->user_ns, mode))) ++ !ptrace_has_cap(cred, mm->user_ns, mode))) + return -EPERM; + + return security_ptrace_access_check(task, mode); +diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c +index a8fa0a896b78..3c7b400512eb 100644 +--- a/kernel/time/tick-sched.c ++++ b/kernel/time/tick-sched.c +@@ -60,8 +60,9 @@ static void tick_do_update_jiffies64(ktime_t now) + + /* + * Do a quick check without holding jiffies_lock: ++ * The READ_ONCE() pairs with two updates done later in this function. + */ +- delta = ktime_sub(now, last_jiffies_update); ++ delta = ktime_sub(now, READ_ONCE(last_jiffies_update)); + if (delta < tick_period) + return; + +@@ -72,8 +73,9 @@ static void tick_do_update_jiffies64(ktime_t now) + if (delta >= tick_period) { + + delta = ktime_sub(delta, tick_period); +- last_jiffies_update = ktime_add(last_jiffies_update, +- tick_period); ++ /* Pairs with the lockless read in this function. */ ++ WRITE_ONCE(last_jiffies_update, ++ ktime_add(last_jiffies_update, tick_period)); + + /* Slow path for long timeouts */ + if (unlikely(delta >= tick_period)) { +@@ -81,8 +83,10 @@ static void tick_do_update_jiffies64(ktime_t now) + + ticks = ktime_divns(delta, incr); + +- last_jiffies_update = ktime_add_ns(last_jiffies_update, +- incr * ticks); ++ /* Pairs with the lockless read in this function. */ ++ WRITE_ONCE(last_jiffies_update, ++ ktime_add_ns(last_jiffies_update, ++ incr * ticks)); + } + do_timer(++ticks); + +diff --git a/mm/huge_memory.c b/mm/huge_memory.c +index 1adc2e6c50f9..92915cc87549 100644 +--- a/mm/huge_memory.c ++++ b/mm/huge_memory.c +@@ -502,13 +502,13 @@ void prep_transhuge_page(struct page *page) + set_compound_page_dtor(page, TRANSHUGE_PAGE_DTOR); + } + +-unsigned long __thp_get_unmapped_area(struct file *filp, unsigned long len, ++static unsigned long __thp_get_unmapped_area(struct file *filp, ++ unsigned long addr, unsigned long len, + loff_t off, unsigned long flags, unsigned long size) + { +- unsigned long addr; + loff_t off_end = off + len; + loff_t off_align = round_up(off, size); +- unsigned long len_pad; ++ unsigned long len_pad, ret; + + if (off_end <= off_align || (off_end - off_align) < size) + return 0; +@@ -517,30 +517,40 @@ unsigned long __thp_get_unmapped_area(struct file *filp, unsigned long len, + if (len_pad < len || (off + len_pad) < off) + return 0; + +- addr = current->mm->get_unmapped_area(filp, 0, len_pad, ++ ret = current->mm->get_unmapped_area(filp, addr, len_pad, + off >> PAGE_SHIFT, flags); +- if (IS_ERR_VALUE(addr)) ++ ++ /* ++ * The failure might be due to length padding. The caller will retry ++ * without the padding. ++ */ ++ if (IS_ERR_VALUE(ret)) + return 0; + +- addr += (off - addr) & (size - 1); +- return addr; ++ /* ++ * Do not try to align to THP boundary if allocation at the address ++ * hint succeeds. ++ */ ++ if (ret == addr) ++ return addr; ++ ++ ret += (off - ret) & (size - 1); ++ return ret; + } + + unsigned long thp_get_unmapped_area(struct file *filp, unsigned long addr, + unsigned long len, unsigned long pgoff, unsigned long flags) + { ++ unsigned long ret; + loff_t off = (loff_t)pgoff << PAGE_SHIFT; + +- if (addr) +- goto out; + if (!IS_DAX(filp->f_mapping->host) || !IS_ENABLED(CONFIG_FS_DAX_PMD)) + goto out; + +- addr = __thp_get_unmapped_area(filp, len, off, flags, PMD_SIZE); +- if (addr) +- return addr; +- +- out: ++ ret = __thp_get_unmapped_area(filp, addr, len, off, flags, PMD_SIZE); ++ if (ret) ++ return ret; ++out: + return current->mm->get_unmapped_area(filp, addr, len, pgoff, flags); + } + EXPORT_SYMBOL_GPL(thp_get_unmapped_area); +diff --git a/mm/page-writeback.c b/mm/page-writeback.c +index a40c075fd8f1..29f9980c13ac 100644 +--- a/mm/page-writeback.c ++++ b/mm/page-writeback.c +@@ -201,11 +201,11 @@ static void wb_min_max_ratio(struct bdi_writeback *wb, + if (this_bw < tot_bw) { + if (min) { + min *= this_bw; +- do_div(min, tot_bw); ++ min = div64_ul(min, tot_bw); + } + if (max < 100) { + max *= this_bw; +- do_div(max, tot_bw); ++ max = div64_ul(max, tot_bw); + } + } + +diff --git a/mm/shmem.c b/mm/shmem.c +index 69106c600692..0b6db162083c 100644 +--- a/mm/shmem.c ++++ b/mm/shmem.c +@@ -2052,9 +2052,10 @@ unsigned long shmem_get_unmapped_area(struct file *file, + /* + * Our priority is to support MAP_SHARED mapped hugely; + * and support MAP_PRIVATE mapped hugely too, until it is COWed. +- * But if caller specified an address hint, respect that as before. ++ * But if caller specified an address hint and we allocated area there ++ * successfully, respect that as before. + */ +- if (uaddr) ++ if (uaddr == addr) + return addr; + + if (shmem_huge != SHMEM_HUGE_FORCE) { +@@ -2088,7 +2089,7 @@ unsigned long shmem_get_unmapped_area(struct file *file, + if (inflated_len < len) + return addr; + +- inflated_addr = get_area(NULL, 0, inflated_len, 0, flags); ++ inflated_addr = get_area(NULL, uaddr, inflated_len, 0, flags); + if (IS_ERR_VALUE(inflated_addr)) + return addr; + if (inflated_addr & ~PAGE_MASK) +diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c +index 8d1d0fdb157e..1519cbf70150 100644 +--- a/net/batman-adv/distributed-arp-table.c ++++ b/net/batman-adv/distributed-arp-table.c +@@ -243,6 +243,7 @@ static u32 batadv_hash_dat(const void *data, u32 size) + u32 hash = 0; + const struct batadv_dat_entry *dat = data; + const unsigned char *key; ++ __be16 vid; + u32 i; + + key = (const unsigned char *)&dat->ip; +@@ -252,7 +253,8 @@ static u32 batadv_hash_dat(const void *data, u32 size) + hash ^= (hash >> 6); + } + +- key = (const unsigned char *)&dat->vid; ++ vid = htons(dat->vid); ++ key = (__force const unsigned char *)&vid; + for (i = 0; i < sizeof(dat->vid); i++) { + hash += key[i]; + hash += (hash << 10); +diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c +index b8c05f1cf47d..af3a12a36d88 100644 +--- a/net/dsa/tag_qca.c ++++ b/net/dsa/tag_qca.c +@@ -41,9 +41,6 @@ static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev) + struct dsa_slave_priv *p = netdev_priv(dev); + u16 *phdr, hdr; + +- dev->stats.tx_packets++; +- dev->stats.tx_bytes += skb->len; +- + if (skb_cow_head(skb, 0) < 0) + return NULL; + +diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c +index e288489ae3d5..6dd727e0a72f 100644 +--- a/net/ipv4/netfilter/arp_tables.c ++++ b/net/ipv4/netfilter/arp_tables.c +@@ -506,12 +506,13 @@ static inline int check_entry_size_and_hooks(struct arpt_entry *e, + return 0; + } + +-static inline void cleanup_entry(struct arpt_entry *e) ++static void cleanup_entry(struct arpt_entry *e, struct net *net) + { + struct xt_tgdtor_param par; + struct xt_entry_target *t; + + t = arpt_get_target(e); ++ par.net = net; + par.target = t->u.kernel.target; + par.targinfo = t->data; + par.family = NFPROTO_ARP; +@@ -601,7 +602,7 @@ static int translate_table(struct net *net, + xt_entry_foreach(iter, entry0, newinfo->size) { + if (i-- == 0) + break; +- cleanup_entry(iter); ++ cleanup_entry(iter, net); + } + return ret; + } +@@ -926,7 +927,7 @@ static int __do_replace(struct net *net, const char *name, + /* Decrease module usage counts and free resource */ + loc_cpu_old_entry = oldinfo->entries; + xt_entry_foreach(iter, loc_cpu_old_entry, oldinfo->size) +- cleanup_entry(iter); ++ cleanup_entry(iter, net); + + xt_free_table_info(oldinfo); + if (copy_to_user(counters_ptr, counters, +@@ -990,7 +991,7 @@ static int do_replace(struct net *net, const void __user *user, + + free_newinfo_untrans: + xt_entry_foreach(iter, loc_cpu_entry, newinfo->size) +- cleanup_entry(iter); ++ cleanup_entry(iter, net); + free_newinfo: + xt_free_table_info(newinfo); + return ret; +@@ -1287,7 +1288,7 @@ static int compat_do_replace(struct net *net, void __user *user, + + free_newinfo_untrans: + xt_entry_foreach(iter, loc_cpu_entry, newinfo->size) +- cleanup_entry(iter); ++ cleanup_entry(iter, net); + free_newinfo: + xt_free_table_info(newinfo); + return ret; +@@ -1514,7 +1515,7 @@ static int do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len + return ret; + } + +-static void __arpt_unregister_table(struct xt_table *table) ++static void __arpt_unregister_table(struct net *net, struct xt_table *table) + { + struct xt_table_info *private; + void *loc_cpu_entry; +@@ -1526,7 +1527,7 @@ static void __arpt_unregister_table(struct xt_table *table) + /* Decrease module usage counts and free resources */ + loc_cpu_entry = private->entries; + xt_entry_foreach(iter, loc_cpu_entry, private->size) +- cleanup_entry(iter); ++ cleanup_entry(iter, net); + if (private->number > private->initial_entries) + module_put(table_owner); + xt_free_table_info(private); +@@ -1566,7 +1567,7 @@ int arpt_register_table(struct net *net, + + ret = nf_register_net_hooks(net, ops, hweight32(table->valid_hooks)); + if (ret != 0) { +- __arpt_unregister_table(new_table); ++ __arpt_unregister_table(net, new_table); + *res = NULL; + } + +@@ -1581,7 +1582,7 @@ void arpt_unregister_table(struct net *net, struct xt_table *table, + const struct nf_hook_ops *ops) + { + nf_unregister_net_hooks(net, ops, hweight32(table->valid_hooks)); +- __arpt_unregister_table(table); ++ __arpt_unregister_table(net, table); + } + + /* The built-in targets: standard (NULL) and error. */ +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c +index d2b1c39c4223..29f3df4ddd1f 100644 +--- a/net/ipv4/tcp_input.c ++++ b/net/ipv4/tcp_input.c +@@ -932,9 +932,10 @@ static void tcp_update_reordering(struct sock *sk, const int metric, + /* This must be called before lost_out is incremented */ + static void tcp_verify_retransmit_hint(struct tcp_sock *tp, struct sk_buff *skb) + { +- if (!tp->retransmit_skb_hint || +- before(TCP_SKB_CB(skb)->seq, +- TCP_SKB_CB(tp->retransmit_skb_hint)->seq)) ++ if ((!tp->retransmit_skb_hint && tp->retrans_out >= tp->lost_out) || ++ (tp->retransmit_skb_hint && ++ before(TCP_SKB_CB(skb)->seq, ++ TCP_SKB_CB(tp->retransmit_skb_hint)->seq))) + tp->retransmit_skb_hint = skb; + } + +diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h b/net/netfilter/ipset/ip_set_bitmap_gen.h +index 8ad2b52a0b32..b0701f6259cc 100644 +--- a/net/netfilter/ipset/ip_set_bitmap_gen.h ++++ b/net/netfilter/ipset/ip_set_bitmap_gen.h +@@ -64,9 +64,9 @@ mtype_destroy(struct ip_set *set) + if (SET_WITH_TIMEOUT(set)) + del_timer_sync(&map->gc); + +- ip_set_free(map->members); + if (set->dsize && set->extensions & IPSET_EXT_DESTROY) + mtype_ext_cleanup(set); ++ ip_set_free(map->members); + ip_set_free(map); + + set->data = NULL; +diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h +index 0c06240d25af..249919bdfc64 100644 +--- a/net/wireless/rdev-ops.h ++++ b/net/wireless/rdev-ops.h +@@ -537,6 +537,10 @@ static inline int + rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed) + { + int ret; ++ ++ if (!rdev->ops->set_wiphy_params) ++ return -EOPNOTSUPP; ++ + trace_rdev_set_wiphy_params(&rdev->wiphy, changed); + ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed); + trace_rdev_return_int(&rdev->wiphy, ret); +diff --git a/net/wireless/util.c b/net/wireless/util.c +index 2234817f5dbb..935929b45411 100644 +--- a/net/wireless/util.c ++++ b/net/wireless/util.c +@@ -652,7 +652,7 @@ __frame_add_frag(struct sk_buff *skb, struct page *page, + struct skb_shared_info *sh = skb_shinfo(skb); + int page_offset; + +- page_ref_inc(page); ++ get_page(page); + page_offset = ptr - page_address(page); + skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size); + } +diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c +index b80985fbc334..0e1feb597586 100644 +--- a/sound/core/seq/seq_timer.c ++++ b/sound/core/seq/seq_timer.c +@@ -479,15 +479,19 @@ void snd_seq_info_timer_read(struct snd_info_entry *entry, + q = queueptr(idx); + if (q == NULL) + continue; +- if ((tmr = q->timer) == NULL || +- (ti = tmr->timeri) == NULL) { +- queuefree(q); +- continue; +- } ++ mutex_lock(&q->timer_mutex); ++ tmr = q->timer; ++ if (!tmr) ++ goto unlock; ++ ti = tmr->timeri; ++ if (!ti) ++ goto unlock; + snd_iprintf(buffer, "Timer for queue %i : %s\n", q->queue, ti->timer->name); + resolution = snd_timer_resolution(ti) * tmr->ticks; + snd_iprintf(buffer, " Period time : %lu.%09lu\n", resolution / 1000000000, resolution % 1000000000); + snd_iprintf(buffer, " Skew : %u / %u\n", tmr->skew, tmr->skew_base); ++unlock: ++ mutex_unlock(&q->timer_mutex); + queuefree(q); + } + } +diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c +index 969283737787..3633eb30dd13 100644 +--- a/sound/soc/codecs/msm8916-wcd-analog.c ++++ b/sound/soc/codecs/msm8916-wcd-analog.c +@@ -876,10 +876,10 @@ static const struct snd_soc_dapm_widget pm8916_wcd_analog_dapm_widgets[] = { + + SND_SOC_DAPM_SUPPLY("MIC BIAS External1", CDC_A_MICB_1_EN, 7, 0, + pm8916_wcd_analog_enable_micbias_ext1, +- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), ++ SND_SOC_DAPM_POST_PMU), + SND_SOC_DAPM_SUPPLY("MIC BIAS External2", CDC_A_MICB_2_EN, 7, 0, + pm8916_wcd_analog_enable_micbias_ext2, +- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), ++ SND_SOC_DAPM_POST_PMU), + + SND_SOC_DAPM_ADC_E("ADC1", NULL, CDC_A_TX_1_EN, 7, 0, + pm8916_wcd_analog_enable_adc, +diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c +index fd4dd12b8f9d..17b26661b2f6 100644 +--- a/tools/perf/builtin-report.c ++++ b/tools/perf/builtin-report.c +@@ -742,6 +742,7 @@ int cmd_report(int argc, const char **argv) + struct stat st; + bool has_br_stack = false; + int branch_mode = -1; ++ int last_key = 0; + bool branch_call_mode = false; + char callchain_default_opt[] = CALLCHAIN_DEFAULT_OPT; + const char * const report_usage[] = { +@@ -1048,7 +1049,8 @@ repeat: + else + use_browser = 0; + +- if (setup_sorting(session->evlist) < 0) { ++ if ((last_key != K_SWITCH_INPUT_DATA) && ++ (setup_sorting(session->evlist) < 0)) { + if (sort_order) + parse_options_usage(report_usage, options, "s", 1); + if (field_order) +@@ -1108,6 +1110,7 @@ repeat: + ret = __cmd_report(&report); + if (ret == K_SWITCH_INPUT_DATA) { + perf_session__delete(session); ++ last_key = K_SWITCH_INPUT_DATA; + goto repeat; + } else + ret = 0; +diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h +index b99d68943f25..595f91f46811 100644 +--- a/tools/perf/util/hist.h ++++ b/tools/perf/util/hist.h +@@ -317,10 +317,10 @@ static inline void perf_hpp__prepend_sort_field(struct perf_hpp_fmt *format) + list_for_each_entry_safe(format, tmp, &(_list)->sorts, sort_list) + + #define hists__for_each_format(hists, format) \ +- perf_hpp_list__for_each_format((hists)->hpp_list, fmt) ++ perf_hpp_list__for_each_format((hists)->hpp_list, format) + + #define hists__for_each_sort_list(hists, format) \ +- perf_hpp_list__for_each_sort_list((hists)->hpp_list, fmt) ++ perf_hpp_list__for_each_sort_list((hists)->hpp_list, format) + + extern struct perf_hpp_fmt perf_hpp__format[]; + +diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c +index 30a5e92b67bd..893193bd28c1 100644 +--- a/tools/perf/util/probe-finder.c ++++ b/tools/perf/util/probe-finder.c +@@ -615,38 +615,26 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwfl_Module *mod, + const char *function, + struct probe_trace_point *tp) + { +- Dwarf_Addr eaddr, highaddr; ++ Dwarf_Addr eaddr; + GElf_Sym sym; + const char *symbol; + + /* Verify the address is correct */ +- if (dwarf_entrypc(sp_die, &eaddr) != 0) { +- pr_warning("Failed to get entry address of %s\n", +- dwarf_diename(sp_die)); +- return -ENOENT; +- } +- if (dwarf_highpc(sp_die, &highaddr) != 0) { +- pr_warning("Failed to get end address of %s\n", +- dwarf_diename(sp_die)); +- return -ENOENT; +- } +- if (paddr > highaddr) { +- pr_warning("Offset specified is greater than size of %s\n", ++ if (!dwarf_haspc(sp_die, paddr)) { ++ pr_warning("Specified offset is out of %s\n", + dwarf_diename(sp_die)); + return -EINVAL; + } + +- symbol = dwarf_diename(sp_die); ++ /* Try to get actual symbol name from symtab */ ++ symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL); + if (!symbol) { +- /* Try to get the symbol name from symtab */ +- symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL); +- if (!symbol) { +- pr_warning("Failed to find symbol at 0x%lx\n", +- (unsigned long)paddr); +- return -ENOENT; +- } +- eaddr = sym.st_value; ++ pr_warning("Failed to find symbol at 0x%lx\n", ++ (unsigned long)paddr); ++ return -ENOENT; + } ++ eaddr = sym.st_value; ++ + tp->offset = (unsigned long)(paddr - eaddr); + tp->address = (unsigned long)paddr; + tp->symbol = strdup(symbol); diff --git a/patch/kernel/rk3399-legacy/patch-4.4.210-211.patch b/patch/kernel/rk3399-legacy/patch-4.4.210-211.patch new file mode 100644 index 000000000..fdade4d9f --- /dev/null +++ b/patch/kernel/rk3399-legacy/patch-4.4.210-211.patch @@ -0,0 +1,2692 @@ +diff --git a/Documentation/ABI/testing/sysfs-bus-mei b/Documentation/ABI/testing/sysfs-bus-mei +index 6bd45346ac7e..3f8701e8fa24 100644 +--- a/Documentation/ABI/testing/sysfs-bus-mei ++++ b/Documentation/ABI/testing/sysfs-bus-mei +@@ -4,7 +4,7 @@ KernelVersion: 3.10 + Contact: Samuel Ortiz + linux-mei@linux.intel.com + Description: Stores the same MODALIAS value emitted by uevent +- Format: mei::: ++ Format: mei::: + + What: /sys/bus/mei/devices/.../name + Date: May 2015 +diff --git a/Makefile b/Makefile +index c09b55163c2c..9f03733dac69 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,6 @@ + VERSION = 4 + PATCHLEVEL = 4 +-SUBLEVEL = 210 ++SUBLEVEL = 211 + EXTRAVERSION = + NAME = Blurry Fish Butt + +diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +index 6a37101344aa..751d8b60df1d 100644 +--- a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi ++++ b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +@@ -56,10 +56,10 @@ + + pmu { + compatible = "arm,armv8-pmuv3"; +- interrupts = <0 120 8>, +- <0 121 8>, +- <0 122 8>, +- <0 123 8>; ++ interrupts = <0 170 4>, ++ <0 171 4>, ++ <0 172 4>, ++ <0 173 4>; + interrupt-affinity = <&cpu0>, + <&cpu1>, + <&cpu2>, +diff --git a/arch/hexagon/kernel/stacktrace.c b/arch/hexagon/kernel/stacktrace.c +index f94918b449a8..03a0e10ecdcc 100644 +--- a/arch/hexagon/kernel/stacktrace.c ++++ b/arch/hexagon/kernel/stacktrace.c +@@ -23,8 +23,6 @@ + #include + #include + +-register unsigned long current_frame_pointer asm("r30"); +- + struct stackframe { + unsigned long fp; + unsigned long rets; +@@ -42,7 +40,7 @@ void save_stack_trace(struct stack_trace *trace) + + low = (unsigned long)task_stack_page(current); + high = low + THREAD_SIZE; +- fp = current_frame_pointer; ++ fp = (unsigned long)__builtin_frame_address(0); + + while (fp >= low && fp <= (high - sizeof(*frame))) { + frame = (struct stackframe *)fp; +diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S +index 86558a199139..b831e24f7168 100644 +--- a/arch/x86/boot/compressed/head_64.S ++++ b/arch/x86/boot/compressed/head_64.S +@@ -225,6 +225,11 @@ ENTRY(efi32_stub_entry) + leal efi32_config(%ebp), %eax + movl %eax, efi_config(%ebp) + ++ /* Disable paging */ ++ movl %cr0, %eax ++ btrl $X86_CR0_PG_BIT, %eax ++ movl %eax, %cr0 ++ + jmp startup_32 + ENDPROC(efi32_stub_entry) + #endif +diff --git a/block/blk-settings.c b/block/blk-settings.c +index c7bb666aafd1..eb96abdce29c 100644 +--- a/block/blk-settings.c ++++ b/block/blk-settings.c +@@ -349,7 +349,7 @@ EXPORT_SYMBOL(blk_queue_max_segment_size); + * storage device can address. The default of 512 covers most + * hardware. + **/ +-void blk_queue_logical_block_size(struct request_queue *q, unsigned short size) ++void blk_queue_logical_block_size(struct request_queue *q, unsigned int size) + { + q->limits.logical_block_size = size; + +diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c +index 2fee2eef988d..e1f71debdbba 100644 +--- a/drivers/block/xen-blkfront.c ++++ b/drivers/block/xen-blkfront.c +@@ -952,8 +952,8 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity, + if (!VDEV_IS_EXTENDED(info->vdevice)) { + err = xen_translate_vdev(info->vdevice, &minor, &offset); + if (err) +- return err; +- nr_parts = PARTS_PER_DISK; ++ return err; ++ nr_parts = PARTS_PER_DISK; + } else { + minor = BLKIF_MINOR_EXT(info->vdevice); + nr_parts = PARTS_PER_EXT_DISK; +diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c +index c94de13ce362..21bfedf40478 100644 +--- a/drivers/clk/samsung/clk-exynos5420.c ++++ b/drivers/clk/samsung/clk-exynos5420.c +@@ -166,6 +166,8 @@ static unsigned long exynos5x_clk_regs[] __initdata = { + GATE_BUS_CPU, + GATE_SCLK_CPU, + CLKOUT_CMU_CPU, ++ APLL_CON0, ++ KPLL_CON0, + CPLL_CON0, + DPLL_CON0, + EPLL_CON0, +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c +index db0801c7bb8e..503405d32d24 100644 +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -1949,8 +1949,9 @@ static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, + + if (chip->ngpio <= p->chip_hwnum) { + dev_err(dev, +- "requested GPIO %d is out of range [0..%d] for chip %s\n", +- idx, chip->ngpio, chip->label); ++ "requested GPIO %u (%u) is out of range [0..%u] for chip %s\n", ++ idx, p->chip_hwnum, chip->ngpio - 1, ++ chip->label); + return ERR_PTR(-EINVAL); + } + +diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c +index 627a24d3ea7c..ef9e196b54a5 100644 +--- a/drivers/hid/hidraw.c ++++ b/drivers/hid/hidraw.c +@@ -262,13 +262,14 @@ out: + static unsigned int hidraw_poll(struct file *file, poll_table *wait) + { + struct hidraw_list *list = file->private_data; ++ unsigned int mask = POLLOUT | POLLWRNORM; /* hidraw is always writable */ + + poll_wait(file, &list->hidraw->wait, wait); + if (list->head != list->tail) +- return POLLIN | POLLRDNORM; ++ mask |= POLLIN | POLLRDNORM; + if (!list->hidraw->exist) +- return POLLERR | POLLHUP; +- return 0; ++ mask |= POLLERR | POLLHUP; ++ return mask; + } + + static int hidraw_open(struct inode *inode, struct file *file) +diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c +index ea0c860ee842..a7ba4db8cff7 100644 +--- a/drivers/hid/uhid.c ++++ b/drivers/hid/uhid.c +@@ -769,13 +769,14 @@ unlock: + static unsigned int uhid_char_poll(struct file *file, poll_table *wait) + { + struct uhid_device *uhid = file->private_data; ++ unsigned int mask = POLLOUT | POLLWRNORM; /* uhid is always writable */ + + poll_wait(file, &uhid->waitq, wait); + + if (uhid->head != uhid->tail) +- return POLLIN | POLLRDNORM; ++ mask |= POLLIN | POLLRDNORM; + +- return EPOLLOUT | EPOLLWRNORM; ++ return mask; + } + + static const struct file_operations uhid_fops = { +diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c +index eeed374ebc6c..4ca3a4ae2743 100644 +--- a/drivers/iio/imu/adis16480.c ++++ b/drivers/iio/imu/adis16480.c +@@ -372,12 +372,14 @@ static int adis16480_get_calibbias(struct iio_dev *indio_dev, + case IIO_MAGN: + case IIO_PRESSURE: + ret = adis_read_reg_16(&st->adis, reg, &val16); +- *bias = sign_extend32(val16, 15); ++ if (ret == 0) ++ *bias = sign_extend32(val16, 15); + break; + case IIO_ANGL_VEL: + case IIO_ACCEL: + ret = adis_read_reg_32(&st->adis, reg, &val32); +- *bias = sign_extend32(val32, 31); ++ if (ret == 0) ++ *bias = sign_extend32(val32, 31); + break; + default: + ret = -EINVAL; +diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c +index cb3a8623ff54..4173fe977721 100644 +--- a/drivers/infiniband/ulp/srpt/ib_srpt.c ++++ b/drivers/infiniband/ulp/srpt/ib_srpt.c +@@ -1513,9 +1513,11 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch, + struct srpt_send_ioctx *ioctx, u64 tag, + int status) + { ++ struct se_cmd *cmd = &ioctx->cmd; + struct srp_rsp *srp_rsp; + const u8 *sense_data; + int sense_data_len, max_sense_len; ++ u32 resid = cmd->residual_count; + + /* + * The lowest bit of all SAM-3 status codes is zero (see also +@@ -1537,6 +1539,28 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch, + srp_rsp->tag = tag; + srp_rsp->status = status; + ++ if (cmd->se_cmd_flags & SCF_UNDERFLOW_BIT) { ++ if (cmd->data_direction == DMA_TO_DEVICE) { ++ /* residual data from an underflow write */ ++ srp_rsp->flags = SRP_RSP_FLAG_DOUNDER; ++ srp_rsp->data_out_res_cnt = cpu_to_be32(resid); ++ } else if (cmd->data_direction == DMA_FROM_DEVICE) { ++ /* residual data from an underflow read */ ++ srp_rsp->flags = SRP_RSP_FLAG_DIUNDER; ++ srp_rsp->data_in_res_cnt = cpu_to_be32(resid); ++ } ++ } else if (cmd->se_cmd_flags & SCF_OVERFLOW_BIT) { ++ if (cmd->data_direction == DMA_TO_DEVICE) { ++ /* residual data from an overflow write */ ++ srp_rsp->flags = SRP_RSP_FLAG_DOOVER; ++ srp_rsp->data_out_res_cnt = cpu_to_be32(resid); ++ } else if (cmd->data_direction == DMA_FROM_DEVICE) { ++ /* residual data from an overflow read */ ++ srp_rsp->flags = SRP_RSP_FLAG_DIOVER; ++ srp_rsp->data_in_res_cnt = cpu_to_be32(resid); ++ } ++ } ++ + if (sense_data_len) { + BUILD_BUG_ON(MIN_MAX_RSP_SIZE <= sizeof(*srp_rsp)); + max_sense_len = ch->max_ti_iu_len - sizeof(*srp_rsp); +diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c +index a070fa39521a..5d5066cf3bbd 100644 +--- a/drivers/iommu/iommu.c ++++ b/drivers/iommu/iommu.c +@@ -447,6 +447,7 @@ err_put_group: + mutex_unlock(&group->mutex); + dev->iommu_group = NULL; + kobject_put(group->devices_kobj); ++ sysfs_remove_link(group->devices_kobj, device->name); + err_free_name: + kfree(device->name); + err_remove_link: +diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c +index 4d3909393f2c..5c793ac11108 100644 +--- a/drivers/md/dm-snap-persistent.c ++++ b/drivers/md/dm-snap-persistent.c +@@ -17,7 +17,7 @@ + #include "dm-bufio.h" + + #define DM_MSG_PREFIX "persistent snapshot" +-#define DM_CHUNK_SIZE_DEFAULT_SECTORS 32 /* 16KB */ ++#define DM_CHUNK_SIZE_DEFAULT_SECTORS 32U /* 16KB */ + + #define DM_PREFETCH_CHUNKS 12 + +diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c +index f8e5db0cb5aa..62a4fca62776 100644 +--- a/drivers/md/raid0.c ++++ b/drivers/md/raid0.c +@@ -83,7 +83,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) + char b[BDEVNAME_SIZE]; + char b2[BDEVNAME_SIZE]; + struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL); +- unsigned short blksize = 512; ++ unsigned blksize = 512; + + if (!conf) + return -ENOMEM; +diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c +index 667d3720154a..4b7803cec37f 100644 +--- a/drivers/media/platform/exynos4-is/fimc-isp-video.c ++++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c +@@ -323,7 +323,7 @@ static int isp_video_release(struct file *file) + ivc->streaming = 0; + } + +- vb2_fop_release(file); ++ _vb2_fop_release(file, NULL); + + if (v4l2_fh_is_singular_file(file)) { + fimc_pipeline_call(&ivc->ve, close); +diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c +index fd6a3b36208e..2d56cccaa474 100644 +--- a/drivers/media/usb/zr364xx/zr364xx.c ++++ b/drivers/media/usb/zr364xx/zr364xx.c +@@ -711,7 +711,8 @@ static int zr364xx_vidioc_querycap(struct file *file, void *priv, + struct zr364xx_camera *cam = video_drvdata(file); + + strlcpy(cap->driver, DRIVER_DESC, sizeof(cap->driver)); +- strlcpy(cap->card, cam->udev->product, sizeof(cap->card)); ++ if (cam->udev->product) ++ strlcpy(cap->card, cam->udev->product, sizeof(cap->card)); + strlcpy(cap->bus_info, dev_name(&cam->udev->dev), + sizeof(cap->bus_info)); + cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | +diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c +index 14cf6dfc3b14..4d837bcad5db 100644 +--- a/drivers/message/fusion/mptctl.c ++++ b/drivers/message/fusion/mptctl.c +@@ -100,19 +100,19 @@ struct buflist { + * Function prototypes. Called from OS entry point mptctl_ioctl. + * arg contents specific to function. + */ +-static int mptctl_fw_download(unsigned long arg); +-static int mptctl_getiocinfo(unsigned long arg, unsigned int cmd); +-static int mptctl_gettargetinfo(unsigned long arg); +-static int mptctl_readtest(unsigned long arg); +-static int mptctl_mpt_command(unsigned long arg); +-static int mptctl_eventquery(unsigned long arg); +-static int mptctl_eventenable(unsigned long arg); +-static int mptctl_eventreport(unsigned long arg); +-static int mptctl_replace_fw(unsigned long arg); +- +-static int mptctl_do_reset(unsigned long arg); +-static int mptctl_hp_hostinfo(unsigned long arg, unsigned int cmd); +-static int mptctl_hp_targetinfo(unsigned long arg); ++static int mptctl_fw_download(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_getiocinfo(MPT_ADAPTER *iocp, unsigned long arg, unsigned int cmd); ++static int mptctl_gettargetinfo(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_readtest(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_mpt_command(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_eventquery(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_eventenable(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_eventreport(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_replace_fw(MPT_ADAPTER *iocp, unsigned long arg); ++ ++static int mptctl_do_reset(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_hp_hostinfo(MPT_ADAPTER *iocp, unsigned long arg, unsigned int cmd); ++static int mptctl_hp_targetinfo(MPT_ADAPTER *iocp, unsigned long arg); + + static int mptctl_probe(struct pci_dev *, const struct pci_device_id *); + static void mptctl_remove(struct pci_dev *); +@@ -123,8 +123,8 @@ static long compat_mpctl_ioctl(struct file *f, unsigned cmd, unsigned long arg); + /* + * Private function calls. + */ +-static int mptctl_do_mpt_command(struct mpt_ioctl_command karg, void __user *mfPtr); +-static int mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen); ++static int mptctl_do_mpt_command(MPT_ADAPTER *iocp, struct mpt_ioctl_command karg, void __user *mfPtr); ++static int mptctl_do_fw_download(MPT_ADAPTER *iocp, char __user *ufwbuf, size_t fwlen); + static MptSge_t *kbuf_alloc_2_sgl(int bytes, u32 dir, int sge_offset, int *frags, + struct buflist **blp, dma_addr_t *sglbuf_dma, MPT_ADAPTER *ioc); + static void kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, +@@ -656,19 +656,19 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + * by TM and FW reloads. + */ + if ((cmd & ~IOCSIZE_MASK) == (MPTIOCINFO & ~IOCSIZE_MASK)) { +- return mptctl_getiocinfo(arg, _IOC_SIZE(cmd)); ++ return mptctl_getiocinfo(iocp, arg, _IOC_SIZE(cmd)); + } else if (cmd == MPTTARGETINFO) { +- return mptctl_gettargetinfo(arg); ++ return mptctl_gettargetinfo(iocp, arg); + } else if (cmd == MPTTEST) { +- return mptctl_readtest(arg); ++ return mptctl_readtest(iocp, arg); + } else if (cmd == MPTEVENTQUERY) { +- return mptctl_eventquery(arg); ++ return mptctl_eventquery(iocp, arg); + } else if (cmd == MPTEVENTENABLE) { +- return mptctl_eventenable(arg); ++ return mptctl_eventenable(iocp, arg); + } else if (cmd == MPTEVENTREPORT) { +- return mptctl_eventreport(arg); ++ return mptctl_eventreport(iocp, arg); + } else if (cmd == MPTFWREPLACE) { +- return mptctl_replace_fw(arg); ++ return mptctl_replace_fw(iocp, arg); + } + + /* All of these commands require an interrupt or +@@ -678,15 +678,15 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + return ret; + + if (cmd == MPTFWDOWNLOAD) +- ret = mptctl_fw_download(arg); ++ ret = mptctl_fw_download(iocp, arg); + else if (cmd == MPTCOMMAND) +- ret = mptctl_mpt_command(arg); ++ ret = mptctl_mpt_command(iocp, arg); + else if (cmd == MPTHARDRESET) +- ret = mptctl_do_reset(arg); ++ ret = mptctl_do_reset(iocp, arg); + else if ((cmd & ~IOCSIZE_MASK) == (HP_GETHOSTINFO & ~IOCSIZE_MASK)) +- ret = mptctl_hp_hostinfo(arg, _IOC_SIZE(cmd)); ++ ret = mptctl_hp_hostinfo(iocp, arg, _IOC_SIZE(cmd)); + else if (cmd == HP_GETTARGETINFO) +- ret = mptctl_hp_targetinfo(arg); ++ ret = mptctl_hp_targetinfo(iocp, arg); + else + ret = -EINVAL; + +@@ -705,11 +705,10 @@ mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + return ret; + } + +-static int mptctl_do_reset(unsigned long arg) ++static int mptctl_do_reset(MPT_ADAPTER *iocp, unsigned long arg) + { + struct mpt_ioctl_diag_reset __user *urinfo = (void __user *) arg; + struct mpt_ioctl_diag_reset krinfo; +- MPT_ADAPTER *iocp; + + if (copy_from_user(&krinfo, urinfo, sizeof(struct mpt_ioctl_diag_reset))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_do_reset - " +@@ -718,12 +717,6 @@ static int mptctl_do_reset(unsigned long arg) + return -EFAULT; + } + +- if (mpt_verify_adapter(krinfo.hdr.iocnum, &iocp) < 0) { +- printk(KERN_DEBUG MYNAM "%s@%d::mptctl_do_reset - ioc%d not found!\n", +- __FILE__, __LINE__, krinfo.hdr.iocnum); +- return -ENODEV; /* (-6) No such device or address */ +- } +- + dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "mptctl_do_reset called.\n", + iocp->name)); + +@@ -754,7 +747,7 @@ static int mptctl_do_reset(unsigned long arg) + * -ENOMSG if FW upload returned bad status + */ + static int +-mptctl_fw_download(unsigned long arg) ++mptctl_fw_download(MPT_ADAPTER *iocp, unsigned long arg) + { + struct mpt_fw_xfer __user *ufwdl = (void __user *) arg; + struct mpt_fw_xfer kfwdl; +@@ -766,7 +759,7 @@ mptctl_fw_download(unsigned long arg) + return -EFAULT; + } + +- return mptctl_do_fw_download(kfwdl.iocnum, kfwdl.bufp, kfwdl.fwlen); ++ return mptctl_do_fw_download(iocp, kfwdl.bufp, kfwdl.fwlen); + } + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ +@@ -784,11 +777,10 @@ mptctl_fw_download(unsigned long arg) + * -ENOMSG if FW upload returned bad status + */ + static int +-mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) ++mptctl_do_fw_download(MPT_ADAPTER *iocp, char __user *ufwbuf, size_t fwlen) + { + FWDownload_t *dlmsg; + MPT_FRAME_HDR *mf; +- MPT_ADAPTER *iocp; + FWDownloadTCSGE_t *ptsge; + MptSge_t *sgl, *sgIn; + char *sgOut; +@@ -808,17 +800,10 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) + pFWDownloadReply_t ReplyMsg = NULL; + unsigned long timeleft; + +- if (mpt_verify_adapter(ioc, &iocp) < 0) { +- printk(KERN_DEBUG MYNAM "ioctl_fwdl - ioc%d not found!\n", +- ioc); +- return -ENODEV; /* (-6) No such device or address */ +- } else { +- +- /* Valid device. Get a message frame and construct the FW download message. +- */ +- if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL) +- return -EAGAIN; +- } ++ /* Valid device. Get a message frame and construct the FW download message. ++ */ ++ if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL) ++ return -EAGAIN; + + dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT + "mptctl_do_fwdl called. mptctl_id = %xh.\n", iocp->name, mptctl_id)); +@@ -826,8 +811,6 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) + iocp->name, ufwbuf)); + dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.fwlen = %d\n", + iocp->name, (int)fwlen)); +- dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.ioc = %04xh\n", +- iocp->name, ioc)); + + dlmsg = (FWDownload_t*) mf; + ptsge = (FWDownloadTCSGE_t *) &dlmsg->SGL; +@@ -1238,13 +1221,11 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE + * -ENODEV if no such device/adapter + */ + static int +-mptctl_getiocinfo (unsigned long arg, unsigned int data_size) ++mptctl_getiocinfo (MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size) + { + struct mpt_ioctl_iocinfo __user *uarg = (void __user *) arg; + struct mpt_ioctl_iocinfo *karg; +- MPT_ADAPTER *ioc; + struct pci_dev *pdev; +- int iocnum; + unsigned int port; + int cim_rev; + struct scsi_device *sdev; +@@ -1272,14 +1253,6 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) + return PTR_ERR(karg); + } + +- if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- kfree(karg); +- return -ENODEV; +- } +- + /* Verify the data transfer size is correct. */ + if (karg->hdr.maxDataSize != data_size) { + printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_getiocinfo - " +@@ -1385,15 +1358,13 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) + * -ENODEV if no such device/adapter + */ + static int +-mptctl_gettargetinfo (unsigned long arg) ++mptctl_gettargetinfo (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_targetinfo __user *uarg = (void __user *) arg; + struct mpt_ioctl_targetinfo karg; +- MPT_ADAPTER *ioc; + VirtDevice *vdevice; + char *pmem; + int *pdata; +- int iocnum; + int numDevices = 0; + int lun; + int maxWordsLeft; +@@ -1408,13 +1379,6 @@ mptctl_gettargetinfo (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_gettargetinfo called.\n", + ioc->name)); + /* Get the port number and set the maximum number of bytes +@@ -1510,12 +1474,10 @@ mptctl_gettargetinfo (unsigned long arg) + * -ENODEV if no such device/adapter + */ + static int +-mptctl_readtest (unsigned long arg) ++mptctl_readtest (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_test __user *uarg = (void __user *) arg; + struct mpt_ioctl_test karg; +- MPT_ADAPTER *ioc; +- int iocnum; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_readtest - " +@@ -1524,13 +1486,6 @@ mptctl_readtest (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_readtest() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_readtest called.\n", + ioc->name)); + /* Fill in the data and return the structure to the calling +@@ -1571,12 +1526,10 @@ mptctl_readtest (unsigned long arg) + * -ENODEV if no such device/adapter + */ + static int +-mptctl_eventquery (unsigned long arg) ++mptctl_eventquery (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_eventquery __user *uarg = (void __user *) arg; + struct mpt_ioctl_eventquery karg; +- MPT_ADAPTER *ioc; +- int iocnum; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventquery))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_eventquery - " +@@ -1585,13 +1538,6 @@ mptctl_eventquery (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_eventquery() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventquery called.\n", + ioc->name)); + karg.eventEntries = MPTCTL_EVENT_LOG_SIZE; +@@ -1610,12 +1556,10 @@ mptctl_eventquery (unsigned long arg) + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ + static int +-mptctl_eventenable (unsigned long arg) ++mptctl_eventenable (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_eventenable __user *uarg = (void __user *) arg; + struct mpt_ioctl_eventenable karg; +- MPT_ADAPTER *ioc; +- int iocnum; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_eventenable - " +@@ -1624,13 +1568,6 @@ mptctl_eventenable (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_eventenable() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventenable called.\n", + ioc->name)); + if (ioc->events == NULL) { +@@ -1658,12 +1595,10 @@ mptctl_eventenable (unsigned long arg) + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ + static int +-mptctl_eventreport (unsigned long arg) ++mptctl_eventreport (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_eventreport __user *uarg = (void __user *) arg; + struct mpt_ioctl_eventreport karg; +- MPT_ADAPTER *ioc; +- int iocnum; + int numBytes, maxEvents, max; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventreport))) { +@@ -1673,12 +1608,6 @@ mptctl_eventreport (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_eventreport() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventreport called.\n", + ioc->name)); + +@@ -1712,12 +1641,10 @@ mptctl_eventreport (unsigned long arg) + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ + static int +-mptctl_replace_fw (unsigned long arg) ++mptctl_replace_fw (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_replace_fw __user *uarg = (void __user *) arg; + struct mpt_ioctl_replace_fw karg; +- MPT_ADAPTER *ioc; +- int iocnum; + int newFwSize; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) { +@@ -1727,13 +1654,6 @@ mptctl_replace_fw (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_replace_fw() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_replace_fw called.\n", + ioc->name)); + /* If caching FW, Free the old FW image +@@ -1780,12 +1700,10 @@ mptctl_replace_fw (unsigned long arg) + * -ENOMEM if memory allocation error + */ + static int +-mptctl_mpt_command (unsigned long arg) ++mptctl_mpt_command (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_command __user *uarg = (void __user *) arg; + struct mpt_ioctl_command karg; +- MPT_ADAPTER *ioc; +- int iocnum; + int rc; + + +@@ -1796,14 +1714,7 @@ mptctl_mpt_command (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_mpt_command() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- +- rc = mptctl_do_mpt_command (karg, &uarg->MF); ++ rc = mptctl_do_mpt_command (ioc, karg, &uarg->MF); + + return rc; + } +@@ -1821,9 +1732,8 @@ mptctl_mpt_command (unsigned long arg) + * -EPERM if SCSI I/O and target is untagged + */ + static int +-mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) ++mptctl_do_mpt_command (MPT_ADAPTER *ioc, struct mpt_ioctl_command karg, void __user *mfPtr) + { +- MPT_ADAPTER *ioc; + MPT_FRAME_HDR *mf = NULL; + MPIHeader_t *hdr; + char *psge; +@@ -1832,7 +1742,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) + dma_addr_t dma_addr_in; + dma_addr_t dma_addr_out; + int sgSize = 0; /* Num SG elements */ +- int iocnum, flagsLength; ++ int flagsLength; + int sz, rc = 0; + int msgContext; + u16 req_idx; +@@ -1847,13 +1757,6 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) + bufIn.kptr = bufOut.kptr = NULL; + bufIn.len = bufOut.len = 0; + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + spin_lock_irqsave(&ioc->taskmgmt_lock, flags); + if (ioc->ioc_reset_in_progress) { + spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags); +@@ -2418,17 +2321,15 @@ done_free_mem: + * -ENOMEM if memory allocation error + */ + static int +-mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) ++mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size) + { + hp_host_info_t __user *uarg = (void __user *) arg; +- MPT_ADAPTER *ioc; + struct pci_dev *pdev; + char *pbuf=NULL; + dma_addr_t buf_dma; + hp_host_info_t karg; + CONFIGPARMS cfg; + ConfigPageHeader_t hdr; +- int iocnum; + int rc, cim_rev; + ToolboxIstwiReadWriteRequest_t *IstwiRWRequest; + MPT_FRAME_HDR *mf = NULL; +@@ -2452,12 +2353,6 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": mptctl_hp_hostinfo called.\n", + ioc->name)); + +@@ -2670,15 +2565,13 @@ retry_wait: + * -ENOMEM if memory allocation error + */ + static int +-mptctl_hp_targetinfo(unsigned long arg) ++mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg) + { + hp_target_info_t __user *uarg = (void __user *) arg; + SCSIDevicePage0_t *pg0_alloc; + SCSIDevicePage3_t *pg3_alloc; +- MPT_ADAPTER *ioc; + MPT_SCSI_HOST *hd = NULL; + hp_target_info_t karg; +- int iocnum; + int data_sz; + dma_addr_t page_dma; + CONFIGPARMS cfg; +@@ -2692,12 +2585,6 @@ mptctl_hp_targetinfo(unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } + if (karg.hdr.id >= MPT_MAX_FC_DEVICES) + return -EINVAL; + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_hp_targetinfo called.\n", +@@ -2865,7 +2752,7 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd, + kfw.fwlen = kfw32.fwlen; + kfw.bufp = compat_ptr(kfw32.bufp); + +- ret = mptctl_do_fw_download(kfw.iocnum, kfw.bufp, kfw.fwlen); ++ ret = mptctl_do_fw_download(iocp, kfw.bufp, kfw.fwlen); + + mutex_unlock(&iocp->ioctl_cmds.mutex); + +@@ -2919,7 +2806,7 @@ compat_mpt_command(struct file *filp, unsigned int cmd, + + /* Pass new structure to do_mpt_command + */ +- ret = mptctl_do_mpt_command (karg, &uarg->MF); ++ ret = mptctl_do_mpt_command (iocp, karg, &uarg->MF); + + mutex_unlock(&iocp->ioctl_cmds.mutex); + +diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c +index eb29113e0bac..b11737f7bdca 100644 +--- a/drivers/misc/enclosure.c ++++ b/drivers/misc/enclosure.c +@@ -419,10 +419,9 @@ int enclosure_remove_device(struct enclosure_device *edev, struct device *dev) + cdev = &edev->component[i]; + if (cdev->dev == dev) { + enclosure_remove_links(cdev); +- device_del(&cdev->cdev); + put_device(dev); + cdev->dev = NULL; +- return device_add(&cdev->cdev); ++ return 0; + } + } + return -ENODEV; +diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h +index 803df6a32ba9..a942d2d84ed2 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/common.h ++++ b/drivers/net/ethernet/stmicro/stmmac/common.h +@@ -273,8 +273,8 @@ struct dma_features { + unsigned int enh_desc; + }; + +-/* GMAC TX FIFO is 8K, Rx FIFO is 16K */ +-#define BUF_SIZE_16KiB 16384 ++/* RX Buffer size must be multiple of 4/8/16 bytes */ ++#define BUF_SIZE_16KiB 16368 + #define BUF_SIZE_8KiB 8192 + #define BUF_SIZE_4KiB 4096 + #define BUF_SIZE_2KiB 2048 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +index 28a6b7764044..6f695239e658 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -935,7 +935,9 @@ static int stmmac_set_bfsize(int mtu, int bufsize) + { + int ret = bufsize; + +- if (mtu >= BUF_SIZE_4KiB) ++ if (mtu >= BUF_SIZE_8KiB) ++ ret = BUF_SIZE_16KiB; ++ else if (mtu >= BUF_SIZE_4KiB) + ret = BUF_SIZE_8KiB; + else if (mtu >= BUF_SIZE_2KiB) + ret = BUF_SIZE_4KiB; +diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c +index eb825ea52d6b..bd49303f7db2 100644 +--- a/drivers/net/macvlan.c ++++ b/drivers/net/macvlan.c +@@ -233,7 +233,7 @@ static void macvlan_broadcast(struct sk_buff *skb, + struct net_device *src, + enum macvlan_mode mode) + { +- const struct ethhdr *eth = skb_eth_hdr(skb); ++ const struct ethhdr *eth = eth_hdr(skb); + const struct macvlan_dev *vlan; + struct sk_buff *nskb; + unsigned int i; +@@ -476,10 +476,11 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev) + const struct macvlan_dev *dest; + + if (vlan->mode == MACVLAN_MODE_BRIDGE) { +- const struct ethhdr *eth = (void *)skb->data; ++ const struct ethhdr *eth = skb_eth_hdr(skb); + + /* send to other bridge ports directly */ + if (is_multicast_ether_addr(eth->h_dest)) { ++ skb_reset_mac_header(skb); + macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE); + goto xmit_world; + } +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c +index 0d138bc60b18..4174b24963b9 100644 +--- a/drivers/net/usb/lan78xx.c ++++ b/drivers/net/usb/lan78xx.c +@@ -2961,6 +2961,7 @@ static int lan78xx_probe(struct usb_interface *intf, + + if (netdev->mtu > (dev->hard_mtu - netdev->hard_header_len)) + netdev->mtu = dev->hard_mtu - netdev->hard_header_len; ++ netif_set_gso_max_size(netdev, MAX_SINGLE_PACKET_SIZE - MAX_HEADER); + + dev->ep_blkin = (intf->cur_altsetting)->endpoint + 0; + dev->ep_blkout = (intf->cur_altsetting)->endpoint + 1; +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c +index 10dd307593e8..db8b489b0513 100644 +--- a/drivers/net/usb/r8152.c ++++ b/drivers/net/usb/r8152.c +@@ -4243,6 +4243,9 @@ static int rtl8152_probe(struct usb_interface *intf, + return -ENODEV; + } + ++ if (intf->cur_altsetting->desc.bNumEndpoints < 3) ++ return -ENODEV; ++ + usb_reset_device(udev); + netdev = alloc_etherdev(sizeof(struct r8152)); + if (!netdev) { +diff --git a/drivers/net/wimax/i2400m/op-rfkill.c b/drivers/net/wimax/i2400m/op-rfkill.c +index b0dba35a8ad2..dc6fe93ce71f 100644 +--- a/drivers/net/wimax/i2400m/op-rfkill.c ++++ b/drivers/net/wimax/i2400m/op-rfkill.c +@@ -147,6 +147,7 @@ error_msg_to_dev: + error_alloc: + d_fnend(4, dev, "(wimax_dev %p state %d) = %d\n", + wimax_dev, state, result); ++ kfree(cmd); + return result; + } + +diff --git a/drivers/net/wireless/cw1200/fwio.c b/drivers/net/wireless/cw1200/fwio.c +index 30e7646d04af..16be7fa82a23 100644 +--- a/drivers/net/wireless/cw1200/fwio.c ++++ b/drivers/net/wireless/cw1200/fwio.c +@@ -323,12 +323,12 @@ int cw1200_load_firmware(struct cw1200_common *priv) + goto out; + } + +- priv->hw_type = cw1200_get_hw_type(val32, &major_revision); +- if (priv->hw_type < 0) { ++ ret = cw1200_get_hw_type(val32, &major_revision); ++ if (ret < 0) { + pr_err("Can't deduce hardware type.\n"); +- ret = -ENOTSUPP; + goto out; + } ++ priv->hw_type = ret; + + /* Set DPLL Reg value, and read back to confirm writes work */ + ret = cw1200_reg_write_32(priv, ST90TDS_TSET_GEN_R_W_REG_ID, +diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c +index 043bd1c23c19..4a197a32d78c 100644 +--- a/drivers/net/wireless/p54/p54usb.c ++++ b/drivers/net/wireless/p54/p54usb.c +@@ -33,6 +33,8 @@ MODULE_ALIAS("prism54usb"); + MODULE_FIRMWARE("isl3886usb"); + MODULE_FIRMWARE("isl3887usb"); + ++static struct usb_driver p54u_driver; ++ + /* + * Note: + * +@@ -921,9 +923,9 @@ static void p54u_load_firmware_cb(const struct firmware *firmware, + { + struct p54u_priv *priv = context; + struct usb_device *udev = priv->udev; ++ struct usb_interface *intf = priv->intf; + int err; + +- complete(&priv->fw_wait_load); + if (firmware) { + priv->fw = firmware; + err = p54u_start_ops(priv); +@@ -932,26 +934,22 @@ static void p54u_load_firmware_cb(const struct firmware *firmware, + dev_err(&udev->dev, "Firmware not found.\n"); + } + +- if (err) { +- struct device *parent = priv->udev->dev.parent; +- +- dev_err(&udev->dev, "failed to initialize device (%d)\n", err); +- +- if (parent) +- device_lock(parent); ++ complete(&priv->fw_wait_load); ++ /* ++ * At this point p54u_disconnect may have already freed ++ * the "priv" context. Do not use it anymore! ++ */ ++ priv = NULL; + +- device_release_driver(&udev->dev); +- /* +- * At this point p54u_disconnect has already freed +- * the "priv" context. Do not use it anymore! +- */ +- priv = NULL; ++ if (err) { ++ dev_err(&intf->dev, "failed to initialize device (%d)\n", err); + +- if (parent) +- device_unlock(parent); ++ usb_lock_device(udev); ++ usb_driver_release_interface(&p54u_driver, intf); ++ usb_unlock_device(udev); + } + +- usb_put_dev(udev); ++ usb_put_intf(intf); + } + + static int p54u_load_firmware(struct ieee80211_hw *dev, +@@ -972,14 +970,14 @@ static int p54u_load_firmware(struct ieee80211_hw *dev, + dev_info(&priv->udev->dev, "Loading firmware file %s\n", + p54u_fwlist[i].fw); + +- usb_get_dev(udev); ++ usb_get_intf(intf); + err = request_firmware_nowait(THIS_MODULE, 1, p54u_fwlist[i].fw, + device, GFP_KERNEL, priv, + p54u_load_firmware_cb); + if (err) { + dev_err(&priv->udev->dev, "(p54usb) cannot load firmware %s " + "(%d)!\n", p54u_fwlist[i].fw, err); +- usb_put_dev(udev); ++ usb_put_intf(intf); + } + + return err; +@@ -1011,8 +1009,6 @@ static int p54u_probe(struct usb_interface *intf, + skb_queue_head_init(&priv->rx_queue); + init_usb_anchor(&priv->submitted); + +- usb_get_dev(udev); +- + /* really lazy and simple way of figuring out if we're a 3887 */ + /* TODO: should just stick the identification in the device table */ + i = intf->altsetting->desc.bNumEndpoints; +@@ -1053,10 +1049,8 @@ static int p54u_probe(struct usb_interface *intf, + priv->upload_fw = p54u_upload_firmware_net2280; + } + err = p54u_load_firmware(dev, intf); +- if (err) { +- usb_put_dev(udev); ++ if (err) + p54_free_common(dev); +- } + return err; + } + +@@ -1072,7 +1066,6 @@ static void p54u_disconnect(struct usb_interface *intf) + wait_for_completion(&priv->fw_wait_load); + p54_unregister_common(dev); + +- usb_put_dev(interface_to_usbdev(intf)); + release_firmware(priv->fw); + p54_free_common(dev); + } +diff --git a/drivers/net/wireless/realtek/rtlwifi/regd.c b/drivers/net/wireless/realtek/rtlwifi/regd.c +index f67e7e5b13e1..005bd7abc247 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/regd.c ++++ b/drivers/net/wireless/realtek/rtlwifi/regd.c +@@ -427,7 +427,7 @@ int rtl_regd_init(struct ieee80211_hw *hw, + struct wiphy *wiphy = hw->wiphy; + struct country_code_to_enum_rd *country = NULL; + +- if (wiphy == NULL || &rtlpriv->regd == NULL) ++ if (!wiphy) + return -EINVAL; + + /* init country_code from efuse channel plan */ +diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c +index 4df992de7d07..2f40506a5821 100644 +--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c ++++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c +@@ -199,6 +199,7 @@ void rsi_mac80211_detach(struct rsi_hw *adapter) + ieee80211_stop_queues(hw); + ieee80211_unregister_hw(hw); + ieee80211_free_hw(hw); ++ adapter->hw = NULL; + } + + rsi_remove_dbgfs(adapter); +diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c +index 63b5b6838e8b..ca1d507aa532 100644 +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -452,13 +452,7 @@ static void kbd_led_update(struct work_struct *work) + + asus = container_of(work, struct asus_wmi, kbd_led_work); + +- /* +- * bits 0-2: level +- * bit 7: light on/off +- */ +- if (asus->kbd_led_wk > 0) +- ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F); +- ++ ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F); + asus_wmi_set_devstate(ASUS_WMI_DEVID_KBD_BACKLIGHT, ctrl_param, NULL); + } + +diff --git a/drivers/rtc/rtc-msm6242.c b/drivers/rtc/rtc-msm6242.c +index c1c5c4e3b3b4..c981301efbe5 100644 +--- a/drivers/rtc/rtc-msm6242.c ++++ b/drivers/rtc/rtc-msm6242.c +@@ -132,7 +132,8 @@ static int msm6242_read_time(struct device *dev, struct rtc_time *tm) + msm6242_read(priv, MSM6242_SECOND1); + tm->tm_min = msm6242_read(priv, MSM6242_MINUTE10) * 10 + + msm6242_read(priv, MSM6242_MINUTE1); +- tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10 & 3)) * 10 + ++ tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10) & ++ MSM6242_HOUR10_HR_MASK) * 10 + + msm6242_read(priv, MSM6242_HOUR1); + tm->tm_mday = msm6242_read(priv, MSM6242_DAY10) * 10 + + msm6242_read(priv, MSM6242_DAY1); +diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c +index 06a5c52b292f..74740ed3a7c3 100644 +--- a/drivers/rtc/rtc-mt6397.c ++++ b/drivers/rtc/rtc-mt6397.c +@@ -55,6 +55,14 @@ + + #define RTC_AL_SEC 0x0018 + ++#define RTC_AL_SEC_MASK 0x003f ++#define RTC_AL_MIN_MASK 0x003f ++#define RTC_AL_HOU_MASK 0x001f ++#define RTC_AL_DOM_MASK 0x001f ++#define RTC_AL_DOW_MASK 0x0007 ++#define RTC_AL_MTH_MASK 0x000f ++#define RTC_AL_YEA_MASK 0x007f ++ + #define RTC_PDN2 0x002e + #define RTC_PDN2_PWRON_ALARM BIT(4) + +@@ -111,7 +119,7 @@ static irqreturn_t mtk_rtc_irq_handler_thread(int irq, void *data) + irqen = irqsta & ~RTC_IRQ_EN_AL; + mutex_lock(&rtc->lock); + if (regmap_write(rtc->regmap, rtc->addr_base + RTC_IRQ_EN, +- irqen) < 0) ++ irqen) == 0) + mtk_rtc_write_trigger(rtc); + mutex_unlock(&rtc->lock); + +@@ -233,12 +241,12 @@ static int mtk_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) + alm->pending = !!(pdn2 & RTC_PDN2_PWRON_ALARM); + mutex_unlock(&rtc->lock); + +- tm->tm_sec = data[RTC_OFFSET_SEC]; +- tm->tm_min = data[RTC_OFFSET_MIN]; +- tm->tm_hour = data[RTC_OFFSET_HOUR]; +- tm->tm_mday = data[RTC_OFFSET_DOM]; +- tm->tm_mon = data[RTC_OFFSET_MTH]; +- tm->tm_year = data[RTC_OFFSET_YEAR]; ++ tm->tm_sec = data[RTC_OFFSET_SEC] & RTC_AL_SEC_MASK; ++ tm->tm_min = data[RTC_OFFSET_MIN] & RTC_AL_MIN_MASK; ++ tm->tm_hour = data[RTC_OFFSET_HOUR] & RTC_AL_HOU_MASK; ++ tm->tm_mday = data[RTC_OFFSET_DOM] & RTC_AL_DOM_MASK; ++ tm->tm_mon = data[RTC_OFFSET_MTH] & RTC_AL_MTH_MASK; ++ tm->tm_year = data[RTC_OFFSET_YEAR] & RTC_AL_YEA_MASK; + + tm->tm_year += RTC_MIN_YEAR_OFFSET; + tm->tm_mon--; +@@ -259,14 +267,25 @@ static int mtk_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) + tm->tm_year -= RTC_MIN_YEAR_OFFSET; + tm->tm_mon++; + +- data[RTC_OFFSET_SEC] = tm->tm_sec; +- data[RTC_OFFSET_MIN] = tm->tm_min; +- data[RTC_OFFSET_HOUR] = tm->tm_hour; +- data[RTC_OFFSET_DOM] = tm->tm_mday; +- data[RTC_OFFSET_MTH] = tm->tm_mon; +- data[RTC_OFFSET_YEAR] = tm->tm_year; +- + mutex_lock(&rtc->lock); ++ ret = regmap_bulk_read(rtc->regmap, rtc->addr_base + RTC_AL_SEC, ++ data, RTC_OFFSET_COUNT); ++ if (ret < 0) ++ goto exit; ++ ++ data[RTC_OFFSET_SEC] = ((data[RTC_OFFSET_SEC] & ~(RTC_AL_SEC_MASK)) | ++ (tm->tm_sec & RTC_AL_SEC_MASK)); ++ data[RTC_OFFSET_MIN] = ((data[RTC_OFFSET_MIN] & ~(RTC_AL_MIN_MASK)) | ++ (tm->tm_min & RTC_AL_MIN_MASK)); ++ data[RTC_OFFSET_HOUR] = ((data[RTC_OFFSET_HOUR] & ~(RTC_AL_HOU_MASK)) | ++ (tm->tm_hour & RTC_AL_HOU_MASK)); ++ data[RTC_OFFSET_DOM] = ((data[RTC_OFFSET_DOM] & ~(RTC_AL_DOM_MASK)) | ++ (tm->tm_mday & RTC_AL_DOM_MASK)); ++ data[RTC_OFFSET_MTH] = ((data[RTC_OFFSET_MTH] & ~(RTC_AL_MTH_MASK)) | ++ (tm->tm_mon & RTC_AL_MTH_MASK)); ++ data[RTC_OFFSET_YEAR] = ((data[RTC_OFFSET_YEAR] & ~(RTC_AL_YEA_MASK)) | ++ (tm->tm_year & RTC_AL_YEA_MASK)); ++ + if (alm->enabled) { + ret = regmap_bulk_write(rtc->regmap, + rtc->addr_base + RTC_AL_SEC, +diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c +index 72894378ffcf..81de52943b01 100644 +--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c ++++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c +@@ -915,12 +915,12 @@ void bnx2i_free_hba(struct bnx2i_hba *hba) + INIT_LIST_HEAD(&hba->ep_ofld_list); + INIT_LIST_HEAD(&hba->ep_active_list); + INIT_LIST_HEAD(&hba->ep_destroy_list); +- pci_dev_put(hba->pcidev); + + if (hba->regview) { + pci_iounmap(hba->pcidev, hba->regview); + hba->regview = NULL; + } ++ pci_dev_put(hba->pcidev); + bnx2i_free_mp_bdt(hba); + bnx2i_release_free_cid_que(hba); + iscsi_host_free(shost); +diff --git a/drivers/scsi/esas2r/esas2r_flash.c b/drivers/scsi/esas2r/esas2r_flash.c +index 7bd376d95ed5..b02ac389e6c6 100644 +--- a/drivers/scsi/esas2r/esas2r_flash.c ++++ b/drivers/scsi/esas2r/esas2r_flash.c +@@ -1197,6 +1197,7 @@ bool esas2r_nvram_read_direct(struct esas2r_adapter *a) + if (!esas2r_read_flash_block(a, a->nvram, FLS_OFFSET_NVR, + sizeof(struct esas2r_sas_nvram))) { + esas2r_hdebug("NVRAM read failed, using defaults"); ++ up(&a->nvram_semaphore); + return false; + } + +diff --git a/drivers/scsi/fnic/vnic_dev.c b/drivers/scsi/fnic/vnic_dev.c +index 9795d6f3e197..c5b89a003d2a 100644 +--- a/drivers/scsi/fnic/vnic_dev.c ++++ b/drivers/scsi/fnic/vnic_dev.c +@@ -445,26 +445,26 @@ int vnic_dev_soft_reset_done(struct vnic_dev *vdev, int *done) + + int vnic_dev_hang_notify(struct vnic_dev *vdev) + { +- u64 a0, a1; ++ u64 a0 = 0, a1 = 0; + int wait = 1000; + return vnic_dev_cmd(vdev, CMD_HANG_NOTIFY, &a0, &a1, wait); + } + + int vnic_dev_mac_addr(struct vnic_dev *vdev, u8 *mac_addr) + { +- u64 a0, a1; ++ u64 a[2] = {}; + int wait = 1000; + int err, i; + + for (i = 0; i < ETH_ALEN; i++) + mac_addr[i] = 0; + +- err = vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a0, &a1, wait); ++ err = vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a[0], &a[1], wait); + if (err) + return err; + + for (i = 0; i < ETH_ALEN; i++) +- mac_addr[i] = ((u8 *)&a0)[i]; ++ mac_addr[i] = ((u8 *)&a)[i]; + + return 0; + } +@@ -489,38 +489,32 @@ void vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast, + + void vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr) + { +- u64 a0 = 0, a1 = 0; ++ u64 a[2] = {}; + int wait = 1000; + int err; + int i; + + for (i = 0; i < ETH_ALEN; i++) +- ((u8 *)&a0)[i] = addr[i]; ++ ((u8 *)&a)[i] = addr[i]; + +- err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait); ++ err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a[0], &a[1], wait); + if (err) +- printk(KERN_ERR +- "Can't add addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n", +- addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], +- err); ++ pr_err("Can't add addr [%pM], %d\n", addr, err); + } + + void vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr) + { +- u64 a0 = 0, a1 = 0; ++ u64 a[2] = {}; + int wait = 1000; + int err; + int i; + + for (i = 0; i < ETH_ALEN; i++) +- ((u8 *)&a0)[i] = addr[i]; ++ ((u8 *)&a)[i] = addr[i]; + +- err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait); ++ err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a[0], &a[1], wait); + if (err) +- printk(KERN_ERR +- "Can't del addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n", +- addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], +- err); ++ pr_err("Can't del addr [%pM], %d\n", addr, err); + } + + int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr) +diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c +index c291fdff1b33..ea3b77ba12a2 100644 +--- a/drivers/scsi/qla4xxx/ql4_mbx.c ++++ b/drivers/scsi/qla4xxx/ql4_mbx.c +@@ -641,9 +641,6 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha) + + if (qla4xxx_get_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma) != + QLA_SUCCESS) { +- dma_free_coherent(&ha->pdev->dev, +- sizeof(struct addr_ctrl_blk), +- init_fw_cb, init_fw_cb_dma); + goto exit_init_fw_cb; + } + +diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c +index 551fd0329bca..33700ce7d499 100644 +--- a/drivers/scsi/scsi_trace.c ++++ b/drivers/scsi/scsi_trace.c +@@ -17,10 +17,11 @@ + */ + #include + #include ++#include + #include + + #define SERVICE_ACTION16(cdb) (cdb[1] & 0x1f) +-#define SERVICE_ACTION32(cdb) ((cdb[8] << 8) | cdb[9]) ++#define SERVICE_ACTION32(cdb) (get_unaligned_be16(&cdb[8])) + + static const char * + scsi_trace_misc(struct trace_seq *, unsigned char *, int); +@@ -50,17 +51,12 @@ static const char * + scsi_trace_rw10(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- sector_t lba = 0, txlen = 0; ++ u32 lba, txlen; + +- lba |= (cdb[2] << 24); +- lba |= (cdb[3] << 16); +- lba |= (cdb[4] << 8); +- lba |= cdb[5]; +- txlen |= (cdb[7] << 8); +- txlen |= cdb[8]; ++ lba = get_unaligned_be32(&cdb[2]); ++ txlen = get_unaligned_be16(&cdb[7]); + +- trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u", +- (unsigned long long)lba, (unsigned long long)txlen, ++ trace_seq_printf(p, "lba=%u txlen=%u protect=%u", lba, txlen, + cdb[1] >> 5); + + if (cdb[0] == WRITE_SAME) +@@ -75,19 +71,12 @@ static const char * + scsi_trace_rw12(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- sector_t lba = 0, txlen = 0; +- +- lba |= (cdb[2] << 24); +- lba |= (cdb[3] << 16); +- lba |= (cdb[4] << 8); +- lba |= cdb[5]; +- txlen |= (cdb[6] << 24); +- txlen |= (cdb[7] << 16); +- txlen |= (cdb[8] << 8); +- txlen |= cdb[9]; +- +- trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u", +- (unsigned long long)lba, (unsigned long long)txlen, ++ u32 lba, txlen; ++ ++ lba = get_unaligned_be32(&cdb[2]); ++ txlen = get_unaligned_be32(&cdb[6]); ++ ++ trace_seq_printf(p, "lba=%u txlen=%u protect=%u", lba, txlen, + cdb[1] >> 5); + trace_seq_putc(p, 0); + +@@ -98,23 +87,13 @@ static const char * + scsi_trace_rw16(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- sector_t lba = 0, txlen = 0; +- +- lba |= ((u64)cdb[2] << 56); +- lba |= ((u64)cdb[3] << 48); +- lba |= ((u64)cdb[4] << 40); +- lba |= ((u64)cdb[5] << 32); +- lba |= (cdb[6] << 24); +- lba |= (cdb[7] << 16); +- lba |= (cdb[8] << 8); +- lba |= cdb[9]; +- txlen |= (cdb[10] << 24); +- txlen |= (cdb[11] << 16); +- txlen |= (cdb[12] << 8); +- txlen |= cdb[13]; +- +- trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u", +- (unsigned long long)lba, (unsigned long long)txlen, ++ u64 lba; ++ u32 txlen; ++ ++ lba = get_unaligned_be64(&cdb[2]); ++ txlen = get_unaligned_be32(&cdb[10]); ++ ++ trace_seq_printf(p, "lba=%llu txlen=%u protect=%u", lba, txlen, + cdb[1] >> 5); + + if (cdb[0] == WRITE_SAME_16) +@@ -129,8 +108,8 @@ static const char * + scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p), *cmd; +- sector_t lba = 0, txlen = 0; +- u32 ei_lbrt = 0; ++ u64 lba; ++ u32 ei_lbrt, txlen; + + switch (SERVICE_ACTION32(cdb)) { + case READ_32: +@@ -150,26 +129,12 @@ scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len) + goto out; + } + +- lba |= ((u64)cdb[12] << 56); +- lba |= ((u64)cdb[13] << 48); +- lba |= ((u64)cdb[14] << 40); +- lba |= ((u64)cdb[15] << 32); +- lba |= (cdb[16] << 24); +- lba |= (cdb[17] << 16); +- lba |= (cdb[18] << 8); +- lba |= cdb[19]; +- ei_lbrt |= (cdb[20] << 24); +- ei_lbrt |= (cdb[21] << 16); +- ei_lbrt |= (cdb[22] << 8); +- ei_lbrt |= cdb[23]; +- txlen |= (cdb[28] << 24); +- txlen |= (cdb[29] << 16); +- txlen |= (cdb[30] << 8); +- txlen |= cdb[31]; +- +- trace_seq_printf(p, "%s_32 lba=%llu txlen=%llu protect=%u ei_lbrt=%u", +- cmd, (unsigned long long)lba, +- (unsigned long long)txlen, cdb[10] >> 5, ei_lbrt); ++ lba = get_unaligned_be64(&cdb[12]); ++ ei_lbrt = get_unaligned_be32(&cdb[20]); ++ txlen = get_unaligned_be32(&cdb[28]); ++ ++ trace_seq_printf(p, "%s_32 lba=%llu txlen=%u protect=%u ei_lbrt=%u", ++ cmd, lba, txlen, cdb[10] >> 5, ei_lbrt); + + if (SERVICE_ACTION32(cdb) == WRITE_SAME_32) + trace_seq_printf(p, " unmap=%u", cdb[10] >> 3 & 1); +@@ -184,7 +149,7 @@ static const char * + scsi_trace_unmap(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- unsigned int regions = cdb[7] << 8 | cdb[8]; ++ unsigned int regions = get_unaligned_be16(&cdb[7]); + + trace_seq_printf(p, "regions=%u", (regions - 8) / 16); + trace_seq_putc(p, 0); +@@ -196,8 +161,8 @@ static const char * + scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p), *cmd; +- sector_t lba = 0; +- u32 alloc_len = 0; ++ u64 lba; ++ u32 alloc_len; + + switch (SERVICE_ACTION16(cdb)) { + case SAI_READ_CAPACITY_16: +@@ -211,21 +176,10 @@ scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len) + goto out; + } + +- lba |= ((u64)cdb[2] << 56); +- lba |= ((u64)cdb[3] << 48); +- lba |= ((u64)cdb[4] << 40); +- lba |= ((u64)cdb[5] << 32); +- lba |= (cdb[6] << 24); +- lba |= (cdb[7] << 16); +- lba |= (cdb[8] << 8); +- lba |= cdb[9]; +- alloc_len |= (cdb[10] << 24); +- alloc_len |= (cdb[11] << 16); +- alloc_len |= (cdb[12] << 8); +- alloc_len |= cdb[13]; +- +- trace_seq_printf(p, "%s lba=%llu alloc_len=%u", cmd, +- (unsigned long long)lba, alloc_len); ++ lba = get_unaligned_be64(&cdb[2]); ++ alloc_len = get_unaligned_be32(&cdb[10]); ++ ++ trace_seq_printf(p, "%s lba=%llu alloc_len=%u", cmd, lba, alloc_len); + + out: + trace_seq_putc(p, 0); +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c +index 91b9eca75b75..cad9ef012a14 100644 +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -1998,8 +1998,10 @@ static int sd_read_protection_type(struct scsi_disk *sdkp, unsigned char *buffer + u8 type; + int ret = 0; + +- if (scsi_device_protection(sdp) == 0 || (buffer[12] & 1) == 0) ++ if (scsi_device_protection(sdp) == 0 || (buffer[12] & 1) == 0) { ++ sdkp->protection_type = 0; + return ret; ++ } + + type = ((buffer[12] >> 1) & 7) + 1; /* P_TYPE 0 = Type 1 */ + +diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c +index 691c04b3e5b6..938840af9c50 100644 +--- a/drivers/spi/spi-atmel.c ++++ b/drivers/spi/spi-atmel.c +@@ -315,7 +315,6 @@ struct atmel_spi { + struct atmel_spi_dma dma; + + bool keep_cs; +- bool cs_active; + + u32 fifo_size; + }; +@@ -1404,11 +1403,9 @@ static int atmel_spi_one_transfer(struct spi_master *master, + &msg->transfers)) { + as->keep_cs = true; + } else { +- as->cs_active = !as->cs_active; +- if (as->cs_active) +- cs_activate(as, msg->spi); +- else +- cs_deactivate(as, msg->spi); ++ cs_deactivate(as, msg->spi); ++ udelay(10); ++ cs_activate(as, msg->spi); + } + } + +@@ -1431,7 +1428,6 @@ static int atmel_spi_transfer_one_message(struct spi_master *master, + atmel_spi_lock(as); + cs_activate(as, spi); + +- as->cs_active = true; + as->keep_cs = false; + + msg->status = 0; +diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c +index cb6497ce4b61..6e75095af681 100644 +--- a/drivers/target/target_core_fabric_lib.c ++++ b/drivers/target/target_core_fabric_lib.c +@@ -130,7 +130,7 @@ static int srp_get_pr_transport_id( + memset(buf + 8, 0, leading_zero_bytes); + rc = hex2bin(buf + 8 + leading_zero_bytes, p, count); + if (rc < 0) { +- pr_debug("hex2bin failed for %s: %d\n", __func__, rc); ++ pr_debug("hex2bin failed for %s: %d\n", p, rc); + return rc; + } + +diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c +index d607cb2eb64e..b59d0dafefab 100644 +--- a/drivers/tty/serial/imx.c ++++ b/drivers/tty/serial/imx.c +@@ -545,7 +545,7 @@ static void imx_dma_tx(struct imx_port *sport) + dev_err(dev, "DMA mapping error for TX.\n"); + return; + } +- desc = dmaengine_prep_slave_sg(chan, sgl, sport->dma_tx_nents, ++ desc = dmaengine_prep_slave_sg(chan, sgl, ret, + DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT); + if (!desc) { + dma_unmap_sg(dev, sgl, sport->dma_tx_nents, +diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c +index ea4ffc2ebb2f..d23f09e151f8 100644 +--- a/drivers/tty/serial/pch_uart.c ++++ b/drivers/tty/serial/pch_uart.c +@@ -251,6 +251,7 @@ struct eg20t_port { + struct dma_chan *chan_rx; + struct scatterlist *sg_tx_p; + int nent; ++ int orig_nent; + struct scatterlist sg_rx; + int tx_dma_use; + void *rx_buf_virt; +@@ -804,9 +805,10 @@ static void pch_dma_tx_complete(void *arg) + } + xmit->tail &= UART_XMIT_SIZE - 1; + async_tx_ack(priv->desc_tx); +- dma_unmap_sg(port->dev, sg, priv->nent, DMA_TO_DEVICE); ++ dma_unmap_sg(port->dev, sg, priv->orig_nent, DMA_TO_DEVICE); + priv->tx_dma_use = 0; + priv->nent = 0; ++ priv->orig_nent = 0; + kfree(priv->sg_tx_p); + pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); + } +@@ -1031,6 +1033,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) + dev_err(priv->port.dev, "%s:dma_map_sg Failed\n", __func__); + return 0; + } ++ priv->orig_nent = num; + priv->nent = nent; + + for (i = 0; i < nent; i++, sg++) { +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index 7805f3e535ec..75a07b73a82b 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -1146,6 +1146,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) + * PORT_OVER_CURRENT is not. So check for any of them. + */ + if (udev || (portstatus & USB_PORT_STAT_CONNECTION) || ++ (portchange & USB_PORT_STAT_C_CONNECTION) || + (portstatus & USB_PORT_STAT_OVERCURRENT) || + (portchange & USB_PORT_STAT_C_OVERCURRENT)) + set_bit(port1, hub->change_bits); +diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c +index f73ea14e8173..e8a8c4fa944f 100644 +--- a/drivers/usb/serial/ch341.c ++++ b/drivers/usb/serial/ch341.c +@@ -555,9 +555,13 @@ static int ch341_tiocmget(struct tty_struct *tty) + static int ch341_reset_resume(struct usb_serial *serial) + { + struct usb_serial_port *port = serial->port[0]; +- struct ch341_private *priv = usb_get_serial_port_data(port); ++ struct ch341_private *priv; + int ret; + ++ priv = usb_get_serial_port_data(port); ++ if (!priv) ++ return 0; ++ + /* reconfigure ch341 serial port after bus-reset */ + ch341_configure(serial->dev, priv); + +diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c +index 0de11898fee7..75c60e74438d 100644 +--- a/drivers/usb/serial/io_edgeport.c ++++ b/drivers/usb/serial/io_edgeport.c +@@ -572,6 +572,7 @@ static void edge_interrupt_callback(struct urb *urb) + struct usb_serial_port *port; + unsigned char *data = urb->transfer_buffer; + int length = urb->actual_length; ++ unsigned long flags; + int bytes_avail; + int position; + int txCredits; +@@ -603,7 +604,7 @@ static void edge_interrupt_callback(struct urb *urb) + if (length > 1) { + bytes_avail = data[0] | (data[1] << 8); + if (bytes_avail) { +- spin_lock(&edge_serial->es_lock); ++ spin_lock_irqsave(&edge_serial->es_lock, flags); + edge_serial->rxBytesAvail += bytes_avail; + dev_dbg(dev, + "%s - bytes_avail=%d, rxBytesAvail=%d, read_in_progress=%d\n", +@@ -626,7 +627,8 @@ static void edge_interrupt_callback(struct urb *urb) + edge_serial->read_in_progress = false; + } + } +- spin_unlock(&edge_serial->es_lock); ++ spin_unlock_irqrestore(&edge_serial->es_lock, ++ flags); + } + } + /* grab the txcredits for the ports if available */ +@@ -638,10 +640,12 @@ static void edge_interrupt_callback(struct urb *urb) + if (txCredits) { + port = edge_serial->serial->port[portNumber]; + edge_port = usb_get_serial_port_data(port); +- if (edge_port->open) { +- spin_lock(&edge_port->ep_lock); ++ if (edge_port && edge_port->open) { ++ spin_lock_irqsave(&edge_port->ep_lock, ++ flags); + edge_port->txCredits += txCredits; +- spin_unlock(&edge_port->ep_lock); ++ spin_unlock_irqrestore(&edge_port->ep_lock, ++ flags); + dev_dbg(dev, "%s - txcredits for port%d = %d\n", + __func__, portNumber, + edge_port->txCredits); +@@ -682,6 +686,7 @@ static void edge_bulk_in_callback(struct urb *urb) + int retval; + __u16 raw_data_length; + int status = urb->status; ++ unsigned long flags; + + if (status) { + dev_dbg(&urb->dev->dev, "%s - nonzero read bulk status received: %d\n", +@@ -701,7 +706,7 @@ static void edge_bulk_in_callback(struct urb *urb) + + usb_serial_debug_data(dev, __func__, raw_data_length, data); + +- spin_lock(&edge_serial->es_lock); ++ spin_lock_irqsave(&edge_serial->es_lock, flags); + + /* decrement our rxBytes available by the number that we just got */ + edge_serial->rxBytesAvail -= raw_data_length; +@@ -725,7 +730,7 @@ static void edge_bulk_in_callback(struct urb *urb) + edge_serial->read_in_progress = false; + } + +- spin_unlock(&edge_serial->es_lock); ++ spin_unlock_irqrestore(&edge_serial->es_lock, flags); + } + + +@@ -1666,7 +1671,8 @@ static void edge_break(struct tty_struct *tty, int break_state) + static void process_rcvd_data(struct edgeport_serial *edge_serial, + unsigned char *buffer, __u16 bufferLength) + { +- struct device *dev = &edge_serial->serial->dev->dev; ++ struct usb_serial *serial = edge_serial->serial; ++ struct device *dev = &serial->dev->dev; + struct usb_serial_port *port; + struct edgeport_port *edge_port; + __u16 lastBufferLength; +@@ -1771,11 +1777,10 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial, + + /* spit this data back into the tty driver if this + port is open */ +- if (rxLen) { +- port = edge_serial->serial->port[ +- edge_serial->rxPort]; ++ if (rxLen && edge_serial->rxPort < serial->num_ports) { ++ port = serial->port[edge_serial->rxPort]; + edge_port = usb_get_serial_port_data(port); +- if (edge_port->open) { ++ if (edge_port && edge_port->open) { + dev_dbg(dev, "%s - Sending %d bytes to TTY for port %d\n", + __func__, rxLen, + edge_serial->rxPort); +@@ -1783,8 +1788,8 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial, + rxLen); + edge_port->port->icount.rx += rxLen; + } +- buffer += rxLen; + } ++ buffer += rxLen; + break; + + case EXPECT_HDR3: /* Expect 3rd byte of status header */ +@@ -1819,6 +1824,8 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial, + __u8 code = edge_serial->rxStatusCode; + + /* switch the port pointer to the one being currently talked about */ ++ if (edge_serial->rxPort >= edge_serial->serial->num_ports) ++ return; + port = edge_serial->serial->port[edge_serial->rxPort]; + edge_port = usb_get_serial_port_data(port); + if (edge_port == NULL) { +diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c +index 38112be0dbae..a79e9adf4e53 100644 +--- a/drivers/usb/serial/keyspan.c ++++ b/drivers/usb/serial/keyspan.c +@@ -565,6 +565,8 @@ static void usa49_glocont_callback(struct urb *urb) + for (i = 0; i < serial->num_ports; ++i) { + port = serial->port[i]; + p_priv = usb_get_serial_port_data(port); ++ if (!p_priv) ++ continue; + + if (p_priv->resend_cont) { + dev_dbg(&port->dev, "%s - sending setup\n", __func__); +@@ -962,6 +964,8 @@ static void usa67_glocont_callback(struct urb *urb) + for (i = 0; i < serial->num_ports; ++i) { + port = serial->port[i]; + p_priv = usb_get_serial_port_data(port); ++ if (!p_priv) ++ continue; + + if (p_priv->resend_cont) { + dev_dbg(&port->dev, "%s - sending setup\n", __func__); +diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c +index 64bf258e7e00..9606dde3194c 100644 +--- a/drivers/usb/serial/opticon.c ++++ b/drivers/usb/serial/opticon.c +@@ -116,7 +116,7 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype, + retval = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), + requesttype, + USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, +- 0, 0, buffer, 1, 0); ++ 0, 0, buffer, 1, USB_CTRL_SET_TIMEOUT); + kfree(buffer); + + if (retval < 0) +diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c +index af0c87276299..82f28192694f 100644 +--- a/drivers/usb/serial/quatech2.c ++++ b/drivers/usb/serial/quatech2.c +@@ -872,7 +872,10 @@ static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch) + u8 newMSR = (u8) *ch; + unsigned long flags; + ++ /* May be called from qt2_process_read_urb() for an unbound port. */ + port_priv = usb_get_serial_port_data(port); ++ if (!port_priv) ++ return; + + spin_lock_irqsave(&port_priv->lock, flags); + port_priv->shadowMSR = newMSR; +@@ -900,7 +903,10 @@ static void qt2_update_lsr(struct usb_serial_port *port, unsigned char *ch) + unsigned long flags; + u8 newLSR = (u8) *ch; + ++ /* May be called from qt2_process_read_urb() for an unbound port. */ + port_priv = usb_get_serial_port_data(port); ++ if (!port_priv) ++ return; + + if (newLSR & UART_LSR_BI) + newLSR &= (u8) (UART_LSR_OE | UART_LSR_BI); +diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c +index 511242111403..15e05ebf37ac 100644 +--- a/drivers/usb/serial/usb-serial-simple.c ++++ b/drivers/usb/serial/usb-serial-simple.c +@@ -89,6 +89,8 @@ DEVICE(moto_modem, MOTO_IDS); + #define MOTOROLA_TETRA_IDS() \ + { USB_DEVICE(0x0cad, 0x9011) }, /* Motorola Solutions TETRA PEI */ \ + { USB_DEVICE(0x0cad, 0x9012) }, /* MTP6550 */ \ ++ { USB_DEVICE(0x0cad, 0x9013) }, /* MTP3xxx */ \ ++ { USB_DEVICE(0x0cad, 0x9015) }, /* MTP85xx */ \ + { USB_DEVICE(0x0cad, 0x9016) } /* TPG2200 */ + DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS); + +diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c +index 80ba818d3a21..25bee7aba690 100644 +--- a/drivers/usb/serial/usb-serial.c ++++ b/drivers/usb/serial/usb-serial.c +@@ -1350,6 +1350,9 @@ static int usb_serial_register(struct usb_serial_driver *driver) + return -EINVAL; + } + ++ /* Prevent individual ports from being unbound. */ ++ driver->driver.suppress_bind_attrs = true; ++ + usb_serial_operations_init(driver); + + /* Add this device to our list of devices */ +diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c +index 1c789056e7e8..d6f5a74df973 100644 +--- a/drivers/xen/balloon.c ++++ b/drivers/xen/balloon.c +@@ -584,8 +584,15 @@ static void balloon_process(struct work_struct *work) + state = reserve_additional_memory(); + } + +- if (credit < 0) +- state = decrease_reservation(-credit, GFP_BALLOON); ++ if (credit < 0) { ++ long n_pages; ++ ++ n_pages = min(-credit, si_mem_available()); ++ state = decrease_reservation(n_pages, GFP_BALLOON); ++ if (state == BP_DONE && n_pages != -credit && ++ n_pages < totalreserve_pages) ++ state = BP_EAGAIN; ++ } + + state = update_schedule(state); + +@@ -624,6 +631,9 @@ static int add_ballooned_pages(int nr_pages) + } + } + ++ if (si_mem_available() < nr_pages) ++ return -ENOMEM; ++ + st = decrease_reservation(nr_pages, GFP_USER); + if (st != BP_DONE) + return -ENOMEM; +@@ -747,7 +757,7 @@ static int __init balloon_init(void) + balloon_stats.schedule_delay = 1; + balloon_stats.max_schedule_delay = 32; + balloon_stats.retry_count = 1; +- balloon_stats.max_retry_count = RETRY_UNLIMITED; ++ balloon_stats.max_retry_count = 4; + + #ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG + set_online_page_callback(&xen_online_page); +diff --git a/firmware/Makefile b/firmware/Makefile +index e297e1b52636..03232621cc08 100644 +--- a/firmware/Makefile ++++ b/firmware/Makefile +@@ -156,7 +156,7 @@ quiet_cmd_fwbin = MK_FW $@ + PROGBITS=$(if $(CONFIG_ARM),%,@)progbits; \ + echo "/* Generated by firmware/Makefile */" > $@;\ + echo " .section .rodata" >>$@;\ +- echo " .p2align $${ASM_ALIGN}" >>$@;\ ++ echo " .p2align 4" >>$@;\ + echo "_fw_$${FWSTR}_bin:" >>$@;\ + echo " .incbin \"$(2)\"" >>$@;\ + echo "_fw_end:" >>$@;\ +diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c +index 41f1a5dd33a5..4dcce3f034f4 100644 +--- a/fs/cifs/smb2file.c ++++ b/fs/cifs/smb2file.c +@@ -69,7 +69,7 @@ smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, + goto out; + + +- if (oparms->tcon->use_resilient) { ++ if (oparms->tcon->use_resilient) { + nr_ioctl_req.Timeout = 0; /* use server default (120 seconds) */ + nr_ioctl_req.Reserved = 0; + rc = SMB2_ioctl(xid, oparms->tcon, fid->persistent_fid, +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c +index 3557c5717c8d..271d8d9d0598 100644 +--- a/fs/ext4/inode.c ++++ b/fs/ext4/inode.c +@@ -5189,10 +5189,25 @@ static int ext4_expand_extra_isize(struct inode *inode, + { + struct ext4_inode *raw_inode; + struct ext4_xattr_ibody_header *header; ++ unsigned int inode_size = EXT4_INODE_SIZE(inode->i_sb); ++ struct ext4_inode_info *ei = EXT4_I(inode); + + if (EXT4_I(inode)->i_extra_isize >= new_extra_isize) + return 0; + ++ /* this was checked at iget time, but double check for good measure */ ++ if ((EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > inode_size) || ++ (ei->i_extra_isize & 3)) { ++ EXT4_ERROR_INODE(inode, "bad extra_isize %u (inode size %u)", ++ ei->i_extra_isize, ++ EXT4_INODE_SIZE(inode->i_sb)); ++ return -EFSCORRUPTED; ++ } ++ if ((new_extra_isize < ei->i_extra_isize) || ++ (new_extra_isize < 4) || ++ (new_extra_isize > inode_size - EXT4_GOOD_OLD_INODE_SIZE)) ++ return -EINVAL; /* Should never happen */ ++ + raw_inode = ext4_raw_inode(&iloc); + + header = IHDR(inode, raw_inode); +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index 6f00388a1471..adf02b1509ca 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -3169,6 +3169,40 @@ int ext4_calculate_overhead(struct super_block *sb) + return 0; + } + ++static void ext4_clamp_want_extra_isize(struct super_block *sb) ++{ ++ struct ext4_sb_info *sbi = EXT4_SB(sb); ++ struct ext4_super_block *es = sbi->s_es; ++ unsigned def_extra_isize = sizeof(struct ext4_inode) - ++ EXT4_GOOD_OLD_INODE_SIZE; ++ ++ if (sbi->s_inode_size == EXT4_GOOD_OLD_INODE_SIZE) { ++ sbi->s_want_extra_isize = 0; ++ return; ++ } ++ if (sbi->s_want_extra_isize < 4) { ++ sbi->s_want_extra_isize = def_extra_isize; ++ if (ext4_has_feature_extra_isize(sb)) { ++ if (sbi->s_want_extra_isize < ++ le16_to_cpu(es->s_want_extra_isize)) ++ sbi->s_want_extra_isize = ++ le16_to_cpu(es->s_want_extra_isize); ++ if (sbi->s_want_extra_isize < ++ le16_to_cpu(es->s_min_extra_isize)) ++ sbi->s_want_extra_isize = ++ le16_to_cpu(es->s_min_extra_isize); ++ } ++ } ++ /* Check if enough inode space is available */ ++ if ((sbi->s_want_extra_isize > sbi->s_inode_size) || ++ (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize > ++ sbi->s_inode_size)) { ++ sbi->s_want_extra_isize = def_extra_isize; ++ ext4_msg(sb, KERN_INFO, ++ "required extra inode space not available"); ++ } ++} ++ + static void ext4_set_resv_clusters(struct super_block *sb) + { + ext4_fsblk_t resv_clusters; +@@ -3991,29 +4025,7 @@ no_journal: + if (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY)) + sb->s_flags |= MS_RDONLY; + +- /* determine the minimum size of new large inodes, if present */ +- if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) { +- sbi->s_want_extra_isize = sizeof(struct ext4_inode) - +- EXT4_GOOD_OLD_INODE_SIZE; +- if (ext4_has_feature_extra_isize(sb)) { +- if (sbi->s_want_extra_isize < +- le16_to_cpu(es->s_want_extra_isize)) +- sbi->s_want_extra_isize = +- le16_to_cpu(es->s_want_extra_isize); +- if (sbi->s_want_extra_isize < +- le16_to_cpu(es->s_min_extra_isize)) +- sbi->s_want_extra_isize = +- le16_to_cpu(es->s_min_extra_isize); +- } +- } +- /* Check if enough inode space is available */ +- if (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize > +- sbi->s_inode_size) { +- sbi->s_want_extra_isize = sizeof(struct ext4_inode) - +- EXT4_GOOD_OLD_INODE_SIZE; +- ext4_msg(sb, KERN_INFO, "required extra inode space not" +- "available"); +- } ++ ext4_clamp_want_extra_isize(sb); + + ext4_set_resv_clusters(sb); + +@@ -4766,6 +4778,8 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) + goto restore_opts; + } + ++ ext4_clamp_want_extra_isize(sb); ++ + if ((old_opts.s_mount_opt & EXT4_MOUNT_JOURNAL_CHECKSUM) ^ + test_opt(sb, JOURNAL_CHECKSUM)) { + ext4_msg(sb, KERN_ERR, "changing journal_checksum " +diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c +index 2301011428a1..bbf1634ff427 100644 +--- a/fs/ocfs2/journal.c ++++ b/fs/ocfs2/journal.c +@@ -1080,6 +1080,14 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local, int replayed) + + ocfs2_clear_journal_error(osb->sb, journal->j_journal, osb->slot_num); + ++ if (replayed) { ++ jbd2_journal_lock_updates(journal->j_journal); ++ status = jbd2_journal_flush(journal->j_journal); ++ jbd2_journal_unlock_updates(journal->j_journal); ++ if (status < 0) ++ mlog_errno(status); ++ } ++ + status = ocfs2_journal_toggle_dirty(osb, 1, replayed); + if (status < 0) { + mlog_errno(status); +diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c +index df4661abadc4..83720460c5bc 100644 +--- a/fs/proc/meminfo.c ++++ b/fs/proc/meminfo.c +@@ -29,10 +29,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) + unsigned long committed; + long cached; + long available; +- unsigned long pagecache; +- unsigned long wmark_low = 0; + unsigned long pages[NR_LRU_LISTS]; +- struct zone *zone; + int lru; + + /* +@@ -51,33 +48,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) + for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++) + pages[lru] = global_page_state(NR_LRU_BASE + lru); + +- for_each_zone(zone) +- wmark_low += zone->watermark[WMARK_LOW]; +- +- /* +- * Estimate the amount of memory available for userspace allocations, +- * without causing swapping. +- */ +- available = i.freeram - totalreserve_pages; +- +- /* +- * Not all the page cache can be freed, otherwise the system will +- * start swapping. Assume at least half of the page cache, or the +- * low watermark worth of cache, needs to stay. +- */ +- pagecache = pages[LRU_ACTIVE_FILE] + pages[LRU_INACTIVE_FILE]; +- pagecache -= min(pagecache / 2, wmark_low); +- available += pagecache; +- +- /* +- * Part of the reclaimable slab consists of items that are in use, +- * and cannot be freed. Cap this estimate at the low watermark. +- */ +- available += global_page_state(NR_SLAB_RECLAIMABLE) - +- min(global_page_state(NR_SLAB_RECLAIMABLE) / 2, wmark_low); +- +- if (available < 0) +- available = 0; ++ available = si_mem_available(); + + /* + * Tagged format, for easy grepping and expansion. +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h +index e4b945925e40..4ae5d6ecd727 100644 +--- a/include/linux/blkdev.h ++++ b/include/linux/blkdev.h +@@ -264,6 +264,7 @@ struct queue_limits { + unsigned int max_sectors; + unsigned int max_segment_size; + unsigned int physical_block_size; ++ unsigned int logical_block_size; + unsigned int alignment_offset; + unsigned int io_min; + unsigned int io_opt; +@@ -273,7 +274,6 @@ struct queue_limits { + unsigned int discard_granularity; + unsigned int discard_alignment; + +- unsigned short logical_block_size; + unsigned short max_segments; + unsigned short max_integrity_segments; + +@@ -975,7 +975,7 @@ extern void blk_queue_max_discard_sectors(struct request_queue *q, + unsigned int max_discard_sectors); + extern void blk_queue_max_write_same_sectors(struct request_queue *q, + unsigned int max_write_same_sectors); +-extern void blk_queue_logical_block_size(struct request_queue *, unsigned short); ++extern void blk_queue_logical_block_size(struct request_queue *, unsigned int); + extern void blk_queue_physical_block_size(struct request_queue *, unsigned int); + extern void blk_queue_alignment_offset(struct request_queue *q, + unsigned int alignment); +@@ -1193,7 +1193,7 @@ static inline unsigned int queue_max_segment_size(struct request_queue *q) + return q->limits.max_segment_size; + } + +-static inline unsigned short queue_logical_block_size(struct request_queue *q) ++static inline unsigned queue_logical_block_size(struct request_queue *q) + { + int retval = 512; + +@@ -1203,7 +1203,7 @@ static inline unsigned short queue_logical_block_size(struct request_queue *q) + return retval; + } + +-static inline unsigned short bdev_logical_block_size(struct block_device *bdev) ++static inline unsigned int bdev_logical_block_size(struct block_device *bdev) + { + return queue_logical_block_size(bdev_get_queue(bdev)); + } +diff --git a/include/linux/mm.h b/include/linux/mm.h +index ed653ba47c46..15f81b2b87ed 100644 +--- a/include/linux/mm.h ++++ b/include/linux/mm.h +@@ -1802,6 +1802,7 @@ extern int __meminit init_per_zone_wmark_min(void); + extern void mem_init(void); + extern void __init mmap_init(void); + extern void show_mem(unsigned int flags); ++extern long si_mem_available(void); + extern void si_meminfo(struct sysinfo * val); + extern void si_meminfo_node(struct sysinfo *val, int nid); + +diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h +index d8ecefaf63ca..6b8ec40af2c4 100644 +--- a/include/linux/regulator/ab8500.h ++++ b/include/linux/regulator/ab8500.h +@@ -44,8 +44,6 @@ enum ab8505_regulator_id { + AB8505_LDO_ANAMIC2, + AB8505_LDO_AUX8, + AB8505_LDO_ANA, +- AB8505_SYSCLKREQ_2, +- AB8505_SYSCLKREQ_4, + AB8505_NUM_REGULATORS, + }; + +diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h +index c05748cc1b20..3fe53101b72a 100644 +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -3855,6 +3855,17 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); + const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, + const u8 *ies, int len); + ++/** ++ * cfg80211_send_layer2_update - send layer 2 update frame ++ * ++ * @dev: network device ++ * @addr: STA MAC address ++ * ++ * Wireless drivers can use this function to update forwarding tables in bridge ++ * devices upon STA association. ++ */ ++void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr); ++ + /** + * DOC: Regulatory enforcement infrastructure + * +diff --git a/mm/page-writeback.c b/mm/page-writeback.c +index d2211e42b779..698806914be7 100644 +--- a/mm/page-writeback.c ++++ b/mm/page-writeback.c +@@ -200,11 +200,11 @@ static void wb_min_max_ratio(struct bdi_writeback *wb, + if (this_bw < tot_bw) { + if (min) { + min *= this_bw; +- do_div(min, tot_bw); ++ min = div64_ul(min, tot_bw); + } + if (max < 100) { + max *= this_bw; +- do_div(max, tot_bw); ++ max = div64_ul(max, tot_bw); + } + } + +diff --git a/mm/page_alloc.c b/mm/page_alloc.c +index fd75e27c9b40..df589416ace6 100644 +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -3650,6 +3650,49 @@ static inline void show_node(struct zone *zone) + printk("Node %d ", zone_to_nid(zone)); + } + ++long si_mem_available(void) ++{ ++ long available; ++ unsigned long pagecache; ++ unsigned long wmark_low = 0; ++ unsigned long pages[NR_LRU_LISTS]; ++ struct zone *zone; ++ int lru; ++ ++ for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++) ++ pages[lru] = global_page_state(NR_LRU_BASE + lru); ++ ++ for_each_zone(zone) ++ wmark_low += zone->watermark[WMARK_LOW]; ++ ++ /* ++ * Estimate the amount of memory available for userspace allocations, ++ * without causing swapping. ++ */ ++ available = global_page_state(NR_FREE_PAGES) - totalreserve_pages; ++ ++ /* ++ * Not all the page cache can be freed, otherwise the system will ++ * start swapping. Assume at least half of the page cache, or the ++ * low watermark worth of cache, needs to stay. ++ */ ++ pagecache = pages[LRU_ACTIVE_FILE] + pages[LRU_INACTIVE_FILE]; ++ pagecache -= min(pagecache / 2, wmark_low); ++ available += pagecache; ++ ++ /* ++ * Part of the reclaimable slab consists of items that are in use, ++ * and cannot be freed. Cap this estimate at the low watermark. ++ */ ++ available += global_page_state(NR_SLAB_RECLAIMABLE) - ++ min(global_page_state(NR_SLAB_RECLAIMABLE) / 2, wmark_low); ++ ++ if (available < 0) ++ available = 0; ++ return available; ++} ++EXPORT_SYMBOL_GPL(si_mem_available); ++ + void si_meminfo(struct sysinfo *val) + { + val->totalram = totalram_pages; +diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c +index c2dff7c6e960..76808c5e8183 100644 +--- a/net/batman-adv/distributed-arp-table.c ++++ b/net/batman-adv/distributed-arp-table.c +@@ -226,6 +226,7 @@ static u32 batadv_hash_dat(const void *data, u32 size) + u32 hash = 0; + const struct batadv_dat_entry *dat = data; + const unsigned char *key; ++ __be16 vid; + u32 i; + + key = (const unsigned char *)&dat->ip; +@@ -235,7 +236,8 @@ static u32 batadv_hash_dat(const void *data, u32 size) + hash ^= (hash >> 6); + } + +- key = (const unsigned char *)&dat->vid; ++ vid = htons(dat->vid); ++ key = (__force const unsigned char *)&vid; + for (i = 0; i < sizeof(dat->vid); i++) { + hash += key[i]; + hash += (hash << 10); +diff --git a/net/dccp/feat.c b/net/dccp/feat.c +index f227f002c73d..db87d9f58019 100644 +--- a/net/dccp/feat.c ++++ b/net/dccp/feat.c +@@ -738,7 +738,12 @@ static int __feat_register_sp(struct list_head *fn, u8 feat, u8 is_local, + if (dccp_feat_clone_sp_val(&fval, sp_val, sp_len)) + return -ENOMEM; + +- return dccp_feat_push_change(fn, feat, is_local, mandatory, &fval); ++ if (dccp_feat_push_change(fn, feat, is_local, mandatory, &fval)) { ++ kfree(fval.sp.vec); ++ return -ENOMEM; ++ } ++ ++ return 0; + } + + /** +diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c +index 943378d6e4c3..8dd239214a14 100644 +--- a/net/hsr/hsr_device.c ++++ b/net/hsr/hsr_device.c +@@ -289,6 +289,8 @@ static void send_hsr_supervision_frame(struct hsr_port *master, u8 type) + skb->dev->dev_addr, skb->len) <= 0) + goto out; + skb_reset_mac_header(skb); ++ skb_reset_network_header(skb); ++ skb_reset_transport_header(skb); + + hsr_stag = (typeof(hsr_stag)) skb_put(skb, sizeof(*hsr_stag)); + +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c +index 1abf88aec19d..88bfd663d9a2 100644 +--- a/net/ipv4/tcp_input.c ++++ b/net/ipv4/tcp_input.c +@@ -895,9 +895,10 @@ static void tcp_update_reordering(struct sock *sk, const int metric, + /* This must be called before lost_out is incremented */ + static void tcp_verify_retransmit_hint(struct tcp_sock *tp, struct sk_buff *skb) + { +- if (!tp->retransmit_skb_hint || +- before(TCP_SKB_CB(skb)->seq, +- TCP_SKB_CB(tp->retransmit_skb_hint)->seq)) ++ if ((!tp->retransmit_skb_hint && tp->retrans_out >= tp->lost_out) || ++ (tp->retransmit_skb_hint && ++ before(TCP_SKB_CB(skb)->seq, ++ TCP_SKB_CB(tp->retransmit_skb_hint)->seq))) + tp->retransmit_skb_hint = skb; + + if (!tp->lost_out || +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c +index 1999a7eaa692..cf3917c6da0a 100644 +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -875,50 +875,6 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev) + return 0; + } + +-/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ +-struct iapp_layer2_update { +- u8 da[ETH_ALEN]; /* broadcast */ +- u8 sa[ETH_ALEN]; /* STA addr */ +- __be16 len; /* 6 */ +- u8 dsap; /* 0 */ +- u8 ssap; /* 0 */ +- u8 control; +- u8 xid_info[3]; +-} __packed; +- +-static void ieee80211_send_layer2_update(struct sta_info *sta) +-{ +- struct iapp_layer2_update *msg; +- struct sk_buff *skb; +- +- /* Send Level 2 Update Frame to update forwarding tables in layer 2 +- * bridge devices */ +- +- skb = dev_alloc_skb(sizeof(*msg)); +- if (!skb) +- return; +- msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg)); +- +- /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) +- * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ +- +- eth_broadcast_addr(msg->da); +- memcpy(msg->sa, sta->sta.addr, ETH_ALEN); +- msg->len = htons(6); +- msg->dsap = 0; +- msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */ +- msg->control = 0xaf; /* XID response lsb.1111F101. +- * F=0 (no poll command; unsolicited frame) */ +- msg->xid_info[0] = 0x81; /* XID format identifier */ +- msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */ +- msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */ +- +- skb->dev = sta->sdata->dev; +- skb->protocol = eth_type_trans(skb, sta->sdata->dev); +- memset(skb->cb, 0, sizeof(skb->cb)); +- netif_rx_ni(skb); +-} +- + static int sta_apply_auth_flags(struct ieee80211_local *local, + struct sta_info *sta, + u32 mask, u32 set) +@@ -1194,7 +1150,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, + struct sta_info *sta; + struct ieee80211_sub_if_data *sdata; + int err; +- int layer2_update; + + if (params->vlan) { + sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); +@@ -1248,18 +1203,12 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, + test_sta_flag(sta, WLAN_STA_ASSOC)) + rate_control_rate_init(sta); + +- layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN || +- sdata->vif.type == NL80211_IFTYPE_AP; +- + err = sta_info_insert_rcu(sta); + if (err) { + rcu_read_unlock(); + return err; + } + +- if (layer2_update) +- ieee80211_send_layer2_update(sta); +- + rcu_read_unlock(); + + return 0; +@@ -1367,7 +1316,9 @@ static int ieee80211_change_station(struct wiphy *wiphy, + atomic_inc(&sta->sdata->bss->num_mcast_sta); + } + +- ieee80211_send_layer2_update(sta); ++ if (sta->sta_state == IEEE80211_STA_AUTHORIZED) ++ cfg80211_send_layer2_update(sta->sdata->dev, ++ sta->sta.addr); + } + + err = sta_apply_parameters(local, sta, params); +diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c +index 7e7b9ef29d8d..1cad7ca9234b 100644 +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -1775,6 +1775,10 @@ int sta_info_move_state(struct sta_info *sta, + set_bit(WLAN_STA_AUTHORIZED, &sta->_flags); + ieee80211_check_fast_xmit(sta); + } ++ if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN || ++ sta->sdata->vif.type == NL80211_IFTYPE_AP) ++ cfg80211_send_layer2_update(sta->sdata->dev, ++ sta->sta.addr); + break; + default: + break; +diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h b/net/netfilter/ipset/ip_set_bitmap_gen.h +index b0bc475f641e..adc703ccd68b 100644 +--- a/net/netfilter/ipset/ip_set_bitmap_gen.h ++++ b/net/netfilter/ipset/ip_set_bitmap_gen.h +@@ -66,9 +66,9 @@ mtype_destroy(struct ip_set *set) + if (SET_WITH_TIMEOUT(set)) + del_timer_sync(&map->gc); + +- ip_set_free(map->members); + if (set->dsize && set->extensions & IPSET_EXT_DESTROY) + mtype_ext_cleanup(set); ++ ip_set_free(map->members); + ip_set_free(map); + + set->data = NULL; +diff --git a/net/socket.c b/net/socket.c +index e5bb73eb36fe..15bdba4211ad 100644 +--- a/net/socket.c ++++ b/net/socket.c +@@ -3143,6 +3143,7 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, + case SIOCSARP: + case SIOCGARP: + case SIOCDARP: ++ case SIOCOUTQNSD: + case SIOCATMARK: + return sock_do_ioctl(net, sock, cmd, arg); + } +diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h +index c23516d0f807..b3a60c3e1934 100644 +--- a/net/wireless/rdev-ops.h ++++ b/net/wireless/rdev-ops.h +@@ -517,6 +517,10 @@ static inline int + rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed) + { + int ret; ++ ++ if (!rdev->ops->set_wiphy_params) ++ return -EOPNOTSUPP; ++ + trace_rdev_set_wiphy_params(&rdev->wiphy, changed); + ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed); + trace_rdev_return_int(&rdev->wiphy, ret); +diff --git a/net/wireless/util.c b/net/wireless/util.c +index 405388772fc4..156a2a6337b9 100644 +--- a/net/wireless/util.c ++++ b/net/wireless/util.c +@@ -1814,3 +1814,48 @@ EXPORT_SYMBOL(rfc1042_header); + const unsigned char bridge_tunnel_header[] __aligned(2) = + { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; + EXPORT_SYMBOL(bridge_tunnel_header); ++ ++/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ ++struct iapp_layer2_update { ++ u8 da[ETH_ALEN]; /* broadcast */ ++ u8 sa[ETH_ALEN]; /* STA addr */ ++ __be16 len; /* 6 */ ++ u8 dsap; /* 0 */ ++ u8 ssap; /* 0 */ ++ u8 control; ++ u8 xid_info[3]; ++} __packed; ++ ++void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr) ++{ ++ struct iapp_layer2_update *msg; ++ struct sk_buff *skb; ++ ++ /* Send Level 2 Update Frame to update forwarding tables in layer 2 ++ * bridge devices */ ++ ++ skb = dev_alloc_skb(sizeof(*msg)); ++ if (!skb) ++ return; ++ msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg)); ++ ++ /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) ++ * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ ++ ++ eth_broadcast_addr(msg->da); ++ ether_addr_copy(msg->sa, addr); ++ msg->len = htons(6); ++ msg->dsap = 0; ++ msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */ ++ msg->control = 0xaf; /* XID response lsb.1111F101. ++ * F=0 (no poll command; unsolicited frame) */ ++ msg->xid_info[0] = 0x81; /* XID format identifier */ ++ msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */ ++ msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */ ++ ++ skb->dev = dev; ++ skb->protocol = eth_type_trans(skb, dev); ++ memset(skb->cb, 0, sizeof(skb->cb)); ++ netif_rx_ni(skb); ++} ++EXPORT_SYMBOL(cfg80211_send_layer2_update); +diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c +index 3be67560ead5..c526201fd0df 100644 +--- a/sound/core/seq/seq_timer.c ++++ b/sound/core/seq/seq_timer.c +@@ -484,15 +484,19 @@ void snd_seq_info_timer_read(struct snd_info_entry *entry, + q = queueptr(idx); + if (q == NULL) + continue; +- if ((tmr = q->timer) == NULL || +- (ti = tmr->timeri) == NULL) { +- queuefree(q); +- continue; +- } ++ mutex_lock(&q->timer_mutex); ++ tmr = q->timer; ++ if (!tmr) ++ goto unlock; ++ ti = tmr->timeri; ++ if (!ti) ++ goto unlock; + snd_iprintf(buffer, "Timer for queue %i : %s\n", q->queue, ti->timer->name); + resolution = snd_timer_resolution(ti) * tmr->ticks; + snd_iprintf(buffer, " Period time : %lu.%09lu\n", resolution / 1000000000, resolution % 1000000000); + snd_iprintf(buffer, " Skew : %u / %u\n", tmr->skew, tmr->skew_base); ++unlock: ++ mutex_unlock(&q->timer_mutex); + queuefree(q); + } + } +diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c +index 41aa3355e920..e85ada14a8e1 100644 +--- a/sound/usb/line6/pcm.c ++++ b/sound/usb/line6/pcm.c +@@ -523,13 +523,6 @@ int line6_init_pcm(struct usb_line6 *line6, + line6pcm->volume_monitor = 255; + line6pcm->line6 = line6; + +- /* Read and write buffers are sized identically, so choose minimum */ +- line6pcm->max_packet_size = min( +- usb_maxpacket(line6->usbdev, +- usb_rcvisocpipe(line6->usbdev, ep_read), 0), +- usb_maxpacket(line6->usbdev, +- usb_sndisocpipe(line6->usbdev, ep_write), 1)); +- + spin_lock_init(&line6pcm->out.lock); + spin_lock_init(&line6pcm->in.lock); + line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD; +@@ -539,6 +532,18 @@ int line6_init_pcm(struct usb_line6 *line6, + pcm->private_data = line6pcm; + pcm->private_free = line6_cleanup_pcm; + ++ /* Read and write buffers are sized identically, so choose minimum */ ++ line6pcm->max_packet_size = min( ++ usb_maxpacket(line6->usbdev, ++ usb_rcvisocpipe(line6->usbdev, ep_read), 0), ++ usb_maxpacket(line6->usbdev, ++ usb_sndisocpipe(line6->usbdev, ep_write), 1)); ++ if (!line6pcm->max_packet_size) { ++ dev_err(line6pcm->line6->ifcdev, ++ "cannot get proper max packet size\n"); ++ return -EINVAL; ++ } ++ + err = line6_create_audio_out_urbs(line6pcm); + if (err < 0) + return err; +diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c +index 5ca8836b16e7..89bb0f76e896 100644 +--- a/tools/perf/util/probe-finder.c ++++ b/tools/perf/util/probe-finder.c +@@ -597,38 +597,26 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwfl_Module *mod, + const char *function, + struct probe_trace_point *tp) + { +- Dwarf_Addr eaddr, highaddr; ++ Dwarf_Addr eaddr; + GElf_Sym sym; + const char *symbol; + + /* Verify the address is correct */ +- if (dwarf_entrypc(sp_die, &eaddr) != 0) { +- pr_warning("Failed to get entry address of %s\n", +- dwarf_diename(sp_die)); +- return -ENOENT; +- } +- if (dwarf_highpc(sp_die, &highaddr) != 0) { +- pr_warning("Failed to get end address of %s\n", +- dwarf_diename(sp_die)); +- return -ENOENT; +- } +- if (paddr > highaddr) { +- pr_warning("Offset specified is greater than size of %s\n", ++ if (!dwarf_haspc(sp_die, paddr)) { ++ pr_warning("Specified offset is out of %s\n", + dwarf_diename(sp_die)); + return -EINVAL; + } + +- symbol = dwarf_diename(sp_die); ++ /* Try to get actual symbol name from symtab */ ++ symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL); + if (!symbol) { +- /* Try to get the symbol name from symtab */ +- symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL); +- if (!symbol) { +- pr_warning("Failed to find symbol at 0x%lx\n", +- (unsigned long)paddr); +- return -ENOENT; +- } +- eaddr = sym.st_value; ++ pr_warning("Failed to find symbol at 0x%lx\n", ++ (unsigned long)paddr); ++ return -ENOENT; + } ++ eaddr = sym.st_value; ++ + tp->offset = (unsigned long)(paddr - eaddr); + tp->address = (unsigned long)paddr; + tp->symbol = strdup(symbol); +diff --git a/tools/testing/selftests/rseq/settings b/tools/testing/selftests/rseq/settings +new file mode 100644 +index 000000000000..e7b9417537fb +--- /dev/null ++++ b/tools/testing/selftests/rseq/settings +@@ -0,0 +1 @@ ++timeout=0 diff --git a/patch/kernel/rockchip-legacy/patch-4.4.210-211.patch b/patch/kernel/rockchip-legacy/patch-4.4.210-211.patch new file mode 100644 index 000000000..fdade4d9f --- /dev/null +++ b/patch/kernel/rockchip-legacy/patch-4.4.210-211.patch @@ -0,0 +1,2692 @@ +diff --git a/Documentation/ABI/testing/sysfs-bus-mei b/Documentation/ABI/testing/sysfs-bus-mei +index 6bd45346ac7e..3f8701e8fa24 100644 +--- a/Documentation/ABI/testing/sysfs-bus-mei ++++ b/Documentation/ABI/testing/sysfs-bus-mei +@@ -4,7 +4,7 @@ KernelVersion: 3.10 + Contact: Samuel Ortiz + linux-mei@linux.intel.com + Description: Stores the same MODALIAS value emitted by uevent +- Format: mei::: ++ Format: mei::: + + What: /sys/bus/mei/devices/.../name + Date: May 2015 +diff --git a/Makefile b/Makefile +index c09b55163c2c..9f03733dac69 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,6 @@ + VERSION = 4 + PATCHLEVEL = 4 +-SUBLEVEL = 210 ++SUBLEVEL = 211 + EXTRAVERSION = + NAME = Blurry Fish Butt + +diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +index 6a37101344aa..751d8b60df1d 100644 +--- a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi ++++ b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +@@ -56,10 +56,10 @@ + + pmu { + compatible = "arm,armv8-pmuv3"; +- interrupts = <0 120 8>, +- <0 121 8>, +- <0 122 8>, +- <0 123 8>; ++ interrupts = <0 170 4>, ++ <0 171 4>, ++ <0 172 4>, ++ <0 173 4>; + interrupt-affinity = <&cpu0>, + <&cpu1>, + <&cpu2>, +diff --git a/arch/hexagon/kernel/stacktrace.c b/arch/hexagon/kernel/stacktrace.c +index f94918b449a8..03a0e10ecdcc 100644 +--- a/arch/hexagon/kernel/stacktrace.c ++++ b/arch/hexagon/kernel/stacktrace.c +@@ -23,8 +23,6 @@ + #include + #include + +-register unsigned long current_frame_pointer asm("r30"); +- + struct stackframe { + unsigned long fp; + unsigned long rets; +@@ -42,7 +40,7 @@ void save_stack_trace(struct stack_trace *trace) + + low = (unsigned long)task_stack_page(current); + high = low + THREAD_SIZE; +- fp = current_frame_pointer; ++ fp = (unsigned long)__builtin_frame_address(0); + + while (fp >= low && fp <= (high - sizeof(*frame))) { + frame = (struct stackframe *)fp; +diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S +index 86558a199139..b831e24f7168 100644 +--- a/arch/x86/boot/compressed/head_64.S ++++ b/arch/x86/boot/compressed/head_64.S +@@ -225,6 +225,11 @@ ENTRY(efi32_stub_entry) + leal efi32_config(%ebp), %eax + movl %eax, efi_config(%ebp) + ++ /* Disable paging */ ++ movl %cr0, %eax ++ btrl $X86_CR0_PG_BIT, %eax ++ movl %eax, %cr0 ++ + jmp startup_32 + ENDPROC(efi32_stub_entry) + #endif +diff --git a/block/blk-settings.c b/block/blk-settings.c +index c7bb666aafd1..eb96abdce29c 100644 +--- a/block/blk-settings.c ++++ b/block/blk-settings.c +@@ -349,7 +349,7 @@ EXPORT_SYMBOL(blk_queue_max_segment_size); + * storage device can address. The default of 512 covers most + * hardware. + **/ +-void blk_queue_logical_block_size(struct request_queue *q, unsigned short size) ++void blk_queue_logical_block_size(struct request_queue *q, unsigned int size) + { + q->limits.logical_block_size = size; + +diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c +index 2fee2eef988d..e1f71debdbba 100644 +--- a/drivers/block/xen-blkfront.c ++++ b/drivers/block/xen-blkfront.c +@@ -952,8 +952,8 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity, + if (!VDEV_IS_EXTENDED(info->vdevice)) { + err = xen_translate_vdev(info->vdevice, &minor, &offset); + if (err) +- return err; +- nr_parts = PARTS_PER_DISK; ++ return err; ++ nr_parts = PARTS_PER_DISK; + } else { + minor = BLKIF_MINOR_EXT(info->vdevice); + nr_parts = PARTS_PER_EXT_DISK; +diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c +index c94de13ce362..21bfedf40478 100644 +--- a/drivers/clk/samsung/clk-exynos5420.c ++++ b/drivers/clk/samsung/clk-exynos5420.c +@@ -166,6 +166,8 @@ static unsigned long exynos5x_clk_regs[] __initdata = { + GATE_BUS_CPU, + GATE_SCLK_CPU, + CLKOUT_CMU_CPU, ++ APLL_CON0, ++ KPLL_CON0, + CPLL_CON0, + DPLL_CON0, + EPLL_CON0, +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c +index db0801c7bb8e..503405d32d24 100644 +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -1949,8 +1949,9 @@ static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, + + if (chip->ngpio <= p->chip_hwnum) { + dev_err(dev, +- "requested GPIO %d is out of range [0..%d] for chip %s\n", +- idx, chip->ngpio, chip->label); ++ "requested GPIO %u (%u) is out of range [0..%u] for chip %s\n", ++ idx, p->chip_hwnum, chip->ngpio - 1, ++ chip->label); + return ERR_PTR(-EINVAL); + } + +diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c +index 627a24d3ea7c..ef9e196b54a5 100644 +--- a/drivers/hid/hidraw.c ++++ b/drivers/hid/hidraw.c +@@ -262,13 +262,14 @@ out: + static unsigned int hidraw_poll(struct file *file, poll_table *wait) + { + struct hidraw_list *list = file->private_data; ++ unsigned int mask = POLLOUT | POLLWRNORM; /* hidraw is always writable */ + + poll_wait(file, &list->hidraw->wait, wait); + if (list->head != list->tail) +- return POLLIN | POLLRDNORM; ++ mask |= POLLIN | POLLRDNORM; + if (!list->hidraw->exist) +- return POLLERR | POLLHUP; +- return 0; ++ mask |= POLLERR | POLLHUP; ++ return mask; + } + + static int hidraw_open(struct inode *inode, struct file *file) +diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c +index ea0c860ee842..a7ba4db8cff7 100644 +--- a/drivers/hid/uhid.c ++++ b/drivers/hid/uhid.c +@@ -769,13 +769,14 @@ unlock: + static unsigned int uhid_char_poll(struct file *file, poll_table *wait) + { + struct uhid_device *uhid = file->private_data; ++ unsigned int mask = POLLOUT | POLLWRNORM; /* uhid is always writable */ + + poll_wait(file, &uhid->waitq, wait); + + if (uhid->head != uhid->tail) +- return POLLIN | POLLRDNORM; ++ mask |= POLLIN | POLLRDNORM; + +- return EPOLLOUT | EPOLLWRNORM; ++ return mask; + } + + static const struct file_operations uhid_fops = { +diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c +index eeed374ebc6c..4ca3a4ae2743 100644 +--- a/drivers/iio/imu/adis16480.c ++++ b/drivers/iio/imu/adis16480.c +@@ -372,12 +372,14 @@ static int adis16480_get_calibbias(struct iio_dev *indio_dev, + case IIO_MAGN: + case IIO_PRESSURE: + ret = adis_read_reg_16(&st->adis, reg, &val16); +- *bias = sign_extend32(val16, 15); ++ if (ret == 0) ++ *bias = sign_extend32(val16, 15); + break; + case IIO_ANGL_VEL: + case IIO_ACCEL: + ret = adis_read_reg_32(&st->adis, reg, &val32); +- *bias = sign_extend32(val32, 31); ++ if (ret == 0) ++ *bias = sign_extend32(val32, 31); + break; + default: + ret = -EINVAL; +diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c +index cb3a8623ff54..4173fe977721 100644 +--- a/drivers/infiniband/ulp/srpt/ib_srpt.c ++++ b/drivers/infiniband/ulp/srpt/ib_srpt.c +@@ -1513,9 +1513,11 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch, + struct srpt_send_ioctx *ioctx, u64 tag, + int status) + { ++ struct se_cmd *cmd = &ioctx->cmd; + struct srp_rsp *srp_rsp; + const u8 *sense_data; + int sense_data_len, max_sense_len; ++ u32 resid = cmd->residual_count; + + /* + * The lowest bit of all SAM-3 status codes is zero (see also +@@ -1537,6 +1539,28 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch, + srp_rsp->tag = tag; + srp_rsp->status = status; + ++ if (cmd->se_cmd_flags & SCF_UNDERFLOW_BIT) { ++ if (cmd->data_direction == DMA_TO_DEVICE) { ++ /* residual data from an underflow write */ ++ srp_rsp->flags = SRP_RSP_FLAG_DOUNDER; ++ srp_rsp->data_out_res_cnt = cpu_to_be32(resid); ++ } else if (cmd->data_direction == DMA_FROM_DEVICE) { ++ /* residual data from an underflow read */ ++ srp_rsp->flags = SRP_RSP_FLAG_DIUNDER; ++ srp_rsp->data_in_res_cnt = cpu_to_be32(resid); ++ } ++ } else if (cmd->se_cmd_flags & SCF_OVERFLOW_BIT) { ++ if (cmd->data_direction == DMA_TO_DEVICE) { ++ /* residual data from an overflow write */ ++ srp_rsp->flags = SRP_RSP_FLAG_DOOVER; ++ srp_rsp->data_out_res_cnt = cpu_to_be32(resid); ++ } else if (cmd->data_direction == DMA_FROM_DEVICE) { ++ /* residual data from an overflow read */ ++ srp_rsp->flags = SRP_RSP_FLAG_DIOVER; ++ srp_rsp->data_in_res_cnt = cpu_to_be32(resid); ++ } ++ } ++ + if (sense_data_len) { + BUILD_BUG_ON(MIN_MAX_RSP_SIZE <= sizeof(*srp_rsp)); + max_sense_len = ch->max_ti_iu_len - sizeof(*srp_rsp); +diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c +index a070fa39521a..5d5066cf3bbd 100644 +--- a/drivers/iommu/iommu.c ++++ b/drivers/iommu/iommu.c +@@ -447,6 +447,7 @@ err_put_group: + mutex_unlock(&group->mutex); + dev->iommu_group = NULL; + kobject_put(group->devices_kobj); ++ sysfs_remove_link(group->devices_kobj, device->name); + err_free_name: + kfree(device->name); + err_remove_link: +diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c +index 4d3909393f2c..5c793ac11108 100644 +--- a/drivers/md/dm-snap-persistent.c ++++ b/drivers/md/dm-snap-persistent.c +@@ -17,7 +17,7 @@ + #include "dm-bufio.h" + + #define DM_MSG_PREFIX "persistent snapshot" +-#define DM_CHUNK_SIZE_DEFAULT_SECTORS 32 /* 16KB */ ++#define DM_CHUNK_SIZE_DEFAULT_SECTORS 32U /* 16KB */ + + #define DM_PREFETCH_CHUNKS 12 + +diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c +index f8e5db0cb5aa..62a4fca62776 100644 +--- a/drivers/md/raid0.c ++++ b/drivers/md/raid0.c +@@ -83,7 +83,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) + char b[BDEVNAME_SIZE]; + char b2[BDEVNAME_SIZE]; + struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL); +- unsigned short blksize = 512; ++ unsigned blksize = 512; + + if (!conf) + return -ENOMEM; +diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c +index 667d3720154a..4b7803cec37f 100644 +--- a/drivers/media/platform/exynos4-is/fimc-isp-video.c ++++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c +@@ -323,7 +323,7 @@ static int isp_video_release(struct file *file) + ivc->streaming = 0; + } + +- vb2_fop_release(file); ++ _vb2_fop_release(file, NULL); + + if (v4l2_fh_is_singular_file(file)) { + fimc_pipeline_call(&ivc->ve, close); +diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c +index fd6a3b36208e..2d56cccaa474 100644 +--- a/drivers/media/usb/zr364xx/zr364xx.c ++++ b/drivers/media/usb/zr364xx/zr364xx.c +@@ -711,7 +711,8 @@ static int zr364xx_vidioc_querycap(struct file *file, void *priv, + struct zr364xx_camera *cam = video_drvdata(file); + + strlcpy(cap->driver, DRIVER_DESC, sizeof(cap->driver)); +- strlcpy(cap->card, cam->udev->product, sizeof(cap->card)); ++ if (cam->udev->product) ++ strlcpy(cap->card, cam->udev->product, sizeof(cap->card)); + strlcpy(cap->bus_info, dev_name(&cam->udev->dev), + sizeof(cap->bus_info)); + cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | +diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c +index 14cf6dfc3b14..4d837bcad5db 100644 +--- a/drivers/message/fusion/mptctl.c ++++ b/drivers/message/fusion/mptctl.c +@@ -100,19 +100,19 @@ struct buflist { + * Function prototypes. Called from OS entry point mptctl_ioctl. + * arg contents specific to function. + */ +-static int mptctl_fw_download(unsigned long arg); +-static int mptctl_getiocinfo(unsigned long arg, unsigned int cmd); +-static int mptctl_gettargetinfo(unsigned long arg); +-static int mptctl_readtest(unsigned long arg); +-static int mptctl_mpt_command(unsigned long arg); +-static int mptctl_eventquery(unsigned long arg); +-static int mptctl_eventenable(unsigned long arg); +-static int mptctl_eventreport(unsigned long arg); +-static int mptctl_replace_fw(unsigned long arg); +- +-static int mptctl_do_reset(unsigned long arg); +-static int mptctl_hp_hostinfo(unsigned long arg, unsigned int cmd); +-static int mptctl_hp_targetinfo(unsigned long arg); ++static int mptctl_fw_download(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_getiocinfo(MPT_ADAPTER *iocp, unsigned long arg, unsigned int cmd); ++static int mptctl_gettargetinfo(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_readtest(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_mpt_command(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_eventquery(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_eventenable(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_eventreport(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_replace_fw(MPT_ADAPTER *iocp, unsigned long arg); ++ ++static int mptctl_do_reset(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_hp_hostinfo(MPT_ADAPTER *iocp, unsigned long arg, unsigned int cmd); ++static int mptctl_hp_targetinfo(MPT_ADAPTER *iocp, unsigned long arg); + + static int mptctl_probe(struct pci_dev *, const struct pci_device_id *); + static void mptctl_remove(struct pci_dev *); +@@ -123,8 +123,8 @@ static long compat_mpctl_ioctl(struct file *f, unsigned cmd, unsigned long arg); + /* + * Private function calls. + */ +-static int mptctl_do_mpt_command(struct mpt_ioctl_command karg, void __user *mfPtr); +-static int mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen); ++static int mptctl_do_mpt_command(MPT_ADAPTER *iocp, struct mpt_ioctl_command karg, void __user *mfPtr); ++static int mptctl_do_fw_download(MPT_ADAPTER *iocp, char __user *ufwbuf, size_t fwlen); + static MptSge_t *kbuf_alloc_2_sgl(int bytes, u32 dir, int sge_offset, int *frags, + struct buflist **blp, dma_addr_t *sglbuf_dma, MPT_ADAPTER *ioc); + static void kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, +@@ -656,19 +656,19 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + * by TM and FW reloads. + */ + if ((cmd & ~IOCSIZE_MASK) == (MPTIOCINFO & ~IOCSIZE_MASK)) { +- return mptctl_getiocinfo(arg, _IOC_SIZE(cmd)); ++ return mptctl_getiocinfo(iocp, arg, _IOC_SIZE(cmd)); + } else if (cmd == MPTTARGETINFO) { +- return mptctl_gettargetinfo(arg); ++ return mptctl_gettargetinfo(iocp, arg); + } else if (cmd == MPTTEST) { +- return mptctl_readtest(arg); ++ return mptctl_readtest(iocp, arg); + } else if (cmd == MPTEVENTQUERY) { +- return mptctl_eventquery(arg); ++ return mptctl_eventquery(iocp, arg); + } else if (cmd == MPTEVENTENABLE) { +- return mptctl_eventenable(arg); ++ return mptctl_eventenable(iocp, arg); + } else if (cmd == MPTEVENTREPORT) { +- return mptctl_eventreport(arg); ++ return mptctl_eventreport(iocp, arg); + } else if (cmd == MPTFWREPLACE) { +- return mptctl_replace_fw(arg); ++ return mptctl_replace_fw(iocp, arg); + } + + /* All of these commands require an interrupt or +@@ -678,15 +678,15 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + return ret; + + if (cmd == MPTFWDOWNLOAD) +- ret = mptctl_fw_download(arg); ++ ret = mptctl_fw_download(iocp, arg); + else if (cmd == MPTCOMMAND) +- ret = mptctl_mpt_command(arg); ++ ret = mptctl_mpt_command(iocp, arg); + else if (cmd == MPTHARDRESET) +- ret = mptctl_do_reset(arg); ++ ret = mptctl_do_reset(iocp, arg); + else if ((cmd & ~IOCSIZE_MASK) == (HP_GETHOSTINFO & ~IOCSIZE_MASK)) +- ret = mptctl_hp_hostinfo(arg, _IOC_SIZE(cmd)); ++ ret = mptctl_hp_hostinfo(iocp, arg, _IOC_SIZE(cmd)); + else if (cmd == HP_GETTARGETINFO) +- ret = mptctl_hp_targetinfo(arg); ++ ret = mptctl_hp_targetinfo(iocp, arg); + else + ret = -EINVAL; + +@@ -705,11 +705,10 @@ mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + return ret; + } + +-static int mptctl_do_reset(unsigned long arg) ++static int mptctl_do_reset(MPT_ADAPTER *iocp, unsigned long arg) + { + struct mpt_ioctl_diag_reset __user *urinfo = (void __user *) arg; + struct mpt_ioctl_diag_reset krinfo; +- MPT_ADAPTER *iocp; + + if (copy_from_user(&krinfo, urinfo, sizeof(struct mpt_ioctl_diag_reset))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_do_reset - " +@@ -718,12 +717,6 @@ static int mptctl_do_reset(unsigned long arg) + return -EFAULT; + } + +- if (mpt_verify_adapter(krinfo.hdr.iocnum, &iocp) < 0) { +- printk(KERN_DEBUG MYNAM "%s@%d::mptctl_do_reset - ioc%d not found!\n", +- __FILE__, __LINE__, krinfo.hdr.iocnum); +- return -ENODEV; /* (-6) No such device or address */ +- } +- + dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "mptctl_do_reset called.\n", + iocp->name)); + +@@ -754,7 +747,7 @@ static int mptctl_do_reset(unsigned long arg) + * -ENOMSG if FW upload returned bad status + */ + static int +-mptctl_fw_download(unsigned long arg) ++mptctl_fw_download(MPT_ADAPTER *iocp, unsigned long arg) + { + struct mpt_fw_xfer __user *ufwdl = (void __user *) arg; + struct mpt_fw_xfer kfwdl; +@@ -766,7 +759,7 @@ mptctl_fw_download(unsigned long arg) + return -EFAULT; + } + +- return mptctl_do_fw_download(kfwdl.iocnum, kfwdl.bufp, kfwdl.fwlen); ++ return mptctl_do_fw_download(iocp, kfwdl.bufp, kfwdl.fwlen); + } + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ +@@ -784,11 +777,10 @@ mptctl_fw_download(unsigned long arg) + * -ENOMSG if FW upload returned bad status + */ + static int +-mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) ++mptctl_do_fw_download(MPT_ADAPTER *iocp, char __user *ufwbuf, size_t fwlen) + { + FWDownload_t *dlmsg; + MPT_FRAME_HDR *mf; +- MPT_ADAPTER *iocp; + FWDownloadTCSGE_t *ptsge; + MptSge_t *sgl, *sgIn; + char *sgOut; +@@ -808,17 +800,10 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) + pFWDownloadReply_t ReplyMsg = NULL; + unsigned long timeleft; + +- if (mpt_verify_adapter(ioc, &iocp) < 0) { +- printk(KERN_DEBUG MYNAM "ioctl_fwdl - ioc%d not found!\n", +- ioc); +- return -ENODEV; /* (-6) No such device or address */ +- } else { +- +- /* Valid device. Get a message frame and construct the FW download message. +- */ +- if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL) +- return -EAGAIN; +- } ++ /* Valid device. Get a message frame and construct the FW download message. ++ */ ++ if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL) ++ return -EAGAIN; + + dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT + "mptctl_do_fwdl called. mptctl_id = %xh.\n", iocp->name, mptctl_id)); +@@ -826,8 +811,6 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) + iocp->name, ufwbuf)); + dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.fwlen = %d\n", + iocp->name, (int)fwlen)); +- dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.ioc = %04xh\n", +- iocp->name, ioc)); + + dlmsg = (FWDownload_t*) mf; + ptsge = (FWDownloadTCSGE_t *) &dlmsg->SGL; +@@ -1238,13 +1221,11 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE + * -ENODEV if no such device/adapter + */ + static int +-mptctl_getiocinfo (unsigned long arg, unsigned int data_size) ++mptctl_getiocinfo (MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size) + { + struct mpt_ioctl_iocinfo __user *uarg = (void __user *) arg; + struct mpt_ioctl_iocinfo *karg; +- MPT_ADAPTER *ioc; + struct pci_dev *pdev; +- int iocnum; + unsigned int port; + int cim_rev; + struct scsi_device *sdev; +@@ -1272,14 +1253,6 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) + return PTR_ERR(karg); + } + +- if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- kfree(karg); +- return -ENODEV; +- } +- + /* Verify the data transfer size is correct. */ + if (karg->hdr.maxDataSize != data_size) { + printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_getiocinfo - " +@@ -1385,15 +1358,13 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) + * -ENODEV if no such device/adapter + */ + static int +-mptctl_gettargetinfo (unsigned long arg) ++mptctl_gettargetinfo (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_targetinfo __user *uarg = (void __user *) arg; + struct mpt_ioctl_targetinfo karg; +- MPT_ADAPTER *ioc; + VirtDevice *vdevice; + char *pmem; + int *pdata; +- int iocnum; + int numDevices = 0; + int lun; + int maxWordsLeft; +@@ -1408,13 +1379,6 @@ mptctl_gettargetinfo (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_gettargetinfo called.\n", + ioc->name)); + /* Get the port number and set the maximum number of bytes +@@ -1510,12 +1474,10 @@ mptctl_gettargetinfo (unsigned long arg) + * -ENODEV if no such device/adapter + */ + static int +-mptctl_readtest (unsigned long arg) ++mptctl_readtest (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_test __user *uarg = (void __user *) arg; + struct mpt_ioctl_test karg; +- MPT_ADAPTER *ioc; +- int iocnum; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_readtest - " +@@ -1524,13 +1486,6 @@ mptctl_readtest (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_readtest() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_readtest called.\n", + ioc->name)); + /* Fill in the data and return the structure to the calling +@@ -1571,12 +1526,10 @@ mptctl_readtest (unsigned long arg) + * -ENODEV if no such device/adapter + */ + static int +-mptctl_eventquery (unsigned long arg) ++mptctl_eventquery (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_eventquery __user *uarg = (void __user *) arg; + struct mpt_ioctl_eventquery karg; +- MPT_ADAPTER *ioc; +- int iocnum; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventquery))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_eventquery - " +@@ -1585,13 +1538,6 @@ mptctl_eventquery (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_eventquery() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventquery called.\n", + ioc->name)); + karg.eventEntries = MPTCTL_EVENT_LOG_SIZE; +@@ -1610,12 +1556,10 @@ mptctl_eventquery (unsigned long arg) + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ + static int +-mptctl_eventenable (unsigned long arg) ++mptctl_eventenable (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_eventenable __user *uarg = (void __user *) arg; + struct mpt_ioctl_eventenable karg; +- MPT_ADAPTER *ioc; +- int iocnum; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_eventenable - " +@@ -1624,13 +1568,6 @@ mptctl_eventenable (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_eventenable() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventenable called.\n", + ioc->name)); + if (ioc->events == NULL) { +@@ -1658,12 +1595,10 @@ mptctl_eventenable (unsigned long arg) + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ + static int +-mptctl_eventreport (unsigned long arg) ++mptctl_eventreport (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_eventreport __user *uarg = (void __user *) arg; + struct mpt_ioctl_eventreport karg; +- MPT_ADAPTER *ioc; +- int iocnum; + int numBytes, maxEvents, max; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventreport))) { +@@ -1673,12 +1608,6 @@ mptctl_eventreport (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_eventreport() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventreport called.\n", + ioc->name)); + +@@ -1712,12 +1641,10 @@ mptctl_eventreport (unsigned long arg) + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ + static int +-mptctl_replace_fw (unsigned long arg) ++mptctl_replace_fw (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_replace_fw __user *uarg = (void __user *) arg; + struct mpt_ioctl_replace_fw karg; +- MPT_ADAPTER *ioc; +- int iocnum; + int newFwSize; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) { +@@ -1727,13 +1654,6 @@ mptctl_replace_fw (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_replace_fw() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_replace_fw called.\n", + ioc->name)); + /* If caching FW, Free the old FW image +@@ -1780,12 +1700,10 @@ mptctl_replace_fw (unsigned long arg) + * -ENOMEM if memory allocation error + */ + static int +-mptctl_mpt_command (unsigned long arg) ++mptctl_mpt_command (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_command __user *uarg = (void __user *) arg; + struct mpt_ioctl_command karg; +- MPT_ADAPTER *ioc; +- int iocnum; + int rc; + + +@@ -1796,14 +1714,7 @@ mptctl_mpt_command (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_mpt_command() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- +- rc = mptctl_do_mpt_command (karg, &uarg->MF); ++ rc = mptctl_do_mpt_command (ioc, karg, &uarg->MF); + + return rc; + } +@@ -1821,9 +1732,8 @@ mptctl_mpt_command (unsigned long arg) + * -EPERM if SCSI I/O and target is untagged + */ + static int +-mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) ++mptctl_do_mpt_command (MPT_ADAPTER *ioc, struct mpt_ioctl_command karg, void __user *mfPtr) + { +- MPT_ADAPTER *ioc; + MPT_FRAME_HDR *mf = NULL; + MPIHeader_t *hdr; + char *psge; +@@ -1832,7 +1742,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) + dma_addr_t dma_addr_in; + dma_addr_t dma_addr_out; + int sgSize = 0; /* Num SG elements */ +- int iocnum, flagsLength; ++ int flagsLength; + int sz, rc = 0; + int msgContext; + u16 req_idx; +@@ -1847,13 +1757,6 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) + bufIn.kptr = bufOut.kptr = NULL; + bufIn.len = bufOut.len = 0; + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + spin_lock_irqsave(&ioc->taskmgmt_lock, flags); + if (ioc->ioc_reset_in_progress) { + spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags); +@@ -2418,17 +2321,15 @@ done_free_mem: + * -ENOMEM if memory allocation error + */ + static int +-mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) ++mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size) + { + hp_host_info_t __user *uarg = (void __user *) arg; +- MPT_ADAPTER *ioc; + struct pci_dev *pdev; + char *pbuf=NULL; + dma_addr_t buf_dma; + hp_host_info_t karg; + CONFIGPARMS cfg; + ConfigPageHeader_t hdr; +- int iocnum; + int rc, cim_rev; + ToolboxIstwiReadWriteRequest_t *IstwiRWRequest; + MPT_FRAME_HDR *mf = NULL; +@@ -2452,12 +2353,6 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": mptctl_hp_hostinfo called.\n", + ioc->name)); + +@@ -2670,15 +2565,13 @@ retry_wait: + * -ENOMEM if memory allocation error + */ + static int +-mptctl_hp_targetinfo(unsigned long arg) ++mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg) + { + hp_target_info_t __user *uarg = (void __user *) arg; + SCSIDevicePage0_t *pg0_alloc; + SCSIDevicePage3_t *pg3_alloc; +- MPT_ADAPTER *ioc; + MPT_SCSI_HOST *hd = NULL; + hp_target_info_t karg; +- int iocnum; + int data_sz; + dma_addr_t page_dma; + CONFIGPARMS cfg; +@@ -2692,12 +2585,6 @@ mptctl_hp_targetinfo(unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } + if (karg.hdr.id >= MPT_MAX_FC_DEVICES) + return -EINVAL; + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_hp_targetinfo called.\n", +@@ -2865,7 +2752,7 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd, + kfw.fwlen = kfw32.fwlen; + kfw.bufp = compat_ptr(kfw32.bufp); + +- ret = mptctl_do_fw_download(kfw.iocnum, kfw.bufp, kfw.fwlen); ++ ret = mptctl_do_fw_download(iocp, kfw.bufp, kfw.fwlen); + + mutex_unlock(&iocp->ioctl_cmds.mutex); + +@@ -2919,7 +2806,7 @@ compat_mpt_command(struct file *filp, unsigned int cmd, + + /* Pass new structure to do_mpt_command + */ +- ret = mptctl_do_mpt_command (karg, &uarg->MF); ++ ret = mptctl_do_mpt_command (iocp, karg, &uarg->MF); + + mutex_unlock(&iocp->ioctl_cmds.mutex); + +diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c +index eb29113e0bac..b11737f7bdca 100644 +--- a/drivers/misc/enclosure.c ++++ b/drivers/misc/enclosure.c +@@ -419,10 +419,9 @@ int enclosure_remove_device(struct enclosure_device *edev, struct device *dev) + cdev = &edev->component[i]; + if (cdev->dev == dev) { + enclosure_remove_links(cdev); +- device_del(&cdev->cdev); + put_device(dev); + cdev->dev = NULL; +- return device_add(&cdev->cdev); ++ return 0; + } + } + return -ENODEV; +diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h +index 803df6a32ba9..a942d2d84ed2 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/common.h ++++ b/drivers/net/ethernet/stmicro/stmmac/common.h +@@ -273,8 +273,8 @@ struct dma_features { + unsigned int enh_desc; + }; + +-/* GMAC TX FIFO is 8K, Rx FIFO is 16K */ +-#define BUF_SIZE_16KiB 16384 ++/* RX Buffer size must be multiple of 4/8/16 bytes */ ++#define BUF_SIZE_16KiB 16368 + #define BUF_SIZE_8KiB 8192 + #define BUF_SIZE_4KiB 4096 + #define BUF_SIZE_2KiB 2048 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +index 28a6b7764044..6f695239e658 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -935,7 +935,9 @@ static int stmmac_set_bfsize(int mtu, int bufsize) + { + int ret = bufsize; + +- if (mtu >= BUF_SIZE_4KiB) ++ if (mtu >= BUF_SIZE_8KiB) ++ ret = BUF_SIZE_16KiB; ++ else if (mtu >= BUF_SIZE_4KiB) + ret = BUF_SIZE_8KiB; + else if (mtu >= BUF_SIZE_2KiB) + ret = BUF_SIZE_4KiB; +diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c +index eb825ea52d6b..bd49303f7db2 100644 +--- a/drivers/net/macvlan.c ++++ b/drivers/net/macvlan.c +@@ -233,7 +233,7 @@ static void macvlan_broadcast(struct sk_buff *skb, + struct net_device *src, + enum macvlan_mode mode) + { +- const struct ethhdr *eth = skb_eth_hdr(skb); ++ const struct ethhdr *eth = eth_hdr(skb); + const struct macvlan_dev *vlan; + struct sk_buff *nskb; + unsigned int i; +@@ -476,10 +476,11 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev) + const struct macvlan_dev *dest; + + if (vlan->mode == MACVLAN_MODE_BRIDGE) { +- const struct ethhdr *eth = (void *)skb->data; ++ const struct ethhdr *eth = skb_eth_hdr(skb); + + /* send to other bridge ports directly */ + if (is_multicast_ether_addr(eth->h_dest)) { ++ skb_reset_mac_header(skb); + macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE); + goto xmit_world; + } +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c +index 0d138bc60b18..4174b24963b9 100644 +--- a/drivers/net/usb/lan78xx.c ++++ b/drivers/net/usb/lan78xx.c +@@ -2961,6 +2961,7 @@ static int lan78xx_probe(struct usb_interface *intf, + + if (netdev->mtu > (dev->hard_mtu - netdev->hard_header_len)) + netdev->mtu = dev->hard_mtu - netdev->hard_header_len; ++ netif_set_gso_max_size(netdev, MAX_SINGLE_PACKET_SIZE - MAX_HEADER); + + dev->ep_blkin = (intf->cur_altsetting)->endpoint + 0; + dev->ep_blkout = (intf->cur_altsetting)->endpoint + 1; +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c +index 10dd307593e8..db8b489b0513 100644 +--- a/drivers/net/usb/r8152.c ++++ b/drivers/net/usb/r8152.c +@@ -4243,6 +4243,9 @@ static int rtl8152_probe(struct usb_interface *intf, + return -ENODEV; + } + ++ if (intf->cur_altsetting->desc.bNumEndpoints < 3) ++ return -ENODEV; ++ + usb_reset_device(udev); + netdev = alloc_etherdev(sizeof(struct r8152)); + if (!netdev) { +diff --git a/drivers/net/wimax/i2400m/op-rfkill.c b/drivers/net/wimax/i2400m/op-rfkill.c +index b0dba35a8ad2..dc6fe93ce71f 100644 +--- a/drivers/net/wimax/i2400m/op-rfkill.c ++++ b/drivers/net/wimax/i2400m/op-rfkill.c +@@ -147,6 +147,7 @@ error_msg_to_dev: + error_alloc: + d_fnend(4, dev, "(wimax_dev %p state %d) = %d\n", + wimax_dev, state, result); ++ kfree(cmd); + return result; + } + +diff --git a/drivers/net/wireless/cw1200/fwio.c b/drivers/net/wireless/cw1200/fwio.c +index 30e7646d04af..16be7fa82a23 100644 +--- a/drivers/net/wireless/cw1200/fwio.c ++++ b/drivers/net/wireless/cw1200/fwio.c +@@ -323,12 +323,12 @@ int cw1200_load_firmware(struct cw1200_common *priv) + goto out; + } + +- priv->hw_type = cw1200_get_hw_type(val32, &major_revision); +- if (priv->hw_type < 0) { ++ ret = cw1200_get_hw_type(val32, &major_revision); ++ if (ret < 0) { + pr_err("Can't deduce hardware type.\n"); +- ret = -ENOTSUPP; + goto out; + } ++ priv->hw_type = ret; + + /* Set DPLL Reg value, and read back to confirm writes work */ + ret = cw1200_reg_write_32(priv, ST90TDS_TSET_GEN_R_W_REG_ID, +diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c +index 043bd1c23c19..4a197a32d78c 100644 +--- a/drivers/net/wireless/p54/p54usb.c ++++ b/drivers/net/wireless/p54/p54usb.c +@@ -33,6 +33,8 @@ MODULE_ALIAS("prism54usb"); + MODULE_FIRMWARE("isl3886usb"); + MODULE_FIRMWARE("isl3887usb"); + ++static struct usb_driver p54u_driver; ++ + /* + * Note: + * +@@ -921,9 +923,9 @@ static void p54u_load_firmware_cb(const struct firmware *firmware, + { + struct p54u_priv *priv = context; + struct usb_device *udev = priv->udev; ++ struct usb_interface *intf = priv->intf; + int err; + +- complete(&priv->fw_wait_load); + if (firmware) { + priv->fw = firmware; + err = p54u_start_ops(priv); +@@ -932,26 +934,22 @@ static void p54u_load_firmware_cb(const struct firmware *firmware, + dev_err(&udev->dev, "Firmware not found.\n"); + } + +- if (err) { +- struct device *parent = priv->udev->dev.parent; +- +- dev_err(&udev->dev, "failed to initialize device (%d)\n", err); +- +- if (parent) +- device_lock(parent); ++ complete(&priv->fw_wait_load); ++ /* ++ * At this point p54u_disconnect may have already freed ++ * the "priv" context. Do not use it anymore! ++ */ ++ priv = NULL; + +- device_release_driver(&udev->dev); +- /* +- * At this point p54u_disconnect has already freed +- * the "priv" context. Do not use it anymore! +- */ +- priv = NULL; ++ if (err) { ++ dev_err(&intf->dev, "failed to initialize device (%d)\n", err); + +- if (parent) +- device_unlock(parent); ++ usb_lock_device(udev); ++ usb_driver_release_interface(&p54u_driver, intf); ++ usb_unlock_device(udev); + } + +- usb_put_dev(udev); ++ usb_put_intf(intf); + } + + static int p54u_load_firmware(struct ieee80211_hw *dev, +@@ -972,14 +970,14 @@ static int p54u_load_firmware(struct ieee80211_hw *dev, + dev_info(&priv->udev->dev, "Loading firmware file %s\n", + p54u_fwlist[i].fw); + +- usb_get_dev(udev); ++ usb_get_intf(intf); + err = request_firmware_nowait(THIS_MODULE, 1, p54u_fwlist[i].fw, + device, GFP_KERNEL, priv, + p54u_load_firmware_cb); + if (err) { + dev_err(&priv->udev->dev, "(p54usb) cannot load firmware %s " + "(%d)!\n", p54u_fwlist[i].fw, err); +- usb_put_dev(udev); ++ usb_put_intf(intf); + } + + return err; +@@ -1011,8 +1009,6 @@ static int p54u_probe(struct usb_interface *intf, + skb_queue_head_init(&priv->rx_queue); + init_usb_anchor(&priv->submitted); + +- usb_get_dev(udev); +- + /* really lazy and simple way of figuring out if we're a 3887 */ + /* TODO: should just stick the identification in the device table */ + i = intf->altsetting->desc.bNumEndpoints; +@@ -1053,10 +1049,8 @@ static int p54u_probe(struct usb_interface *intf, + priv->upload_fw = p54u_upload_firmware_net2280; + } + err = p54u_load_firmware(dev, intf); +- if (err) { +- usb_put_dev(udev); ++ if (err) + p54_free_common(dev); +- } + return err; + } + +@@ -1072,7 +1066,6 @@ static void p54u_disconnect(struct usb_interface *intf) + wait_for_completion(&priv->fw_wait_load); + p54_unregister_common(dev); + +- usb_put_dev(interface_to_usbdev(intf)); + release_firmware(priv->fw); + p54_free_common(dev); + } +diff --git a/drivers/net/wireless/realtek/rtlwifi/regd.c b/drivers/net/wireless/realtek/rtlwifi/regd.c +index f67e7e5b13e1..005bd7abc247 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/regd.c ++++ b/drivers/net/wireless/realtek/rtlwifi/regd.c +@@ -427,7 +427,7 @@ int rtl_regd_init(struct ieee80211_hw *hw, + struct wiphy *wiphy = hw->wiphy; + struct country_code_to_enum_rd *country = NULL; + +- if (wiphy == NULL || &rtlpriv->regd == NULL) ++ if (!wiphy) + return -EINVAL; + + /* init country_code from efuse channel plan */ +diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c +index 4df992de7d07..2f40506a5821 100644 +--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c ++++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c +@@ -199,6 +199,7 @@ void rsi_mac80211_detach(struct rsi_hw *adapter) + ieee80211_stop_queues(hw); + ieee80211_unregister_hw(hw); + ieee80211_free_hw(hw); ++ adapter->hw = NULL; + } + + rsi_remove_dbgfs(adapter); +diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c +index 63b5b6838e8b..ca1d507aa532 100644 +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -452,13 +452,7 @@ static void kbd_led_update(struct work_struct *work) + + asus = container_of(work, struct asus_wmi, kbd_led_work); + +- /* +- * bits 0-2: level +- * bit 7: light on/off +- */ +- if (asus->kbd_led_wk > 0) +- ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F); +- ++ ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F); + asus_wmi_set_devstate(ASUS_WMI_DEVID_KBD_BACKLIGHT, ctrl_param, NULL); + } + +diff --git a/drivers/rtc/rtc-msm6242.c b/drivers/rtc/rtc-msm6242.c +index c1c5c4e3b3b4..c981301efbe5 100644 +--- a/drivers/rtc/rtc-msm6242.c ++++ b/drivers/rtc/rtc-msm6242.c +@@ -132,7 +132,8 @@ static int msm6242_read_time(struct device *dev, struct rtc_time *tm) + msm6242_read(priv, MSM6242_SECOND1); + tm->tm_min = msm6242_read(priv, MSM6242_MINUTE10) * 10 + + msm6242_read(priv, MSM6242_MINUTE1); +- tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10 & 3)) * 10 + ++ tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10) & ++ MSM6242_HOUR10_HR_MASK) * 10 + + msm6242_read(priv, MSM6242_HOUR1); + tm->tm_mday = msm6242_read(priv, MSM6242_DAY10) * 10 + + msm6242_read(priv, MSM6242_DAY1); +diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c +index 06a5c52b292f..74740ed3a7c3 100644 +--- a/drivers/rtc/rtc-mt6397.c ++++ b/drivers/rtc/rtc-mt6397.c +@@ -55,6 +55,14 @@ + + #define RTC_AL_SEC 0x0018 + ++#define RTC_AL_SEC_MASK 0x003f ++#define RTC_AL_MIN_MASK 0x003f ++#define RTC_AL_HOU_MASK 0x001f ++#define RTC_AL_DOM_MASK 0x001f ++#define RTC_AL_DOW_MASK 0x0007 ++#define RTC_AL_MTH_MASK 0x000f ++#define RTC_AL_YEA_MASK 0x007f ++ + #define RTC_PDN2 0x002e + #define RTC_PDN2_PWRON_ALARM BIT(4) + +@@ -111,7 +119,7 @@ static irqreturn_t mtk_rtc_irq_handler_thread(int irq, void *data) + irqen = irqsta & ~RTC_IRQ_EN_AL; + mutex_lock(&rtc->lock); + if (regmap_write(rtc->regmap, rtc->addr_base + RTC_IRQ_EN, +- irqen) < 0) ++ irqen) == 0) + mtk_rtc_write_trigger(rtc); + mutex_unlock(&rtc->lock); + +@@ -233,12 +241,12 @@ static int mtk_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) + alm->pending = !!(pdn2 & RTC_PDN2_PWRON_ALARM); + mutex_unlock(&rtc->lock); + +- tm->tm_sec = data[RTC_OFFSET_SEC]; +- tm->tm_min = data[RTC_OFFSET_MIN]; +- tm->tm_hour = data[RTC_OFFSET_HOUR]; +- tm->tm_mday = data[RTC_OFFSET_DOM]; +- tm->tm_mon = data[RTC_OFFSET_MTH]; +- tm->tm_year = data[RTC_OFFSET_YEAR]; ++ tm->tm_sec = data[RTC_OFFSET_SEC] & RTC_AL_SEC_MASK; ++ tm->tm_min = data[RTC_OFFSET_MIN] & RTC_AL_MIN_MASK; ++ tm->tm_hour = data[RTC_OFFSET_HOUR] & RTC_AL_HOU_MASK; ++ tm->tm_mday = data[RTC_OFFSET_DOM] & RTC_AL_DOM_MASK; ++ tm->tm_mon = data[RTC_OFFSET_MTH] & RTC_AL_MTH_MASK; ++ tm->tm_year = data[RTC_OFFSET_YEAR] & RTC_AL_YEA_MASK; + + tm->tm_year += RTC_MIN_YEAR_OFFSET; + tm->tm_mon--; +@@ -259,14 +267,25 @@ static int mtk_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) + tm->tm_year -= RTC_MIN_YEAR_OFFSET; + tm->tm_mon++; + +- data[RTC_OFFSET_SEC] = tm->tm_sec; +- data[RTC_OFFSET_MIN] = tm->tm_min; +- data[RTC_OFFSET_HOUR] = tm->tm_hour; +- data[RTC_OFFSET_DOM] = tm->tm_mday; +- data[RTC_OFFSET_MTH] = tm->tm_mon; +- data[RTC_OFFSET_YEAR] = tm->tm_year; +- + mutex_lock(&rtc->lock); ++ ret = regmap_bulk_read(rtc->regmap, rtc->addr_base + RTC_AL_SEC, ++ data, RTC_OFFSET_COUNT); ++ if (ret < 0) ++ goto exit; ++ ++ data[RTC_OFFSET_SEC] = ((data[RTC_OFFSET_SEC] & ~(RTC_AL_SEC_MASK)) | ++ (tm->tm_sec & RTC_AL_SEC_MASK)); ++ data[RTC_OFFSET_MIN] = ((data[RTC_OFFSET_MIN] & ~(RTC_AL_MIN_MASK)) | ++ (tm->tm_min & RTC_AL_MIN_MASK)); ++ data[RTC_OFFSET_HOUR] = ((data[RTC_OFFSET_HOUR] & ~(RTC_AL_HOU_MASK)) | ++ (tm->tm_hour & RTC_AL_HOU_MASK)); ++ data[RTC_OFFSET_DOM] = ((data[RTC_OFFSET_DOM] & ~(RTC_AL_DOM_MASK)) | ++ (tm->tm_mday & RTC_AL_DOM_MASK)); ++ data[RTC_OFFSET_MTH] = ((data[RTC_OFFSET_MTH] & ~(RTC_AL_MTH_MASK)) | ++ (tm->tm_mon & RTC_AL_MTH_MASK)); ++ data[RTC_OFFSET_YEAR] = ((data[RTC_OFFSET_YEAR] & ~(RTC_AL_YEA_MASK)) | ++ (tm->tm_year & RTC_AL_YEA_MASK)); ++ + if (alm->enabled) { + ret = regmap_bulk_write(rtc->regmap, + rtc->addr_base + RTC_AL_SEC, +diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c +index 72894378ffcf..81de52943b01 100644 +--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c ++++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c +@@ -915,12 +915,12 @@ void bnx2i_free_hba(struct bnx2i_hba *hba) + INIT_LIST_HEAD(&hba->ep_ofld_list); + INIT_LIST_HEAD(&hba->ep_active_list); + INIT_LIST_HEAD(&hba->ep_destroy_list); +- pci_dev_put(hba->pcidev); + + if (hba->regview) { + pci_iounmap(hba->pcidev, hba->regview); + hba->regview = NULL; + } ++ pci_dev_put(hba->pcidev); + bnx2i_free_mp_bdt(hba); + bnx2i_release_free_cid_que(hba); + iscsi_host_free(shost); +diff --git a/drivers/scsi/esas2r/esas2r_flash.c b/drivers/scsi/esas2r/esas2r_flash.c +index 7bd376d95ed5..b02ac389e6c6 100644 +--- a/drivers/scsi/esas2r/esas2r_flash.c ++++ b/drivers/scsi/esas2r/esas2r_flash.c +@@ -1197,6 +1197,7 @@ bool esas2r_nvram_read_direct(struct esas2r_adapter *a) + if (!esas2r_read_flash_block(a, a->nvram, FLS_OFFSET_NVR, + sizeof(struct esas2r_sas_nvram))) { + esas2r_hdebug("NVRAM read failed, using defaults"); ++ up(&a->nvram_semaphore); + return false; + } + +diff --git a/drivers/scsi/fnic/vnic_dev.c b/drivers/scsi/fnic/vnic_dev.c +index 9795d6f3e197..c5b89a003d2a 100644 +--- a/drivers/scsi/fnic/vnic_dev.c ++++ b/drivers/scsi/fnic/vnic_dev.c +@@ -445,26 +445,26 @@ int vnic_dev_soft_reset_done(struct vnic_dev *vdev, int *done) + + int vnic_dev_hang_notify(struct vnic_dev *vdev) + { +- u64 a0, a1; ++ u64 a0 = 0, a1 = 0; + int wait = 1000; + return vnic_dev_cmd(vdev, CMD_HANG_NOTIFY, &a0, &a1, wait); + } + + int vnic_dev_mac_addr(struct vnic_dev *vdev, u8 *mac_addr) + { +- u64 a0, a1; ++ u64 a[2] = {}; + int wait = 1000; + int err, i; + + for (i = 0; i < ETH_ALEN; i++) + mac_addr[i] = 0; + +- err = vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a0, &a1, wait); ++ err = vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a[0], &a[1], wait); + if (err) + return err; + + for (i = 0; i < ETH_ALEN; i++) +- mac_addr[i] = ((u8 *)&a0)[i]; ++ mac_addr[i] = ((u8 *)&a)[i]; + + return 0; + } +@@ -489,38 +489,32 @@ void vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast, + + void vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr) + { +- u64 a0 = 0, a1 = 0; ++ u64 a[2] = {}; + int wait = 1000; + int err; + int i; + + for (i = 0; i < ETH_ALEN; i++) +- ((u8 *)&a0)[i] = addr[i]; ++ ((u8 *)&a)[i] = addr[i]; + +- err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait); ++ err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a[0], &a[1], wait); + if (err) +- printk(KERN_ERR +- "Can't add addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n", +- addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], +- err); ++ pr_err("Can't add addr [%pM], %d\n", addr, err); + } + + void vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr) + { +- u64 a0 = 0, a1 = 0; ++ u64 a[2] = {}; + int wait = 1000; + int err; + int i; + + for (i = 0; i < ETH_ALEN; i++) +- ((u8 *)&a0)[i] = addr[i]; ++ ((u8 *)&a)[i] = addr[i]; + +- err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait); ++ err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a[0], &a[1], wait); + if (err) +- printk(KERN_ERR +- "Can't del addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n", +- addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], +- err); ++ pr_err("Can't del addr [%pM], %d\n", addr, err); + } + + int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr) +diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c +index c291fdff1b33..ea3b77ba12a2 100644 +--- a/drivers/scsi/qla4xxx/ql4_mbx.c ++++ b/drivers/scsi/qla4xxx/ql4_mbx.c +@@ -641,9 +641,6 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha) + + if (qla4xxx_get_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma) != + QLA_SUCCESS) { +- dma_free_coherent(&ha->pdev->dev, +- sizeof(struct addr_ctrl_blk), +- init_fw_cb, init_fw_cb_dma); + goto exit_init_fw_cb; + } + +diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c +index 551fd0329bca..33700ce7d499 100644 +--- a/drivers/scsi/scsi_trace.c ++++ b/drivers/scsi/scsi_trace.c +@@ -17,10 +17,11 @@ + */ + #include + #include ++#include + #include + + #define SERVICE_ACTION16(cdb) (cdb[1] & 0x1f) +-#define SERVICE_ACTION32(cdb) ((cdb[8] << 8) | cdb[9]) ++#define SERVICE_ACTION32(cdb) (get_unaligned_be16(&cdb[8])) + + static const char * + scsi_trace_misc(struct trace_seq *, unsigned char *, int); +@@ -50,17 +51,12 @@ static const char * + scsi_trace_rw10(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- sector_t lba = 0, txlen = 0; ++ u32 lba, txlen; + +- lba |= (cdb[2] << 24); +- lba |= (cdb[3] << 16); +- lba |= (cdb[4] << 8); +- lba |= cdb[5]; +- txlen |= (cdb[7] << 8); +- txlen |= cdb[8]; ++ lba = get_unaligned_be32(&cdb[2]); ++ txlen = get_unaligned_be16(&cdb[7]); + +- trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u", +- (unsigned long long)lba, (unsigned long long)txlen, ++ trace_seq_printf(p, "lba=%u txlen=%u protect=%u", lba, txlen, + cdb[1] >> 5); + + if (cdb[0] == WRITE_SAME) +@@ -75,19 +71,12 @@ static const char * + scsi_trace_rw12(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- sector_t lba = 0, txlen = 0; +- +- lba |= (cdb[2] << 24); +- lba |= (cdb[3] << 16); +- lba |= (cdb[4] << 8); +- lba |= cdb[5]; +- txlen |= (cdb[6] << 24); +- txlen |= (cdb[7] << 16); +- txlen |= (cdb[8] << 8); +- txlen |= cdb[9]; +- +- trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u", +- (unsigned long long)lba, (unsigned long long)txlen, ++ u32 lba, txlen; ++ ++ lba = get_unaligned_be32(&cdb[2]); ++ txlen = get_unaligned_be32(&cdb[6]); ++ ++ trace_seq_printf(p, "lba=%u txlen=%u protect=%u", lba, txlen, + cdb[1] >> 5); + trace_seq_putc(p, 0); + +@@ -98,23 +87,13 @@ static const char * + scsi_trace_rw16(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- sector_t lba = 0, txlen = 0; +- +- lba |= ((u64)cdb[2] << 56); +- lba |= ((u64)cdb[3] << 48); +- lba |= ((u64)cdb[4] << 40); +- lba |= ((u64)cdb[5] << 32); +- lba |= (cdb[6] << 24); +- lba |= (cdb[7] << 16); +- lba |= (cdb[8] << 8); +- lba |= cdb[9]; +- txlen |= (cdb[10] << 24); +- txlen |= (cdb[11] << 16); +- txlen |= (cdb[12] << 8); +- txlen |= cdb[13]; +- +- trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u", +- (unsigned long long)lba, (unsigned long long)txlen, ++ u64 lba; ++ u32 txlen; ++ ++ lba = get_unaligned_be64(&cdb[2]); ++ txlen = get_unaligned_be32(&cdb[10]); ++ ++ trace_seq_printf(p, "lba=%llu txlen=%u protect=%u", lba, txlen, + cdb[1] >> 5); + + if (cdb[0] == WRITE_SAME_16) +@@ -129,8 +108,8 @@ static const char * + scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p), *cmd; +- sector_t lba = 0, txlen = 0; +- u32 ei_lbrt = 0; ++ u64 lba; ++ u32 ei_lbrt, txlen; + + switch (SERVICE_ACTION32(cdb)) { + case READ_32: +@@ -150,26 +129,12 @@ scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len) + goto out; + } + +- lba |= ((u64)cdb[12] << 56); +- lba |= ((u64)cdb[13] << 48); +- lba |= ((u64)cdb[14] << 40); +- lba |= ((u64)cdb[15] << 32); +- lba |= (cdb[16] << 24); +- lba |= (cdb[17] << 16); +- lba |= (cdb[18] << 8); +- lba |= cdb[19]; +- ei_lbrt |= (cdb[20] << 24); +- ei_lbrt |= (cdb[21] << 16); +- ei_lbrt |= (cdb[22] << 8); +- ei_lbrt |= cdb[23]; +- txlen |= (cdb[28] << 24); +- txlen |= (cdb[29] << 16); +- txlen |= (cdb[30] << 8); +- txlen |= cdb[31]; +- +- trace_seq_printf(p, "%s_32 lba=%llu txlen=%llu protect=%u ei_lbrt=%u", +- cmd, (unsigned long long)lba, +- (unsigned long long)txlen, cdb[10] >> 5, ei_lbrt); ++ lba = get_unaligned_be64(&cdb[12]); ++ ei_lbrt = get_unaligned_be32(&cdb[20]); ++ txlen = get_unaligned_be32(&cdb[28]); ++ ++ trace_seq_printf(p, "%s_32 lba=%llu txlen=%u protect=%u ei_lbrt=%u", ++ cmd, lba, txlen, cdb[10] >> 5, ei_lbrt); + + if (SERVICE_ACTION32(cdb) == WRITE_SAME_32) + trace_seq_printf(p, " unmap=%u", cdb[10] >> 3 & 1); +@@ -184,7 +149,7 @@ static const char * + scsi_trace_unmap(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- unsigned int regions = cdb[7] << 8 | cdb[8]; ++ unsigned int regions = get_unaligned_be16(&cdb[7]); + + trace_seq_printf(p, "regions=%u", (regions - 8) / 16); + trace_seq_putc(p, 0); +@@ -196,8 +161,8 @@ static const char * + scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p), *cmd; +- sector_t lba = 0; +- u32 alloc_len = 0; ++ u64 lba; ++ u32 alloc_len; + + switch (SERVICE_ACTION16(cdb)) { + case SAI_READ_CAPACITY_16: +@@ -211,21 +176,10 @@ scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len) + goto out; + } + +- lba |= ((u64)cdb[2] << 56); +- lba |= ((u64)cdb[3] << 48); +- lba |= ((u64)cdb[4] << 40); +- lba |= ((u64)cdb[5] << 32); +- lba |= (cdb[6] << 24); +- lba |= (cdb[7] << 16); +- lba |= (cdb[8] << 8); +- lba |= cdb[9]; +- alloc_len |= (cdb[10] << 24); +- alloc_len |= (cdb[11] << 16); +- alloc_len |= (cdb[12] << 8); +- alloc_len |= cdb[13]; +- +- trace_seq_printf(p, "%s lba=%llu alloc_len=%u", cmd, +- (unsigned long long)lba, alloc_len); ++ lba = get_unaligned_be64(&cdb[2]); ++ alloc_len = get_unaligned_be32(&cdb[10]); ++ ++ trace_seq_printf(p, "%s lba=%llu alloc_len=%u", cmd, lba, alloc_len); + + out: + trace_seq_putc(p, 0); +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c +index 91b9eca75b75..cad9ef012a14 100644 +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -1998,8 +1998,10 @@ static int sd_read_protection_type(struct scsi_disk *sdkp, unsigned char *buffer + u8 type; + int ret = 0; + +- if (scsi_device_protection(sdp) == 0 || (buffer[12] & 1) == 0) ++ if (scsi_device_protection(sdp) == 0 || (buffer[12] & 1) == 0) { ++ sdkp->protection_type = 0; + return ret; ++ } + + type = ((buffer[12] >> 1) & 7) + 1; /* P_TYPE 0 = Type 1 */ + +diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c +index 691c04b3e5b6..938840af9c50 100644 +--- a/drivers/spi/spi-atmel.c ++++ b/drivers/spi/spi-atmel.c +@@ -315,7 +315,6 @@ struct atmel_spi { + struct atmel_spi_dma dma; + + bool keep_cs; +- bool cs_active; + + u32 fifo_size; + }; +@@ -1404,11 +1403,9 @@ static int atmel_spi_one_transfer(struct spi_master *master, + &msg->transfers)) { + as->keep_cs = true; + } else { +- as->cs_active = !as->cs_active; +- if (as->cs_active) +- cs_activate(as, msg->spi); +- else +- cs_deactivate(as, msg->spi); ++ cs_deactivate(as, msg->spi); ++ udelay(10); ++ cs_activate(as, msg->spi); + } + } + +@@ -1431,7 +1428,6 @@ static int atmel_spi_transfer_one_message(struct spi_master *master, + atmel_spi_lock(as); + cs_activate(as, spi); + +- as->cs_active = true; + as->keep_cs = false; + + msg->status = 0; +diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c +index cb6497ce4b61..6e75095af681 100644 +--- a/drivers/target/target_core_fabric_lib.c ++++ b/drivers/target/target_core_fabric_lib.c +@@ -130,7 +130,7 @@ static int srp_get_pr_transport_id( + memset(buf + 8, 0, leading_zero_bytes); + rc = hex2bin(buf + 8 + leading_zero_bytes, p, count); + if (rc < 0) { +- pr_debug("hex2bin failed for %s: %d\n", __func__, rc); ++ pr_debug("hex2bin failed for %s: %d\n", p, rc); + return rc; + } + +diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c +index d607cb2eb64e..b59d0dafefab 100644 +--- a/drivers/tty/serial/imx.c ++++ b/drivers/tty/serial/imx.c +@@ -545,7 +545,7 @@ static void imx_dma_tx(struct imx_port *sport) + dev_err(dev, "DMA mapping error for TX.\n"); + return; + } +- desc = dmaengine_prep_slave_sg(chan, sgl, sport->dma_tx_nents, ++ desc = dmaengine_prep_slave_sg(chan, sgl, ret, + DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT); + if (!desc) { + dma_unmap_sg(dev, sgl, sport->dma_tx_nents, +diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c +index ea4ffc2ebb2f..d23f09e151f8 100644 +--- a/drivers/tty/serial/pch_uart.c ++++ b/drivers/tty/serial/pch_uart.c +@@ -251,6 +251,7 @@ struct eg20t_port { + struct dma_chan *chan_rx; + struct scatterlist *sg_tx_p; + int nent; ++ int orig_nent; + struct scatterlist sg_rx; + int tx_dma_use; + void *rx_buf_virt; +@@ -804,9 +805,10 @@ static void pch_dma_tx_complete(void *arg) + } + xmit->tail &= UART_XMIT_SIZE - 1; + async_tx_ack(priv->desc_tx); +- dma_unmap_sg(port->dev, sg, priv->nent, DMA_TO_DEVICE); ++ dma_unmap_sg(port->dev, sg, priv->orig_nent, DMA_TO_DEVICE); + priv->tx_dma_use = 0; + priv->nent = 0; ++ priv->orig_nent = 0; + kfree(priv->sg_tx_p); + pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); + } +@@ -1031,6 +1033,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) + dev_err(priv->port.dev, "%s:dma_map_sg Failed\n", __func__); + return 0; + } ++ priv->orig_nent = num; + priv->nent = nent; + + for (i = 0; i < nent; i++, sg++) { +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index 7805f3e535ec..75a07b73a82b 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -1146,6 +1146,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) + * PORT_OVER_CURRENT is not. So check for any of them. + */ + if (udev || (portstatus & USB_PORT_STAT_CONNECTION) || ++ (portchange & USB_PORT_STAT_C_CONNECTION) || + (portstatus & USB_PORT_STAT_OVERCURRENT) || + (portchange & USB_PORT_STAT_C_OVERCURRENT)) + set_bit(port1, hub->change_bits); +diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c +index f73ea14e8173..e8a8c4fa944f 100644 +--- a/drivers/usb/serial/ch341.c ++++ b/drivers/usb/serial/ch341.c +@@ -555,9 +555,13 @@ static int ch341_tiocmget(struct tty_struct *tty) + static int ch341_reset_resume(struct usb_serial *serial) + { + struct usb_serial_port *port = serial->port[0]; +- struct ch341_private *priv = usb_get_serial_port_data(port); ++ struct ch341_private *priv; + int ret; + ++ priv = usb_get_serial_port_data(port); ++ if (!priv) ++ return 0; ++ + /* reconfigure ch341 serial port after bus-reset */ + ch341_configure(serial->dev, priv); + +diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c +index 0de11898fee7..75c60e74438d 100644 +--- a/drivers/usb/serial/io_edgeport.c ++++ b/drivers/usb/serial/io_edgeport.c +@@ -572,6 +572,7 @@ static void edge_interrupt_callback(struct urb *urb) + struct usb_serial_port *port; + unsigned char *data = urb->transfer_buffer; + int length = urb->actual_length; ++ unsigned long flags; + int bytes_avail; + int position; + int txCredits; +@@ -603,7 +604,7 @@ static void edge_interrupt_callback(struct urb *urb) + if (length > 1) { + bytes_avail = data[0] | (data[1] << 8); + if (bytes_avail) { +- spin_lock(&edge_serial->es_lock); ++ spin_lock_irqsave(&edge_serial->es_lock, flags); + edge_serial->rxBytesAvail += bytes_avail; + dev_dbg(dev, + "%s - bytes_avail=%d, rxBytesAvail=%d, read_in_progress=%d\n", +@@ -626,7 +627,8 @@ static void edge_interrupt_callback(struct urb *urb) + edge_serial->read_in_progress = false; + } + } +- spin_unlock(&edge_serial->es_lock); ++ spin_unlock_irqrestore(&edge_serial->es_lock, ++ flags); + } + } + /* grab the txcredits for the ports if available */ +@@ -638,10 +640,12 @@ static void edge_interrupt_callback(struct urb *urb) + if (txCredits) { + port = edge_serial->serial->port[portNumber]; + edge_port = usb_get_serial_port_data(port); +- if (edge_port->open) { +- spin_lock(&edge_port->ep_lock); ++ if (edge_port && edge_port->open) { ++ spin_lock_irqsave(&edge_port->ep_lock, ++ flags); + edge_port->txCredits += txCredits; +- spin_unlock(&edge_port->ep_lock); ++ spin_unlock_irqrestore(&edge_port->ep_lock, ++ flags); + dev_dbg(dev, "%s - txcredits for port%d = %d\n", + __func__, portNumber, + edge_port->txCredits); +@@ -682,6 +686,7 @@ static void edge_bulk_in_callback(struct urb *urb) + int retval; + __u16 raw_data_length; + int status = urb->status; ++ unsigned long flags; + + if (status) { + dev_dbg(&urb->dev->dev, "%s - nonzero read bulk status received: %d\n", +@@ -701,7 +706,7 @@ static void edge_bulk_in_callback(struct urb *urb) + + usb_serial_debug_data(dev, __func__, raw_data_length, data); + +- spin_lock(&edge_serial->es_lock); ++ spin_lock_irqsave(&edge_serial->es_lock, flags); + + /* decrement our rxBytes available by the number that we just got */ + edge_serial->rxBytesAvail -= raw_data_length; +@@ -725,7 +730,7 @@ static void edge_bulk_in_callback(struct urb *urb) + edge_serial->read_in_progress = false; + } + +- spin_unlock(&edge_serial->es_lock); ++ spin_unlock_irqrestore(&edge_serial->es_lock, flags); + } + + +@@ -1666,7 +1671,8 @@ static void edge_break(struct tty_struct *tty, int break_state) + static void process_rcvd_data(struct edgeport_serial *edge_serial, + unsigned char *buffer, __u16 bufferLength) + { +- struct device *dev = &edge_serial->serial->dev->dev; ++ struct usb_serial *serial = edge_serial->serial; ++ struct device *dev = &serial->dev->dev; + struct usb_serial_port *port; + struct edgeport_port *edge_port; + __u16 lastBufferLength; +@@ -1771,11 +1777,10 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial, + + /* spit this data back into the tty driver if this + port is open */ +- if (rxLen) { +- port = edge_serial->serial->port[ +- edge_serial->rxPort]; ++ if (rxLen && edge_serial->rxPort < serial->num_ports) { ++ port = serial->port[edge_serial->rxPort]; + edge_port = usb_get_serial_port_data(port); +- if (edge_port->open) { ++ if (edge_port && edge_port->open) { + dev_dbg(dev, "%s - Sending %d bytes to TTY for port %d\n", + __func__, rxLen, + edge_serial->rxPort); +@@ -1783,8 +1788,8 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial, + rxLen); + edge_port->port->icount.rx += rxLen; + } +- buffer += rxLen; + } ++ buffer += rxLen; + break; + + case EXPECT_HDR3: /* Expect 3rd byte of status header */ +@@ -1819,6 +1824,8 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial, + __u8 code = edge_serial->rxStatusCode; + + /* switch the port pointer to the one being currently talked about */ ++ if (edge_serial->rxPort >= edge_serial->serial->num_ports) ++ return; + port = edge_serial->serial->port[edge_serial->rxPort]; + edge_port = usb_get_serial_port_data(port); + if (edge_port == NULL) { +diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c +index 38112be0dbae..a79e9adf4e53 100644 +--- a/drivers/usb/serial/keyspan.c ++++ b/drivers/usb/serial/keyspan.c +@@ -565,6 +565,8 @@ static void usa49_glocont_callback(struct urb *urb) + for (i = 0; i < serial->num_ports; ++i) { + port = serial->port[i]; + p_priv = usb_get_serial_port_data(port); ++ if (!p_priv) ++ continue; + + if (p_priv->resend_cont) { + dev_dbg(&port->dev, "%s - sending setup\n", __func__); +@@ -962,6 +964,8 @@ static void usa67_glocont_callback(struct urb *urb) + for (i = 0; i < serial->num_ports; ++i) { + port = serial->port[i]; + p_priv = usb_get_serial_port_data(port); ++ if (!p_priv) ++ continue; + + if (p_priv->resend_cont) { + dev_dbg(&port->dev, "%s - sending setup\n", __func__); +diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c +index 64bf258e7e00..9606dde3194c 100644 +--- a/drivers/usb/serial/opticon.c ++++ b/drivers/usb/serial/opticon.c +@@ -116,7 +116,7 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype, + retval = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), + requesttype, + USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, +- 0, 0, buffer, 1, 0); ++ 0, 0, buffer, 1, USB_CTRL_SET_TIMEOUT); + kfree(buffer); + + if (retval < 0) +diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c +index af0c87276299..82f28192694f 100644 +--- a/drivers/usb/serial/quatech2.c ++++ b/drivers/usb/serial/quatech2.c +@@ -872,7 +872,10 @@ static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch) + u8 newMSR = (u8) *ch; + unsigned long flags; + ++ /* May be called from qt2_process_read_urb() for an unbound port. */ + port_priv = usb_get_serial_port_data(port); ++ if (!port_priv) ++ return; + + spin_lock_irqsave(&port_priv->lock, flags); + port_priv->shadowMSR = newMSR; +@@ -900,7 +903,10 @@ static void qt2_update_lsr(struct usb_serial_port *port, unsigned char *ch) + unsigned long flags; + u8 newLSR = (u8) *ch; + ++ /* May be called from qt2_process_read_urb() for an unbound port. */ + port_priv = usb_get_serial_port_data(port); ++ if (!port_priv) ++ return; + + if (newLSR & UART_LSR_BI) + newLSR &= (u8) (UART_LSR_OE | UART_LSR_BI); +diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c +index 511242111403..15e05ebf37ac 100644 +--- a/drivers/usb/serial/usb-serial-simple.c ++++ b/drivers/usb/serial/usb-serial-simple.c +@@ -89,6 +89,8 @@ DEVICE(moto_modem, MOTO_IDS); + #define MOTOROLA_TETRA_IDS() \ + { USB_DEVICE(0x0cad, 0x9011) }, /* Motorola Solutions TETRA PEI */ \ + { USB_DEVICE(0x0cad, 0x9012) }, /* MTP6550 */ \ ++ { USB_DEVICE(0x0cad, 0x9013) }, /* MTP3xxx */ \ ++ { USB_DEVICE(0x0cad, 0x9015) }, /* MTP85xx */ \ + { USB_DEVICE(0x0cad, 0x9016) } /* TPG2200 */ + DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS); + +diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c +index 80ba818d3a21..25bee7aba690 100644 +--- a/drivers/usb/serial/usb-serial.c ++++ b/drivers/usb/serial/usb-serial.c +@@ -1350,6 +1350,9 @@ static int usb_serial_register(struct usb_serial_driver *driver) + return -EINVAL; + } + ++ /* Prevent individual ports from being unbound. */ ++ driver->driver.suppress_bind_attrs = true; ++ + usb_serial_operations_init(driver); + + /* Add this device to our list of devices */ +diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c +index 1c789056e7e8..d6f5a74df973 100644 +--- a/drivers/xen/balloon.c ++++ b/drivers/xen/balloon.c +@@ -584,8 +584,15 @@ static void balloon_process(struct work_struct *work) + state = reserve_additional_memory(); + } + +- if (credit < 0) +- state = decrease_reservation(-credit, GFP_BALLOON); ++ if (credit < 0) { ++ long n_pages; ++ ++ n_pages = min(-credit, si_mem_available()); ++ state = decrease_reservation(n_pages, GFP_BALLOON); ++ if (state == BP_DONE && n_pages != -credit && ++ n_pages < totalreserve_pages) ++ state = BP_EAGAIN; ++ } + + state = update_schedule(state); + +@@ -624,6 +631,9 @@ static int add_ballooned_pages(int nr_pages) + } + } + ++ if (si_mem_available() < nr_pages) ++ return -ENOMEM; ++ + st = decrease_reservation(nr_pages, GFP_USER); + if (st != BP_DONE) + return -ENOMEM; +@@ -747,7 +757,7 @@ static int __init balloon_init(void) + balloon_stats.schedule_delay = 1; + balloon_stats.max_schedule_delay = 32; + balloon_stats.retry_count = 1; +- balloon_stats.max_retry_count = RETRY_UNLIMITED; ++ balloon_stats.max_retry_count = 4; + + #ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG + set_online_page_callback(&xen_online_page); +diff --git a/firmware/Makefile b/firmware/Makefile +index e297e1b52636..03232621cc08 100644 +--- a/firmware/Makefile ++++ b/firmware/Makefile +@@ -156,7 +156,7 @@ quiet_cmd_fwbin = MK_FW $@ + PROGBITS=$(if $(CONFIG_ARM),%,@)progbits; \ + echo "/* Generated by firmware/Makefile */" > $@;\ + echo " .section .rodata" >>$@;\ +- echo " .p2align $${ASM_ALIGN}" >>$@;\ ++ echo " .p2align 4" >>$@;\ + echo "_fw_$${FWSTR}_bin:" >>$@;\ + echo " .incbin \"$(2)\"" >>$@;\ + echo "_fw_end:" >>$@;\ +diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c +index 41f1a5dd33a5..4dcce3f034f4 100644 +--- a/fs/cifs/smb2file.c ++++ b/fs/cifs/smb2file.c +@@ -69,7 +69,7 @@ smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, + goto out; + + +- if (oparms->tcon->use_resilient) { ++ if (oparms->tcon->use_resilient) { + nr_ioctl_req.Timeout = 0; /* use server default (120 seconds) */ + nr_ioctl_req.Reserved = 0; + rc = SMB2_ioctl(xid, oparms->tcon, fid->persistent_fid, +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c +index 3557c5717c8d..271d8d9d0598 100644 +--- a/fs/ext4/inode.c ++++ b/fs/ext4/inode.c +@@ -5189,10 +5189,25 @@ static int ext4_expand_extra_isize(struct inode *inode, + { + struct ext4_inode *raw_inode; + struct ext4_xattr_ibody_header *header; ++ unsigned int inode_size = EXT4_INODE_SIZE(inode->i_sb); ++ struct ext4_inode_info *ei = EXT4_I(inode); + + if (EXT4_I(inode)->i_extra_isize >= new_extra_isize) + return 0; + ++ /* this was checked at iget time, but double check for good measure */ ++ if ((EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > inode_size) || ++ (ei->i_extra_isize & 3)) { ++ EXT4_ERROR_INODE(inode, "bad extra_isize %u (inode size %u)", ++ ei->i_extra_isize, ++ EXT4_INODE_SIZE(inode->i_sb)); ++ return -EFSCORRUPTED; ++ } ++ if ((new_extra_isize < ei->i_extra_isize) || ++ (new_extra_isize < 4) || ++ (new_extra_isize > inode_size - EXT4_GOOD_OLD_INODE_SIZE)) ++ return -EINVAL; /* Should never happen */ ++ + raw_inode = ext4_raw_inode(&iloc); + + header = IHDR(inode, raw_inode); +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index 6f00388a1471..adf02b1509ca 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -3169,6 +3169,40 @@ int ext4_calculate_overhead(struct super_block *sb) + return 0; + } + ++static void ext4_clamp_want_extra_isize(struct super_block *sb) ++{ ++ struct ext4_sb_info *sbi = EXT4_SB(sb); ++ struct ext4_super_block *es = sbi->s_es; ++ unsigned def_extra_isize = sizeof(struct ext4_inode) - ++ EXT4_GOOD_OLD_INODE_SIZE; ++ ++ if (sbi->s_inode_size == EXT4_GOOD_OLD_INODE_SIZE) { ++ sbi->s_want_extra_isize = 0; ++ return; ++ } ++ if (sbi->s_want_extra_isize < 4) { ++ sbi->s_want_extra_isize = def_extra_isize; ++ if (ext4_has_feature_extra_isize(sb)) { ++ if (sbi->s_want_extra_isize < ++ le16_to_cpu(es->s_want_extra_isize)) ++ sbi->s_want_extra_isize = ++ le16_to_cpu(es->s_want_extra_isize); ++ if (sbi->s_want_extra_isize < ++ le16_to_cpu(es->s_min_extra_isize)) ++ sbi->s_want_extra_isize = ++ le16_to_cpu(es->s_min_extra_isize); ++ } ++ } ++ /* Check if enough inode space is available */ ++ if ((sbi->s_want_extra_isize > sbi->s_inode_size) || ++ (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize > ++ sbi->s_inode_size)) { ++ sbi->s_want_extra_isize = def_extra_isize; ++ ext4_msg(sb, KERN_INFO, ++ "required extra inode space not available"); ++ } ++} ++ + static void ext4_set_resv_clusters(struct super_block *sb) + { + ext4_fsblk_t resv_clusters; +@@ -3991,29 +4025,7 @@ no_journal: + if (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY)) + sb->s_flags |= MS_RDONLY; + +- /* determine the minimum size of new large inodes, if present */ +- if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) { +- sbi->s_want_extra_isize = sizeof(struct ext4_inode) - +- EXT4_GOOD_OLD_INODE_SIZE; +- if (ext4_has_feature_extra_isize(sb)) { +- if (sbi->s_want_extra_isize < +- le16_to_cpu(es->s_want_extra_isize)) +- sbi->s_want_extra_isize = +- le16_to_cpu(es->s_want_extra_isize); +- if (sbi->s_want_extra_isize < +- le16_to_cpu(es->s_min_extra_isize)) +- sbi->s_want_extra_isize = +- le16_to_cpu(es->s_min_extra_isize); +- } +- } +- /* Check if enough inode space is available */ +- if (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize > +- sbi->s_inode_size) { +- sbi->s_want_extra_isize = sizeof(struct ext4_inode) - +- EXT4_GOOD_OLD_INODE_SIZE; +- ext4_msg(sb, KERN_INFO, "required extra inode space not" +- "available"); +- } ++ ext4_clamp_want_extra_isize(sb); + + ext4_set_resv_clusters(sb); + +@@ -4766,6 +4778,8 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) + goto restore_opts; + } + ++ ext4_clamp_want_extra_isize(sb); ++ + if ((old_opts.s_mount_opt & EXT4_MOUNT_JOURNAL_CHECKSUM) ^ + test_opt(sb, JOURNAL_CHECKSUM)) { + ext4_msg(sb, KERN_ERR, "changing journal_checksum " +diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c +index 2301011428a1..bbf1634ff427 100644 +--- a/fs/ocfs2/journal.c ++++ b/fs/ocfs2/journal.c +@@ -1080,6 +1080,14 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local, int replayed) + + ocfs2_clear_journal_error(osb->sb, journal->j_journal, osb->slot_num); + ++ if (replayed) { ++ jbd2_journal_lock_updates(journal->j_journal); ++ status = jbd2_journal_flush(journal->j_journal); ++ jbd2_journal_unlock_updates(journal->j_journal); ++ if (status < 0) ++ mlog_errno(status); ++ } ++ + status = ocfs2_journal_toggle_dirty(osb, 1, replayed); + if (status < 0) { + mlog_errno(status); +diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c +index df4661abadc4..83720460c5bc 100644 +--- a/fs/proc/meminfo.c ++++ b/fs/proc/meminfo.c +@@ -29,10 +29,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) + unsigned long committed; + long cached; + long available; +- unsigned long pagecache; +- unsigned long wmark_low = 0; + unsigned long pages[NR_LRU_LISTS]; +- struct zone *zone; + int lru; + + /* +@@ -51,33 +48,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) + for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++) + pages[lru] = global_page_state(NR_LRU_BASE + lru); + +- for_each_zone(zone) +- wmark_low += zone->watermark[WMARK_LOW]; +- +- /* +- * Estimate the amount of memory available for userspace allocations, +- * without causing swapping. +- */ +- available = i.freeram - totalreserve_pages; +- +- /* +- * Not all the page cache can be freed, otherwise the system will +- * start swapping. Assume at least half of the page cache, or the +- * low watermark worth of cache, needs to stay. +- */ +- pagecache = pages[LRU_ACTIVE_FILE] + pages[LRU_INACTIVE_FILE]; +- pagecache -= min(pagecache / 2, wmark_low); +- available += pagecache; +- +- /* +- * Part of the reclaimable slab consists of items that are in use, +- * and cannot be freed. Cap this estimate at the low watermark. +- */ +- available += global_page_state(NR_SLAB_RECLAIMABLE) - +- min(global_page_state(NR_SLAB_RECLAIMABLE) / 2, wmark_low); +- +- if (available < 0) +- available = 0; ++ available = si_mem_available(); + + /* + * Tagged format, for easy grepping and expansion. +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h +index e4b945925e40..4ae5d6ecd727 100644 +--- a/include/linux/blkdev.h ++++ b/include/linux/blkdev.h +@@ -264,6 +264,7 @@ struct queue_limits { + unsigned int max_sectors; + unsigned int max_segment_size; + unsigned int physical_block_size; ++ unsigned int logical_block_size; + unsigned int alignment_offset; + unsigned int io_min; + unsigned int io_opt; +@@ -273,7 +274,6 @@ struct queue_limits { + unsigned int discard_granularity; + unsigned int discard_alignment; + +- unsigned short logical_block_size; + unsigned short max_segments; + unsigned short max_integrity_segments; + +@@ -975,7 +975,7 @@ extern void blk_queue_max_discard_sectors(struct request_queue *q, + unsigned int max_discard_sectors); + extern void blk_queue_max_write_same_sectors(struct request_queue *q, + unsigned int max_write_same_sectors); +-extern void blk_queue_logical_block_size(struct request_queue *, unsigned short); ++extern void blk_queue_logical_block_size(struct request_queue *, unsigned int); + extern void blk_queue_physical_block_size(struct request_queue *, unsigned int); + extern void blk_queue_alignment_offset(struct request_queue *q, + unsigned int alignment); +@@ -1193,7 +1193,7 @@ static inline unsigned int queue_max_segment_size(struct request_queue *q) + return q->limits.max_segment_size; + } + +-static inline unsigned short queue_logical_block_size(struct request_queue *q) ++static inline unsigned queue_logical_block_size(struct request_queue *q) + { + int retval = 512; + +@@ -1203,7 +1203,7 @@ static inline unsigned short queue_logical_block_size(struct request_queue *q) + return retval; + } + +-static inline unsigned short bdev_logical_block_size(struct block_device *bdev) ++static inline unsigned int bdev_logical_block_size(struct block_device *bdev) + { + return queue_logical_block_size(bdev_get_queue(bdev)); + } +diff --git a/include/linux/mm.h b/include/linux/mm.h +index ed653ba47c46..15f81b2b87ed 100644 +--- a/include/linux/mm.h ++++ b/include/linux/mm.h +@@ -1802,6 +1802,7 @@ extern int __meminit init_per_zone_wmark_min(void); + extern void mem_init(void); + extern void __init mmap_init(void); + extern void show_mem(unsigned int flags); ++extern long si_mem_available(void); + extern void si_meminfo(struct sysinfo * val); + extern void si_meminfo_node(struct sysinfo *val, int nid); + +diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h +index d8ecefaf63ca..6b8ec40af2c4 100644 +--- a/include/linux/regulator/ab8500.h ++++ b/include/linux/regulator/ab8500.h +@@ -44,8 +44,6 @@ enum ab8505_regulator_id { + AB8505_LDO_ANAMIC2, + AB8505_LDO_AUX8, + AB8505_LDO_ANA, +- AB8505_SYSCLKREQ_2, +- AB8505_SYSCLKREQ_4, + AB8505_NUM_REGULATORS, + }; + +diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h +index c05748cc1b20..3fe53101b72a 100644 +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -3855,6 +3855,17 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); + const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, + const u8 *ies, int len); + ++/** ++ * cfg80211_send_layer2_update - send layer 2 update frame ++ * ++ * @dev: network device ++ * @addr: STA MAC address ++ * ++ * Wireless drivers can use this function to update forwarding tables in bridge ++ * devices upon STA association. ++ */ ++void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr); ++ + /** + * DOC: Regulatory enforcement infrastructure + * +diff --git a/mm/page-writeback.c b/mm/page-writeback.c +index d2211e42b779..698806914be7 100644 +--- a/mm/page-writeback.c ++++ b/mm/page-writeback.c +@@ -200,11 +200,11 @@ static void wb_min_max_ratio(struct bdi_writeback *wb, + if (this_bw < tot_bw) { + if (min) { + min *= this_bw; +- do_div(min, tot_bw); ++ min = div64_ul(min, tot_bw); + } + if (max < 100) { + max *= this_bw; +- do_div(max, tot_bw); ++ max = div64_ul(max, tot_bw); + } + } + +diff --git a/mm/page_alloc.c b/mm/page_alloc.c +index fd75e27c9b40..df589416ace6 100644 +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -3650,6 +3650,49 @@ static inline void show_node(struct zone *zone) + printk("Node %d ", zone_to_nid(zone)); + } + ++long si_mem_available(void) ++{ ++ long available; ++ unsigned long pagecache; ++ unsigned long wmark_low = 0; ++ unsigned long pages[NR_LRU_LISTS]; ++ struct zone *zone; ++ int lru; ++ ++ for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++) ++ pages[lru] = global_page_state(NR_LRU_BASE + lru); ++ ++ for_each_zone(zone) ++ wmark_low += zone->watermark[WMARK_LOW]; ++ ++ /* ++ * Estimate the amount of memory available for userspace allocations, ++ * without causing swapping. ++ */ ++ available = global_page_state(NR_FREE_PAGES) - totalreserve_pages; ++ ++ /* ++ * Not all the page cache can be freed, otherwise the system will ++ * start swapping. Assume at least half of the page cache, or the ++ * low watermark worth of cache, needs to stay. ++ */ ++ pagecache = pages[LRU_ACTIVE_FILE] + pages[LRU_INACTIVE_FILE]; ++ pagecache -= min(pagecache / 2, wmark_low); ++ available += pagecache; ++ ++ /* ++ * Part of the reclaimable slab consists of items that are in use, ++ * and cannot be freed. Cap this estimate at the low watermark. ++ */ ++ available += global_page_state(NR_SLAB_RECLAIMABLE) - ++ min(global_page_state(NR_SLAB_RECLAIMABLE) / 2, wmark_low); ++ ++ if (available < 0) ++ available = 0; ++ return available; ++} ++EXPORT_SYMBOL_GPL(si_mem_available); ++ + void si_meminfo(struct sysinfo *val) + { + val->totalram = totalram_pages; +diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c +index c2dff7c6e960..76808c5e8183 100644 +--- a/net/batman-adv/distributed-arp-table.c ++++ b/net/batman-adv/distributed-arp-table.c +@@ -226,6 +226,7 @@ static u32 batadv_hash_dat(const void *data, u32 size) + u32 hash = 0; + const struct batadv_dat_entry *dat = data; + const unsigned char *key; ++ __be16 vid; + u32 i; + + key = (const unsigned char *)&dat->ip; +@@ -235,7 +236,8 @@ static u32 batadv_hash_dat(const void *data, u32 size) + hash ^= (hash >> 6); + } + +- key = (const unsigned char *)&dat->vid; ++ vid = htons(dat->vid); ++ key = (__force const unsigned char *)&vid; + for (i = 0; i < sizeof(dat->vid); i++) { + hash += key[i]; + hash += (hash << 10); +diff --git a/net/dccp/feat.c b/net/dccp/feat.c +index f227f002c73d..db87d9f58019 100644 +--- a/net/dccp/feat.c ++++ b/net/dccp/feat.c +@@ -738,7 +738,12 @@ static int __feat_register_sp(struct list_head *fn, u8 feat, u8 is_local, + if (dccp_feat_clone_sp_val(&fval, sp_val, sp_len)) + return -ENOMEM; + +- return dccp_feat_push_change(fn, feat, is_local, mandatory, &fval); ++ if (dccp_feat_push_change(fn, feat, is_local, mandatory, &fval)) { ++ kfree(fval.sp.vec); ++ return -ENOMEM; ++ } ++ ++ return 0; + } + + /** +diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c +index 943378d6e4c3..8dd239214a14 100644 +--- a/net/hsr/hsr_device.c ++++ b/net/hsr/hsr_device.c +@@ -289,6 +289,8 @@ static void send_hsr_supervision_frame(struct hsr_port *master, u8 type) + skb->dev->dev_addr, skb->len) <= 0) + goto out; + skb_reset_mac_header(skb); ++ skb_reset_network_header(skb); ++ skb_reset_transport_header(skb); + + hsr_stag = (typeof(hsr_stag)) skb_put(skb, sizeof(*hsr_stag)); + +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c +index 1abf88aec19d..88bfd663d9a2 100644 +--- a/net/ipv4/tcp_input.c ++++ b/net/ipv4/tcp_input.c +@@ -895,9 +895,10 @@ static void tcp_update_reordering(struct sock *sk, const int metric, + /* This must be called before lost_out is incremented */ + static void tcp_verify_retransmit_hint(struct tcp_sock *tp, struct sk_buff *skb) + { +- if (!tp->retransmit_skb_hint || +- before(TCP_SKB_CB(skb)->seq, +- TCP_SKB_CB(tp->retransmit_skb_hint)->seq)) ++ if ((!tp->retransmit_skb_hint && tp->retrans_out >= tp->lost_out) || ++ (tp->retransmit_skb_hint && ++ before(TCP_SKB_CB(skb)->seq, ++ TCP_SKB_CB(tp->retransmit_skb_hint)->seq))) + tp->retransmit_skb_hint = skb; + + if (!tp->lost_out || +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c +index 1999a7eaa692..cf3917c6da0a 100644 +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -875,50 +875,6 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev) + return 0; + } + +-/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ +-struct iapp_layer2_update { +- u8 da[ETH_ALEN]; /* broadcast */ +- u8 sa[ETH_ALEN]; /* STA addr */ +- __be16 len; /* 6 */ +- u8 dsap; /* 0 */ +- u8 ssap; /* 0 */ +- u8 control; +- u8 xid_info[3]; +-} __packed; +- +-static void ieee80211_send_layer2_update(struct sta_info *sta) +-{ +- struct iapp_layer2_update *msg; +- struct sk_buff *skb; +- +- /* Send Level 2 Update Frame to update forwarding tables in layer 2 +- * bridge devices */ +- +- skb = dev_alloc_skb(sizeof(*msg)); +- if (!skb) +- return; +- msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg)); +- +- /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) +- * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ +- +- eth_broadcast_addr(msg->da); +- memcpy(msg->sa, sta->sta.addr, ETH_ALEN); +- msg->len = htons(6); +- msg->dsap = 0; +- msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */ +- msg->control = 0xaf; /* XID response lsb.1111F101. +- * F=0 (no poll command; unsolicited frame) */ +- msg->xid_info[0] = 0x81; /* XID format identifier */ +- msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */ +- msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */ +- +- skb->dev = sta->sdata->dev; +- skb->protocol = eth_type_trans(skb, sta->sdata->dev); +- memset(skb->cb, 0, sizeof(skb->cb)); +- netif_rx_ni(skb); +-} +- + static int sta_apply_auth_flags(struct ieee80211_local *local, + struct sta_info *sta, + u32 mask, u32 set) +@@ -1194,7 +1150,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, + struct sta_info *sta; + struct ieee80211_sub_if_data *sdata; + int err; +- int layer2_update; + + if (params->vlan) { + sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); +@@ -1248,18 +1203,12 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, + test_sta_flag(sta, WLAN_STA_ASSOC)) + rate_control_rate_init(sta); + +- layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN || +- sdata->vif.type == NL80211_IFTYPE_AP; +- + err = sta_info_insert_rcu(sta); + if (err) { + rcu_read_unlock(); + return err; + } + +- if (layer2_update) +- ieee80211_send_layer2_update(sta); +- + rcu_read_unlock(); + + return 0; +@@ -1367,7 +1316,9 @@ static int ieee80211_change_station(struct wiphy *wiphy, + atomic_inc(&sta->sdata->bss->num_mcast_sta); + } + +- ieee80211_send_layer2_update(sta); ++ if (sta->sta_state == IEEE80211_STA_AUTHORIZED) ++ cfg80211_send_layer2_update(sta->sdata->dev, ++ sta->sta.addr); + } + + err = sta_apply_parameters(local, sta, params); +diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c +index 7e7b9ef29d8d..1cad7ca9234b 100644 +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -1775,6 +1775,10 @@ int sta_info_move_state(struct sta_info *sta, + set_bit(WLAN_STA_AUTHORIZED, &sta->_flags); + ieee80211_check_fast_xmit(sta); + } ++ if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN || ++ sta->sdata->vif.type == NL80211_IFTYPE_AP) ++ cfg80211_send_layer2_update(sta->sdata->dev, ++ sta->sta.addr); + break; + default: + break; +diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h b/net/netfilter/ipset/ip_set_bitmap_gen.h +index b0bc475f641e..adc703ccd68b 100644 +--- a/net/netfilter/ipset/ip_set_bitmap_gen.h ++++ b/net/netfilter/ipset/ip_set_bitmap_gen.h +@@ -66,9 +66,9 @@ mtype_destroy(struct ip_set *set) + if (SET_WITH_TIMEOUT(set)) + del_timer_sync(&map->gc); + +- ip_set_free(map->members); + if (set->dsize && set->extensions & IPSET_EXT_DESTROY) + mtype_ext_cleanup(set); ++ ip_set_free(map->members); + ip_set_free(map); + + set->data = NULL; +diff --git a/net/socket.c b/net/socket.c +index e5bb73eb36fe..15bdba4211ad 100644 +--- a/net/socket.c ++++ b/net/socket.c +@@ -3143,6 +3143,7 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, + case SIOCSARP: + case SIOCGARP: + case SIOCDARP: ++ case SIOCOUTQNSD: + case SIOCATMARK: + return sock_do_ioctl(net, sock, cmd, arg); + } +diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h +index c23516d0f807..b3a60c3e1934 100644 +--- a/net/wireless/rdev-ops.h ++++ b/net/wireless/rdev-ops.h +@@ -517,6 +517,10 @@ static inline int + rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed) + { + int ret; ++ ++ if (!rdev->ops->set_wiphy_params) ++ return -EOPNOTSUPP; ++ + trace_rdev_set_wiphy_params(&rdev->wiphy, changed); + ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed); + trace_rdev_return_int(&rdev->wiphy, ret); +diff --git a/net/wireless/util.c b/net/wireless/util.c +index 405388772fc4..156a2a6337b9 100644 +--- a/net/wireless/util.c ++++ b/net/wireless/util.c +@@ -1814,3 +1814,48 @@ EXPORT_SYMBOL(rfc1042_header); + const unsigned char bridge_tunnel_header[] __aligned(2) = + { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; + EXPORT_SYMBOL(bridge_tunnel_header); ++ ++/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ ++struct iapp_layer2_update { ++ u8 da[ETH_ALEN]; /* broadcast */ ++ u8 sa[ETH_ALEN]; /* STA addr */ ++ __be16 len; /* 6 */ ++ u8 dsap; /* 0 */ ++ u8 ssap; /* 0 */ ++ u8 control; ++ u8 xid_info[3]; ++} __packed; ++ ++void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr) ++{ ++ struct iapp_layer2_update *msg; ++ struct sk_buff *skb; ++ ++ /* Send Level 2 Update Frame to update forwarding tables in layer 2 ++ * bridge devices */ ++ ++ skb = dev_alloc_skb(sizeof(*msg)); ++ if (!skb) ++ return; ++ msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg)); ++ ++ /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) ++ * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ ++ ++ eth_broadcast_addr(msg->da); ++ ether_addr_copy(msg->sa, addr); ++ msg->len = htons(6); ++ msg->dsap = 0; ++ msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */ ++ msg->control = 0xaf; /* XID response lsb.1111F101. ++ * F=0 (no poll command; unsolicited frame) */ ++ msg->xid_info[0] = 0x81; /* XID format identifier */ ++ msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */ ++ msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */ ++ ++ skb->dev = dev; ++ skb->protocol = eth_type_trans(skb, dev); ++ memset(skb->cb, 0, sizeof(skb->cb)); ++ netif_rx_ni(skb); ++} ++EXPORT_SYMBOL(cfg80211_send_layer2_update); +diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c +index 3be67560ead5..c526201fd0df 100644 +--- a/sound/core/seq/seq_timer.c ++++ b/sound/core/seq/seq_timer.c +@@ -484,15 +484,19 @@ void snd_seq_info_timer_read(struct snd_info_entry *entry, + q = queueptr(idx); + if (q == NULL) + continue; +- if ((tmr = q->timer) == NULL || +- (ti = tmr->timeri) == NULL) { +- queuefree(q); +- continue; +- } ++ mutex_lock(&q->timer_mutex); ++ tmr = q->timer; ++ if (!tmr) ++ goto unlock; ++ ti = tmr->timeri; ++ if (!ti) ++ goto unlock; + snd_iprintf(buffer, "Timer for queue %i : %s\n", q->queue, ti->timer->name); + resolution = snd_timer_resolution(ti) * tmr->ticks; + snd_iprintf(buffer, " Period time : %lu.%09lu\n", resolution / 1000000000, resolution % 1000000000); + snd_iprintf(buffer, " Skew : %u / %u\n", tmr->skew, tmr->skew_base); ++unlock: ++ mutex_unlock(&q->timer_mutex); + queuefree(q); + } + } +diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c +index 41aa3355e920..e85ada14a8e1 100644 +--- a/sound/usb/line6/pcm.c ++++ b/sound/usb/line6/pcm.c +@@ -523,13 +523,6 @@ int line6_init_pcm(struct usb_line6 *line6, + line6pcm->volume_monitor = 255; + line6pcm->line6 = line6; + +- /* Read and write buffers are sized identically, so choose minimum */ +- line6pcm->max_packet_size = min( +- usb_maxpacket(line6->usbdev, +- usb_rcvisocpipe(line6->usbdev, ep_read), 0), +- usb_maxpacket(line6->usbdev, +- usb_sndisocpipe(line6->usbdev, ep_write), 1)); +- + spin_lock_init(&line6pcm->out.lock); + spin_lock_init(&line6pcm->in.lock); + line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD; +@@ -539,6 +532,18 @@ int line6_init_pcm(struct usb_line6 *line6, + pcm->private_data = line6pcm; + pcm->private_free = line6_cleanup_pcm; + ++ /* Read and write buffers are sized identically, so choose minimum */ ++ line6pcm->max_packet_size = min( ++ usb_maxpacket(line6->usbdev, ++ usb_rcvisocpipe(line6->usbdev, ep_read), 0), ++ usb_maxpacket(line6->usbdev, ++ usb_sndisocpipe(line6->usbdev, ep_write), 1)); ++ if (!line6pcm->max_packet_size) { ++ dev_err(line6pcm->line6->ifcdev, ++ "cannot get proper max packet size\n"); ++ return -EINVAL; ++ } ++ + err = line6_create_audio_out_urbs(line6pcm); + if (err < 0) + return err; +diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c +index 5ca8836b16e7..89bb0f76e896 100644 +--- a/tools/perf/util/probe-finder.c ++++ b/tools/perf/util/probe-finder.c +@@ -597,38 +597,26 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwfl_Module *mod, + const char *function, + struct probe_trace_point *tp) + { +- Dwarf_Addr eaddr, highaddr; ++ Dwarf_Addr eaddr; + GElf_Sym sym; + const char *symbol; + + /* Verify the address is correct */ +- if (dwarf_entrypc(sp_die, &eaddr) != 0) { +- pr_warning("Failed to get entry address of %s\n", +- dwarf_diename(sp_die)); +- return -ENOENT; +- } +- if (dwarf_highpc(sp_die, &highaddr) != 0) { +- pr_warning("Failed to get end address of %s\n", +- dwarf_diename(sp_die)); +- return -ENOENT; +- } +- if (paddr > highaddr) { +- pr_warning("Offset specified is greater than size of %s\n", ++ if (!dwarf_haspc(sp_die, paddr)) { ++ pr_warning("Specified offset is out of %s\n", + dwarf_diename(sp_die)); + return -EINVAL; + } + +- symbol = dwarf_diename(sp_die); ++ /* Try to get actual symbol name from symtab */ ++ symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL); + if (!symbol) { +- /* Try to get the symbol name from symtab */ +- symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL); +- if (!symbol) { +- pr_warning("Failed to find symbol at 0x%lx\n", +- (unsigned long)paddr); +- return -ENOENT; +- } +- eaddr = sym.st_value; ++ pr_warning("Failed to find symbol at 0x%lx\n", ++ (unsigned long)paddr); ++ return -ENOENT; + } ++ eaddr = sym.st_value; ++ + tp->offset = (unsigned long)(paddr - eaddr); + tp->address = (unsigned long)paddr; + tp->symbol = strdup(symbol); +diff --git a/tools/testing/selftests/rseq/settings b/tools/testing/selftests/rseq/settings +new file mode 100644 +index 000000000000..e7b9417537fb +--- /dev/null ++++ b/tools/testing/selftests/rseq/settings +@@ -0,0 +1 @@ ++timeout=0 diff --git a/patch/kernel/rockchip64-legacy/patch-4.4.210-211.patch b/patch/kernel/rockchip64-legacy/patch-4.4.210-211.patch new file mode 100644 index 000000000..fdade4d9f --- /dev/null +++ b/patch/kernel/rockchip64-legacy/patch-4.4.210-211.patch @@ -0,0 +1,2692 @@ +diff --git a/Documentation/ABI/testing/sysfs-bus-mei b/Documentation/ABI/testing/sysfs-bus-mei +index 6bd45346ac7e..3f8701e8fa24 100644 +--- a/Documentation/ABI/testing/sysfs-bus-mei ++++ b/Documentation/ABI/testing/sysfs-bus-mei +@@ -4,7 +4,7 @@ KernelVersion: 3.10 + Contact: Samuel Ortiz + linux-mei@linux.intel.com + Description: Stores the same MODALIAS value emitted by uevent +- Format: mei::: ++ Format: mei::: + + What: /sys/bus/mei/devices/.../name + Date: May 2015 +diff --git a/Makefile b/Makefile +index c09b55163c2c..9f03733dac69 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,6 @@ + VERSION = 4 + PATCHLEVEL = 4 +-SUBLEVEL = 210 ++SUBLEVEL = 211 + EXTRAVERSION = + NAME = Blurry Fish Butt + +diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +index 6a37101344aa..751d8b60df1d 100644 +--- a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi ++++ b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +@@ -56,10 +56,10 @@ + + pmu { + compatible = "arm,armv8-pmuv3"; +- interrupts = <0 120 8>, +- <0 121 8>, +- <0 122 8>, +- <0 123 8>; ++ interrupts = <0 170 4>, ++ <0 171 4>, ++ <0 172 4>, ++ <0 173 4>; + interrupt-affinity = <&cpu0>, + <&cpu1>, + <&cpu2>, +diff --git a/arch/hexagon/kernel/stacktrace.c b/arch/hexagon/kernel/stacktrace.c +index f94918b449a8..03a0e10ecdcc 100644 +--- a/arch/hexagon/kernel/stacktrace.c ++++ b/arch/hexagon/kernel/stacktrace.c +@@ -23,8 +23,6 @@ + #include + #include + +-register unsigned long current_frame_pointer asm("r30"); +- + struct stackframe { + unsigned long fp; + unsigned long rets; +@@ -42,7 +40,7 @@ void save_stack_trace(struct stack_trace *trace) + + low = (unsigned long)task_stack_page(current); + high = low + THREAD_SIZE; +- fp = current_frame_pointer; ++ fp = (unsigned long)__builtin_frame_address(0); + + while (fp >= low && fp <= (high - sizeof(*frame))) { + frame = (struct stackframe *)fp; +diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S +index 86558a199139..b831e24f7168 100644 +--- a/arch/x86/boot/compressed/head_64.S ++++ b/arch/x86/boot/compressed/head_64.S +@@ -225,6 +225,11 @@ ENTRY(efi32_stub_entry) + leal efi32_config(%ebp), %eax + movl %eax, efi_config(%ebp) + ++ /* Disable paging */ ++ movl %cr0, %eax ++ btrl $X86_CR0_PG_BIT, %eax ++ movl %eax, %cr0 ++ + jmp startup_32 + ENDPROC(efi32_stub_entry) + #endif +diff --git a/block/blk-settings.c b/block/blk-settings.c +index c7bb666aafd1..eb96abdce29c 100644 +--- a/block/blk-settings.c ++++ b/block/blk-settings.c +@@ -349,7 +349,7 @@ EXPORT_SYMBOL(blk_queue_max_segment_size); + * storage device can address. The default of 512 covers most + * hardware. + **/ +-void blk_queue_logical_block_size(struct request_queue *q, unsigned short size) ++void blk_queue_logical_block_size(struct request_queue *q, unsigned int size) + { + q->limits.logical_block_size = size; + +diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c +index 2fee2eef988d..e1f71debdbba 100644 +--- a/drivers/block/xen-blkfront.c ++++ b/drivers/block/xen-blkfront.c +@@ -952,8 +952,8 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity, + if (!VDEV_IS_EXTENDED(info->vdevice)) { + err = xen_translate_vdev(info->vdevice, &minor, &offset); + if (err) +- return err; +- nr_parts = PARTS_PER_DISK; ++ return err; ++ nr_parts = PARTS_PER_DISK; + } else { + minor = BLKIF_MINOR_EXT(info->vdevice); + nr_parts = PARTS_PER_EXT_DISK; +diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c +index c94de13ce362..21bfedf40478 100644 +--- a/drivers/clk/samsung/clk-exynos5420.c ++++ b/drivers/clk/samsung/clk-exynos5420.c +@@ -166,6 +166,8 @@ static unsigned long exynos5x_clk_regs[] __initdata = { + GATE_BUS_CPU, + GATE_SCLK_CPU, + CLKOUT_CMU_CPU, ++ APLL_CON0, ++ KPLL_CON0, + CPLL_CON0, + DPLL_CON0, + EPLL_CON0, +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c +index db0801c7bb8e..503405d32d24 100644 +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -1949,8 +1949,9 @@ static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id, + + if (chip->ngpio <= p->chip_hwnum) { + dev_err(dev, +- "requested GPIO %d is out of range [0..%d] for chip %s\n", +- idx, chip->ngpio, chip->label); ++ "requested GPIO %u (%u) is out of range [0..%u] for chip %s\n", ++ idx, p->chip_hwnum, chip->ngpio - 1, ++ chip->label); + return ERR_PTR(-EINVAL); + } + +diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c +index 627a24d3ea7c..ef9e196b54a5 100644 +--- a/drivers/hid/hidraw.c ++++ b/drivers/hid/hidraw.c +@@ -262,13 +262,14 @@ out: + static unsigned int hidraw_poll(struct file *file, poll_table *wait) + { + struct hidraw_list *list = file->private_data; ++ unsigned int mask = POLLOUT | POLLWRNORM; /* hidraw is always writable */ + + poll_wait(file, &list->hidraw->wait, wait); + if (list->head != list->tail) +- return POLLIN | POLLRDNORM; ++ mask |= POLLIN | POLLRDNORM; + if (!list->hidraw->exist) +- return POLLERR | POLLHUP; +- return 0; ++ mask |= POLLERR | POLLHUP; ++ return mask; + } + + static int hidraw_open(struct inode *inode, struct file *file) +diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c +index ea0c860ee842..a7ba4db8cff7 100644 +--- a/drivers/hid/uhid.c ++++ b/drivers/hid/uhid.c +@@ -769,13 +769,14 @@ unlock: + static unsigned int uhid_char_poll(struct file *file, poll_table *wait) + { + struct uhid_device *uhid = file->private_data; ++ unsigned int mask = POLLOUT | POLLWRNORM; /* uhid is always writable */ + + poll_wait(file, &uhid->waitq, wait); + + if (uhid->head != uhid->tail) +- return POLLIN | POLLRDNORM; ++ mask |= POLLIN | POLLRDNORM; + +- return EPOLLOUT | EPOLLWRNORM; ++ return mask; + } + + static const struct file_operations uhid_fops = { +diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c +index eeed374ebc6c..4ca3a4ae2743 100644 +--- a/drivers/iio/imu/adis16480.c ++++ b/drivers/iio/imu/adis16480.c +@@ -372,12 +372,14 @@ static int adis16480_get_calibbias(struct iio_dev *indio_dev, + case IIO_MAGN: + case IIO_PRESSURE: + ret = adis_read_reg_16(&st->adis, reg, &val16); +- *bias = sign_extend32(val16, 15); ++ if (ret == 0) ++ *bias = sign_extend32(val16, 15); + break; + case IIO_ANGL_VEL: + case IIO_ACCEL: + ret = adis_read_reg_32(&st->adis, reg, &val32); +- *bias = sign_extend32(val32, 31); ++ if (ret == 0) ++ *bias = sign_extend32(val32, 31); + break; + default: + ret = -EINVAL; +diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c +index cb3a8623ff54..4173fe977721 100644 +--- a/drivers/infiniband/ulp/srpt/ib_srpt.c ++++ b/drivers/infiniband/ulp/srpt/ib_srpt.c +@@ -1513,9 +1513,11 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch, + struct srpt_send_ioctx *ioctx, u64 tag, + int status) + { ++ struct se_cmd *cmd = &ioctx->cmd; + struct srp_rsp *srp_rsp; + const u8 *sense_data; + int sense_data_len, max_sense_len; ++ u32 resid = cmd->residual_count; + + /* + * The lowest bit of all SAM-3 status codes is zero (see also +@@ -1537,6 +1539,28 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch, + srp_rsp->tag = tag; + srp_rsp->status = status; + ++ if (cmd->se_cmd_flags & SCF_UNDERFLOW_BIT) { ++ if (cmd->data_direction == DMA_TO_DEVICE) { ++ /* residual data from an underflow write */ ++ srp_rsp->flags = SRP_RSP_FLAG_DOUNDER; ++ srp_rsp->data_out_res_cnt = cpu_to_be32(resid); ++ } else if (cmd->data_direction == DMA_FROM_DEVICE) { ++ /* residual data from an underflow read */ ++ srp_rsp->flags = SRP_RSP_FLAG_DIUNDER; ++ srp_rsp->data_in_res_cnt = cpu_to_be32(resid); ++ } ++ } else if (cmd->se_cmd_flags & SCF_OVERFLOW_BIT) { ++ if (cmd->data_direction == DMA_TO_DEVICE) { ++ /* residual data from an overflow write */ ++ srp_rsp->flags = SRP_RSP_FLAG_DOOVER; ++ srp_rsp->data_out_res_cnt = cpu_to_be32(resid); ++ } else if (cmd->data_direction == DMA_FROM_DEVICE) { ++ /* residual data from an overflow read */ ++ srp_rsp->flags = SRP_RSP_FLAG_DIOVER; ++ srp_rsp->data_in_res_cnt = cpu_to_be32(resid); ++ } ++ } ++ + if (sense_data_len) { + BUILD_BUG_ON(MIN_MAX_RSP_SIZE <= sizeof(*srp_rsp)); + max_sense_len = ch->max_ti_iu_len - sizeof(*srp_rsp); +diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c +index a070fa39521a..5d5066cf3bbd 100644 +--- a/drivers/iommu/iommu.c ++++ b/drivers/iommu/iommu.c +@@ -447,6 +447,7 @@ err_put_group: + mutex_unlock(&group->mutex); + dev->iommu_group = NULL; + kobject_put(group->devices_kobj); ++ sysfs_remove_link(group->devices_kobj, device->name); + err_free_name: + kfree(device->name); + err_remove_link: +diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c +index 4d3909393f2c..5c793ac11108 100644 +--- a/drivers/md/dm-snap-persistent.c ++++ b/drivers/md/dm-snap-persistent.c +@@ -17,7 +17,7 @@ + #include "dm-bufio.h" + + #define DM_MSG_PREFIX "persistent snapshot" +-#define DM_CHUNK_SIZE_DEFAULT_SECTORS 32 /* 16KB */ ++#define DM_CHUNK_SIZE_DEFAULT_SECTORS 32U /* 16KB */ + + #define DM_PREFETCH_CHUNKS 12 + +diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c +index f8e5db0cb5aa..62a4fca62776 100644 +--- a/drivers/md/raid0.c ++++ b/drivers/md/raid0.c +@@ -83,7 +83,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) + char b[BDEVNAME_SIZE]; + char b2[BDEVNAME_SIZE]; + struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL); +- unsigned short blksize = 512; ++ unsigned blksize = 512; + + if (!conf) + return -ENOMEM; +diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c +index 667d3720154a..4b7803cec37f 100644 +--- a/drivers/media/platform/exynos4-is/fimc-isp-video.c ++++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c +@@ -323,7 +323,7 @@ static int isp_video_release(struct file *file) + ivc->streaming = 0; + } + +- vb2_fop_release(file); ++ _vb2_fop_release(file, NULL); + + if (v4l2_fh_is_singular_file(file)) { + fimc_pipeline_call(&ivc->ve, close); +diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c +index fd6a3b36208e..2d56cccaa474 100644 +--- a/drivers/media/usb/zr364xx/zr364xx.c ++++ b/drivers/media/usb/zr364xx/zr364xx.c +@@ -711,7 +711,8 @@ static int zr364xx_vidioc_querycap(struct file *file, void *priv, + struct zr364xx_camera *cam = video_drvdata(file); + + strlcpy(cap->driver, DRIVER_DESC, sizeof(cap->driver)); +- strlcpy(cap->card, cam->udev->product, sizeof(cap->card)); ++ if (cam->udev->product) ++ strlcpy(cap->card, cam->udev->product, sizeof(cap->card)); + strlcpy(cap->bus_info, dev_name(&cam->udev->dev), + sizeof(cap->bus_info)); + cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | +diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c +index 14cf6dfc3b14..4d837bcad5db 100644 +--- a/drivers/message/fusion/mptctl.c ++++ b/drivers/message/fusion/mptctl.c +@@ -100,19 +100,19 @@ struct buflist { + * Function prototypes. Called from OS entry point mptctl_ioctl. + * arg contents specific to function. + */ +-static int mptctl_fw_download(unsigned long arg); +-static int mptctl_getiocinfo(unsigned long arg, unsigned int cmd); +-static int mptctl_gettargetinfo(unsigned long arg); +-static int mptctl_readtest(unsigned long arg); +-static int mptctl_mpt_command(unsigned long arg); +-static int mptctl_eventquery(unsigned long arg); +-static int mptctl_eventenable(unsigned long arg); +-static int mptctl_eventreport(unsigned long arg); +-static int mptctl_replace_fw(unsigned long arg); +- +-static int mptctl_do_reset(unsigned long arg); +-static int mptctl_hp_hostinfo(unsigned long arg, unsigned int cmd); +-static int mptctl_hp_targetinfo(unsigned long arg); ++static int mptctl_fw_download(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_getiocinfo(MPT_ADAPTER *iocp, unsigned long arg, unsigned int cmd); ++static int mptctl_gettargetinfo(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_readtest(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_mpt_command(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_eventquery(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_eventenable(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_eventreport(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_replace_fw(MPT_ADAPTER *iocp, unsigned long arg); ++ ++static int mptctl_do_reset(MPT_ADAPTER *iocp, unsigned long arg); ++static int mptctl_hp_hostinfo(MPT_ADAPTER *iocp, unsigned long arg, unsigned int cmd); ++static int mptctl_hp_targetinfo(MPT_ADAPTER *iocp, unsigned long arg); + + static int mptctl_probe(struct pci_dev *, const struct pci_device_id *); + static void mptctl_remove(struct pci_dev *); +@@ -123,8 +123,8 @@ static long compat_mpctl_ioctl(struct file *f, unsigned cmd, unsigned long arg); + /* + * Private function calls. + */ +-static int mptctl_do_mpt_command(struct mpt_ioctl_command karg, void __user *mfPtr); +-static int mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen); ++static int mptctl_do_mpt_command(MPT_ADAPTER *iocp, struct mpt_ioctl_command karg, void __user *mfPtr); ++static int mptctl_do_fw_download(MPT_ADAPTER *iocp, char __user *ufwbuf, size_t fwlen); + static MptSge_t *kbuf_alloc_2_sgl(int bytes, u32 dir, int sge_offset, int *frags, + struct buflist **blp, dma_addr_t *sglbuf_dma, MPT_ADAPTER *ioc); + static void kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, +@@ -656,19 +656,19 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + * by TM and FW reloads. + */ + if ((cmd & ~IOCSIZE_MASK) == (MPTIOCINFO & ~IOCSIZE_MASK)) { +- return mptctl_getiocinfo(arg, _IOC_SIZE(cmd)); ++ return mptctl_getiocinfo(iocp, arg, _IOC_SIZE(cmd)); + } else if (cmd == MPTTARGETINFO) { +- return mptctl_gettargetinfo(arg); ++ return mptctl_gettargetinfo(iocp, arg); + } else if (cmd == MPTTEST) { +- return mptctl_readtest(arg); ++ return mptctl_readtest(iocp, arg); + } else if (cmd == MPTEVENTQUERY) { +- return mptctl_eventquery(arg); ++ return mptctl_eventquery(iocp, arg); + } else if (cmd == MPTEVENTENABLE) { +- return mptctl_eventenable(arg); ++ return mptctl_eventenable(iocp, arg); + } else if (cmd == MPTEVENTREPORT) { +- return mptctl_eventreport(arg); ++ return mptctl_eventreport(iocp, arg); + } else if (cmd == MPTFWREPLACE) { +- return mptctl_replace_fw(arg); ++ return mptctl_replace_fw(iocp, arg); + } + + /* All of these commands require an interrupt or +@@ -678,15 +678,15 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + return ret; + + if (cmd == MPTFWDOWNLOAD) +- ret = mptctl_fw_download(arg); ++ ret = mptctl_fw_download(iocp, arg); + else if (cmd == MPTCOMMAND) +- ret = mptctl_mpt_command(arg); ++ ret = mptctl_mpt_command(iocp, arg); + else if (cmd == MPTHARDRESET) +- ret = mptctl_do_reset(arg); ++ ret = mptctl_do_reset(iocp, arg); + else if ((cmd & ~IOCSIZE_MASK) == (HP_GETHOSTINFO & ~IOCSIZE_MASK)) +- ret = mptctl_hp_hostinfo(arg, _IOC_SIZE(cmd)); ++ ret = mptctl_hp_hostinfo(iocp, arg, _IOC_SIZE(cmd)); + else if (cmd == HP_GETTARGETINFO) +- ret = mptctl_hp_targetinfo(arg); ++ ret = mptctl_hp_targetinfo(iocp, arg); + else + ret = -EINVAL; + +@@ -705,11 +705,10 @@ mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + return ret; + } + +-static int mptctl_do_reset(unsigned long arg) ++static int mptctl_do_reset(MPT_ADAPTER *iocp, unsigned long arg) + { + struct mpt_ioctl_diag_reset __user *urinfo = (void __user *) arg; + struct mpt_ioctl_diag_reset krinfo; +- MPT_ADAPTER *iocp; + + if (copy_from_user(&krinfo, urinfo, sizeof(struct mpt_ioctl_diag_reset))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_do_reset - " +@@ -718,12 +717,6 @@ static int mptctl_do_reset(unsigned long arg) + return -EFAULT; + } + +- if (mpt_verify_adapter(krinfo.hdr.iocnum, &iocp) < 0) { +- printk(KERN_DEBUG MYNAM "%s@%d::mptctl_do_reset - ioc%d not found!\n", +- __FILE__, __LINE__, krinfo.hdr.iocnum); +- return -ENODEV; /* (-6) No such device or address */ +- } +- + dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "mptctl_do_reset called.\n", + iocp->name)); + +@@ -754,7 +747,7 @@ static int mptctl_do_reset(unsigned long arg) + * -ENOMSG if FW upload returned bad status + */ + static int +-mptctl_fw_download(unsigned long arg) ++mptctl_fw_download(MPT_ADAPTER *iocp, unsigned long arg) + { + struct mpt_fw_xfer __user *ufwdl = (void __user *) arg; + struct mpt_fw_xfer kfwdl; +@@ -766,7 +759,7 @@ mptctl_fw_download(unsigned long arg) + return -EFAULT; + } + +- return mptctl_do_fw_download(kfwdl.iocnum, kfwdl.bufp, kfwdl.fwlen); ++ return mptctl_do_fw_download(iocp, kfwdl.bufp, kfwdl.fwlen); + } + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ +@@ -784,11 +777,10 @@ mptctl_fw_download(unsigned long arg) + * -ENOMSG if FW upload returned bad status + */ + static int +-mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) ++mptctl_do_fw_download(MPT_ADAPTER *iocp, char __user *ufwbuf, size_t fwlen) + { + FWDownload_t *dlmsg; + MPT_FRAME_HDR *mf; +- MPT_ADAPTER *iocp; + FWDownloadTCSGE_t *ptsge; + MptSge_t *sgl, *sgIn; + char *sgOut; +@@ -808,17 +800,10 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) + pFWDownloadReply_t ReplyMsg = NULL; + unsigned long timeleft; + +- if (mpt_verify_adapter(ioc, &iocp) < 0) { +- printk(KERN_DEBUG MYNAM "ioctl_fwdl - ioc%d not found!\n", +- ioc); +- return -ENODEV; /* (-6) No such device or address */ +- } else { +- +- /* Valid device. Get a message frame and construct the FW download message. +- */ +- if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL) +- return -EAGAIN; +- } ++ /* Valid device. Get a message frame and construct the FW download message. ++ */ ++ if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL) ++ return -EAGAIN; + + dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT + "mptctl_do_fwdl called. mptctl_id = %xh.\n", iocp->name, mptctl_id)); +@@ -826,8 +811,6 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) + iocp->name, ufwbuf)); + dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.fwlen = %d\n", + iocp->name, (int)fwlen)); +- dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.ioc = %04xh\n", +- iocp->name, ioc)); + + dlmsg = (FWDownload_t*) mf; + ptsge = (FWDownloadTCSGE_t *) &dlmsg->SGL; +@@ -1238,13 +1221,11 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE + * -ENODEV if no such device/adapter + */ + static int +-mptctl_getiocinfo (unsigned long arg, unsigned int data_size) ++mptctl_getiocinfo (MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size) + { + struct mpt_ioctl_iocinfo __user *uarg = (void __user *) arg; + struct mpt_ioctl_iocinfo *karg; +- MPT_ADAPTER *ioc; + struct pci_dev *pdev; +- int iocnum; + unsigned int port; + int cim_rev; + struct scsi_device *sdev; +@@ -1272,14 +1253,6 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) + return PTR_ERR(karg); + } + +- if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- kfree(karg); +- return -ENODEV; +- } +- + /* Verify the data transfer size is correct. */ + if (karg->hdr.maxDataSize != data_size) { + printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_getiocinfo - " +@@ -1385,15 +1358,13 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) + * -ENODEV if no such device/adapter + */ + static int +-mptctl_gettargetinfo (unsigned long arg) ++mptctl_gettargetinfo (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_targetinfo __user *uarg = (void __user *) arg; + struct mpt_ioctl_targetinfo karg; +- MPT_ADAPTER *ioc; + VirtDevice *vdevice; + char *pmem; + int *pdata; +- int iocnum; + int numDevices = 0; + int lun; + int maxWordsLeft; +@@ -1408,13 +1379,6 @@ mptctl_gettargetinfo (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_gettargetinfo called.\n", + ioc->name)); + /* Get the port number and set the maximum number of bytes +@@ -1510,12 +1474,10 @@ mptctl_gettargetinfo (unsigned long arg) + * -ENODEV if no such device/adapter + */ + static int +-mptctl_readtest (unsigned long arg) ++mptctl_readtest (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_test __user *uarg = (void __user *) arg; + struct mpt_ioctl_test karg; +- MPT_ADAPTER *ioc; +- int iocnum; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_readtest - " +@@ -1524,13 +1486,6 @@ mptctl_readtest (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_readtest() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_readtest called.\n", + ioc->name)); + /* Fill in the data and return the structure to the calling +@@ -1571,12 +1526,10 @@ mptctl_readtest (unsigned long arg) + * -ENODEV if no such device/adapter + */ + static int +-mptctl_eventquery (unsigned long arg) ++mptctl_eventquery (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_eventquery __user *uarg = (void __user *) arg; + struct mpt_ioctl_eventquery karg; +- MPT_ADAPTER *ioc; +- int iocnum; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventquery))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_eventquery - " +@@ -1585,13 +1538,6 @@ mptctl_eventquery (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_eventquery() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventquery called.\n", + ioc->name)); + karg.eventEntries = MPTCTL_EVENT_LOG_SIZE; +@@ -1610,12 +1556,10 @@ mptctl_eventquery (unsigned long arg) + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ + static int +-mptctl_eventenable (unsigned long arg) ++mptctl_eventenable (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_eventenable __user *uarg = (void __user *) arg; + struct mpt_ioctl_eventenable karg; +- MPT_ADAPTER *ioc; +- int iocnum; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) { + printk(KERN_ERR MYNAM "%s@%d::mptctl_eventenable - " +@@ -1624,13 +1568,6 @@ mptctl_eventenable (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_eventenable() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventenable called.\n", + ioc->name)); + if (ioc->events == NULL) { +@@ -1658,12 +1595,10 @@ mptctl_eventenable (unsigned long arg) + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ + static int +-mptctl_eventreport (unsigned long arg) ++mptctl_eventreport (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_eventreport __user *uarg = (void __user *) arg; + struct mpt_ioctl_eventreport karg; +- MPT_ADAPTER *ioc; +- int iocnum; + int numBytes, maxEvents, max; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventreport))) { +@@ -1673,12 +1608,6 @@ mptctl_eventreport (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_eventreport() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventreport called.\n", + ioc->name)); + +@@ -1712,12 +1641,10 @@ mptctl_eventreport (unsigned long arg) + + /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ + static int +-mptctl_replace_fw (unsigned long arg) ++mptctl_replace_fw (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_replace_fw __user *uarg = (void __user *) arg; + struct mpt_ioctl_replace_fw karg; +- MPT_ADAPTER *ioc; +- int iocnum; + int newFwSize; + + if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) { +@@ -1727,13 +1654,6 @@ mptctl_replace_fw (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_replace_fw() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_replace_fw called.\n", + ioc->name)); + /* If caching FW, Free the old FW image +@@ -1780,12 +1700,10 @@ mptctl_replace_fw (unsigned long arg) + * -ENOMEM if memory allocation error + */ + static int +-mptctl_mpt_command (unsigned long arg) ++mptctl_mpt_command (MPT_ADAPTER *ioc, unsigned long arg) + { + struct mpt_ioctl_command __user *uarg = (void __user *) arg; + struct mpt_ioctl_command karg; +- MPT_ADAPTER *ioc; +- int iocnum; + int rc; + + +@@ -1796,14 +1714,7 @@ mptctl_mpt_command (unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_mpt_command() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- +- rc = mptctl_do_mpt_command (karg, &uarg->MF); ++ rc = mptctl_do_mpt_command (ioc, karg, &uarg->MF); + + return rc; + } +@@ -1821,9 +1732,8 @@ mptctl_mpt_command (unsigned long arg) + * -EPERM if SCSI I/O and target is untagged + */ + static int +-mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) ++mptctl_do_mpt_command (MPT_ADAPTER *ioc, struct mpt_ioctl_command karg, void __user *mfPtr) + { +- MPT_ADAPTER *ioc; + MPT_FRAME_HDR *mf = NULL; + MPIHeader_t *hdr; + char *psge; +@@ -1832,7 +1742,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) + dma_addr_t dma_addr_in; + dma_addr_t dma_addr_out; + int sgSize = 0; /* Num SG elements */ +- int iocnum, flagsLength; ++ int flagsLength; + int sz, rc = 0; + int msgContext; + u16 req_idx; +@@ -1847,13 +1757,6 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) + bufIn.kptr = bufOut.kptr = NULL; + bufIn.len = bufOut.len = 0; + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } +- + spin_lock_irqsave(&ioc->taskmgmt_lock, flags); + if (ioc->ioc_reset_in_progress) { + spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags); +@@ -2418,17 +2321,15 @@ done_free_mem: + * -ENOMEM if memory allocation error + */ + static int +-mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) ++mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size) + { + hp_host_info_t __user *uarg = (void __user *) arg; +- MPT_ADAPTER *ioc; + struct pci_dev *pdev; + char *pbuf=NULL; + dma_addr_t buf_dma; + hp_host_info_t karg; + CONFIGPARMS cfg; + ConfigPageHeader_t hdr; +- int iocnum; + int rc, cim_rev; + ToolboxIstwiReadWriteRequest_t *IstwiRWRequest; + MPT_FRAME_HDR *mf = NULL; +@@ -2452,12 +2353,6 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": mptctl_hp_hostinfo called.\n", + ioc->name)); + +@@ -2670,15 +2565,13 @@ retry_wait: + * -ENOMEM if memory allocation error + */ + static int +-mptctl_hp_targetinfo(unsigned long arg) ++mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg) + { + hp_target_info_t __user *uarg = (void __user *) arg; + SCSIDevicePage0_t *pg0_alloc; + SCSIDevicePage3_t *pg3_alloc; +- MPT_ADAPTER *ioc; + MPT_SCSI_HOST *hd = NULL; + hp_target_info_t karg; +- int iocnum; + int data_sz; + dma_addr_t page_dma; + CONFIGPARMS cfg; +@@ -2692,12 +2585,6 @@ mptctl_hp_targetinfo(unsigned long arg) + return -EFAULT; + } + +- if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || +- (ioc == NULL)) { +- printk(KERN_DEBUG MYNAM "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n", +- __FILE__, __LINE__, iocnum); +- return -ENODEV; +- } + if (karg.hdr.id >= MPT_MAX_FC_DEVICES) + return -EINVAL; + dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_hp_targetinfo called.\n", +@@ -2865,7 +2752,7 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd, + kfw.fwlen = kfw32.fwlen; + kfw.bufp = compat_ptr(kfw32.bufp); + +- ret = mptctl_do_fw_download(kfw.iocnum, kfw.bufp, kfw.fwlen); ++ ret = mptctl_do_fw_download(iocp, kfw.bufp, kfw.fwlen); + + mutex_unlock(&iocp->ioctl_cmds.mutex); + +@@ -2919,7 +2806,7 @@ compat_mpt_command(struct file *filp, unsigned int cmd, + + /* Pass new structure to do_mpt_command + */ +- ret = mptctl_do_mpt_command (karg, &uarg->MF); ++ ret = mptctl_do_mpt_command (iocp, karg, &uarg->MF); + + mutex_unlock(&iocp->ioctl_cmds.mutex); + +diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c +index eb29113e0bac..b11737f7bdca 100644 +--- a/drivers/misc/enclosure.c ++++ b/drivers/misc/enclosure.c +@@ -419,10 +419,9 @@ int enclosure_remove_device(struct enclosure_device *edev, struct device *dev) + cdev = &edev->component[i]; + if (cdev->dev == dev) { + enclosure_remove_links(cdev); +- device_del(&cdev->cdev); + put_device(dev); + cdev->dev = NULL; +- return device_add(&cdev->cdev); ++ return 0; + } + } + return -ENODEV; +diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h +index 803df6a32ba9..a942d2d84ed2 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/common.h ++++ b/drivers/net/ethernet/stmicro/stmmac/common.h +@@ -273,8 +273,8 @@ struct dma_features { + unsigned int enh_desc; + }; + +-/* GMAC TX FIFO is 8K, Rx FIFO is 16K */ +-#define BUF_SIZE_16KiB 16384 ++/* RX Buffer size must be multiple of 4/8/16 bytes */ ++#define BUF_SIZE_16KiB 16368 + #define BUF_SIZE_8KiB 8192 + #define BUF_SIZE_4KiB 4096 + #define BUF_SIZE_2KiB 2048 +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +index 28a6b7764044..6f695239e658 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -935,7 +935,9 @@ static int stmmac_set_bfsize(int mtu, int bufsize) + { + int ret = bufsize; + +- if (mtu >= BUF_SIZE_4KiB) ++ if (mtu >= BUF_SIZE_8KiB) ++ ret = BUF_SIZE_16KiB; ++ else if (mtu >= BUF_SIZE_4KiB) + ret = BUF_SIZE_8KiB; + else if (mtu >= BUF_SIZE_2KiB) + ret = BUF_SIZE_4KiB; +diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c +index eb825ea52d6b..bd49303f7db2 100644 +--- a/drivers/net/macvlan.c ++++ b/drivers/net/macvlan.c +@@ -233,7 +233,7 @@ static void macvlan_broadcast(struct sk_buff *skb, + struct net_device *src, + enum macvlan_mode mode) + { +- const struct ethhdr *eth = skb_eth_hdr(skb); ++ const struct ethhdr *eth = eth_hdr(skb); + const struct macvlan_dev *vlan; + struct sk_buff *nskb; + unsigned int i; +@@ -476,10 +476,11 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev) + const struct macvlan_dev *dest; + + if (vlan->mode == MACVLAN_MODE_BRIDGE) { +- const struct ethhdr *eth = (void *)skb->data; ++ const struct ethhdr *eth = skb_eth_hdr(skb); + + /* send to other bridge ports directly */ + if (is_multicast_ether_addr(eth->h_dest)) { ++ skb_reset_mac_header(skb); + macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE); + goto xmit_world; + } +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c +index 0d138bc60b18..4174b24963b9 100644 +--- a/drivers/net/usb/lan78xx.c ++++ b/drivers/net/usb/lan78xx.c +@@ -2961,6 +2961,7 @@ static int lan78xx_probe(struct usb_interface *intf, + + if (netdev->mtu > (dev->hard_mtu - netdev->hard_header_len)) + netdev->mtu = dev->hard_mtu - netdev->hard_header_len; ++ netif_set_gso_max_size(netdev, MAX_SINGLE_PACKET_SIZE - MAX_HEADER); + + dev->ep_blkin = (intf->cur_altsetting)->endpoint + 0; + dev->ep_blkout = (intf->cur_altsetting)->endpoint + 1; +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c +index 10dd307593e8..db8b489b0513 100644 +--- a/drivers/net/usb/r8152.c ++++ b/drivers/net/usb/r8152.c +@@ -4243,6 +4243,9 @@ static int rtl8152_probe(struct usb_interface *intf, + return -ENODEV; + } + ++ if (intf->cur_altsetting->desc.bNumEndpoints < 3) ++ return -ENODEV; ++ + usb_reset_device(udev); + netdev = alloc_etherdev(sizeof(struct r8152)); + if (!netdev) { +diff --git a/drivers/net/wimax/i2400m/op-rfkill.c b/drivers/net/wimax/i2400m/op-rfkill.c +index b0dba35a8ad2..dc6fe93ce71f 100644 +--- a/drivers/net/wimax/i2400m/op-rfkill.c ++++ b/drivers/net/wimax/i2400m/op-rfkill.c +@@ -147,6 +147,7 @@ error_msg_to_dev: + error_alloc: + d_fnend(4, dev, "(wimax_dev %p state %d) = %d\n", + wimax_dev, state, result); ++ kfree(cmd); + return result; + } + +diff --git a/drivers/net/wireless/cw1200/fwio.c b/drivers/net/wireless/cw1200/fwio.c +index 30e7646d04af..16be7fa82a23 100644 +--- a/drivers/net/wireless/cw1200/fwio.c ++++ b/drivers/net/wireless/cw1200/fwio.c +@@ -323,12 +323,12 @@ int cw1200_load_firmware(struct cw1200_common *priv) + goto out; + } + +- priv->hw_type = cw1200_get_hw_type(val32, &major_revision); +- if (priv->hw_type < 0) { ++ ret = cw1200_get_hw_type(val32, &major_revision); ++ if (ret < 0) { + pr_err("Can't deduce hardware type.\n"); +- ret = -ENOTSUPP; + goto out; + } ++ priv->hw_type = ret; + + /* Set DPLL Reg value, and read back to confirm writes work */ + ret = cw1200_reg_write_32(priv, ST90TDS_TSET_GEN_R_W_REG_ID, +diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c +index 043bd1c23c19..4a197a32d78c 100644 +--- a/drivers/net/wireless/p54/p54usb.c ++++ b/drivers/net/wireless/p54/p54usb.c +@@ -33,6 +33,8 @@ MODULE_ALIAS("prism54usb"); + MODULE_FIRMWARE("isl3886usb"); + MODULE_FIRMWARE("isl3887usb"); + ++static struct usb_driver p54u_driver; ++ + /* + * Note: + * +@@ -921,9 +923,9 @@ static void p54u_load_firmware_cb(const struct firmware *firmware, + { + struct p54u_priv *priv = context; + struct usb_device *udev = priv->udev; ++ struct usb_interface *intf = priv->intf; + int err; + +- complete(&priv->fw_wait_load); + if (firmware) { + priv->fw = firmware; + err = p54u_start_ops(priv); +@@ -932,26 +934,22 @@ static void p54u_load_firmware_cb(const struct firmware *firmware, + dev_err(&udev->dev, "Firmware not found.\n"); + } + +- if (err) { +- struct device *parent = priv->udev->dev.parent; +- +- dev_err(&udev->dev, "failed to initialize device (%d)\n", err); +- +- if (parent) +- device_lock(parent); ++ complete(&priv->fw_wait_load); ++ /* ++ * At this point p54u_disconnect may have already freed ++ * the "priv" context. Do not use it anymore! ++ */ ++ priv = NULL; + +- device_release_driver(&udev->dev); +- /* +- * At this point p54u_disconnect has already freed +- * the "priv" context. Do not use it anymore! +- */ +- priv = NULL; ++ if (err) { ++ dev_err(&intf->dev, "failed to initialize device (%d)\n", err); + +- if (parent) +- device_unlock(parent); ++ usb_lock_device(udev); ++ usb_driver_release_interface(&p54u_driver, intf); ++ usb_unlock_device(udev); + } + +- usb_put_dev(udev); ++ usb_put_intf(intf); + } + + static int p54u_load_firmware(struct ieee80211_hw *dev, +@@ -972,14 +970,14 @@ static int p54u_load_firmware(struct ieee80211_hw *dev, + dev_info(&priv->udev->dev, "Loading firmware file %s\n", + p54u_fwlist[i].fw); + +- usb_get_dev(udev); ++ usb_get_intf(intf); + err = request_firmware_nowait(THIS_MODULE, 1, p54u_fwlist[i].fw, + device, GFP_KERNEL, priv, + p54u_load_firmware_cb); + if (err) { + dev_err(&priv->udev->dev, "(p54usb) cannot load firmware %s " + "(%d)!\n", p54u_fwlist[i].fw, err); +- usb_put_dev(udev); ++ usb_put_intf(intf); + } + + return err; +@@ -1011,8 +1009,6 @@ static int p54u_probe(struct usb_interface *intf, + skb_queue_head_init(&priv->rx_queue); + init_usb_anchor(&priv->submitted); + +- usb_get_dev(udev); +- + /* really lazy and simple way of figuring out if we're a 3887 */ + /* TODO: should just stick the identification in the device table */ + i = intf->altsetting->desc.bNumEndpoints; +@@ -1053,10 +1049,8 @@ static int p54u_probe(struct usb_interface *intf, + priv->upload_fw = p54u_upload_firmware_net2280; + } + err = p54u_load_firmware(dev, intf); +- if (err) { +- usb_put_dev(udev); ++ if (err) + p54_free_common(dev); +- } + return err; + } + +@@ -1072,7 +1066,6 @@ static void p54u_disconnect(struct usb_interface *intf) + wait_for_completion(&priv->fw_wait_load); + p54_unregister_common(dev); + +- usb_put_dev(interface_to_usbdev(intf)); + release_firmware(priv->fw); + p54_free_common(dev); + } +diff --git a/drivers/net/wireless/realtek/rtlwifi/regd.c b/drivers/net/wireless/realtek/rtlwifi/regd.c +index f67e7e5b13e1..005bd7abc247 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/regd.c ++++ b/drivers/net/wireless/realtek/rtlwifi/regd.c +@@ -427,7 +427,7 @@ int rtl_regd_init(struct ieee80211_hw *hw, + struct wiphy *wiphy = hw->wiphy; + struct country_code_to_enum_rd *country = NULL; + +- if (wiphy == NULL || &rtlpriv->regd == NULL) ++ if (!wiphy) + return -EINVAL; + + /* init country_code from efuse channel plan */ +diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c +index 4df992de7d07..2f40506a5821 100644 +--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c ++++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c +@@ -199,6 +199,7 @@ void rsi_mac80211_detach(struct rsi_hw *adapter) + ieee80211_stop_queues(hw); + ieee80211_unregister_hw(hw); + ieee80211_free_hw(hw); ++ adapter->hw = NULL; + } + + rsi_remove_dbgfs(adapter); +diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c +index 63b5b6838e8b..ca1d507aa532 100644 +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -452,13 +452,7 @@ static void kbd_led_update(struct work_struct *work) + + asus = container_of(work, struct asus_wmi, kbd_led_work); + +- /* +- * bits 0-2: level +- * bit 7: light on/off +- */ +- if (asus->kbd_led_wk > 0) +- ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F); +- ++ ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F); + asus_wmi_set_devstate(ASUS_WMI_DEVID_KBD_BACKLIGHT, ctrl_param, NULL); + } + +diff --git a/drivers/rtc/rtc-msm6242.c b/drivers/rtc/rtc-msm6242.c +index c1c5c4e3b3b4..c981301efbe5 100644 +--- a/drivers/rtc/rtc-msm6242.c ++++ b/drivers/rtc/rtc-msm6242.c +@@ -132,7 +132,8 @@ static int msm6242_read_time(struct device *dev, struct rtc_time *tm) + msm6242_read(priv, MSM6242_SECOND1); + tm->tm_min = msm6242_read(priv, MSM6242_MINUTE10) * 10 + + msm6242_read(priv, MSM6242_MINUTE1); +- tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10 & 3)) * 10 + ++ tm->tm_hour = (msm6242_read(priv, MSM6242_HOUR10) & ++ MSM6242_HOUR10_HR_MASK) * 10 + + msm6242_read(priv, MSM6242_HOUR1); + tm->tm_mday = msm6242_read(priv, MSM6242_DAY10) * 10 + + msm6242_read(priv, MSM6242_DAY1); +diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c +index 06a5c52b292f..74740ed3a7c3 100644 +--- a/drivers/rtc/rtc-mt6397.c ++++ b/drivers/rtc/rtc-mt6397.c +@@ -55,6 +55,14 @@ + + #define RTC_AL_SEC 0x0018 + ++#define RTC_AL_SEC_MASK 0x003f ++#define RTC_AL_MIN_MASK 0x003f ++#define RTC_AL_HOU_MASK 0x001f ++#define RTC_AL_DOM_MASK 0x001f ++#define RTC_AL_DOW_MASK 0x0007 ++#define RTC_AL_MTH_MASK 0x000f ++#define RTC_AL_YEA_MASK 0x007f ++ + #define RTC_PDN2 0x002e + #define RTC_PDN2_PWRON_ALARM BIT(4) + +@@ -111,7 +119,7 @@ static irqreturn_t mtk_rtc_irq_handler_thread(int irq, void *data) + irqen = irqsta & ~RTC_IRQ_EN_AL; + mutex_lock(&rtc->lock); + if (regmap_write(rtc->regmap, rtc->addr_base + RTC_IRQ_EN, +- irqen) < 0) ++ irqen) == 0) + mtk_rtc_write_trigger(rtc); + mutex_unlock(&rtc->lock); + +@@ -233,12 +241,12 @@ static int mtk_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) + alm->pending = !!(pdn2 & RTC_PDN2_PWRON_ALARM); + mutex_unlock(&rtc->lock); + +- tm->tm_sec = data[RTC_OFFSET_SEC]; +- tm->tm_min = data[RTC_OFFSET_MIN]; +- tm->tm_hour = data[RTC_OFFSET_HOUR]; +- tm->tm_mday = data[RTC_OFFSET_DOM]; +- tm->tm_mon = data[RTC_OFFSET_MTH]; +- tm->tm_year = data[RTC_OFFSET_YEAR]; ++ tm->tm_sec = data[RTC_OFFSET_SEC] & RTC_AL_SEC_MASK; ++ tm->tm_min = data[RTC_OFFSET_MIN] & RTC_AL_MIN_MASK; ++ tm->tm_hour = data[RTC_OFFSET_HOUR] & RTC_AL_HOU_MASK; ++ tm->tm_mday = data[RTC_OFFSET_DOM] & RTC_AL_DOM_MASK; ++ tm->tm_mon = data[RTC_OFFSET_MTH] & RTC_AL_MTH_MASK; ++ tm->tm_year = data[RTC_OFFSET_YEAR] & RTC_AL_YEA_MASK; + + tm->tm_year += RTC_MIN_YEAR_OFFSET; + tm->tm_mon--; +@@ -259,14 +267,25 @@ static int mtk_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) + tm->tm_year -= RTC_MIN_YEAR_OFFSET; + tm->tm_mon++; + +- data[RTC_OFFSET_SEC] = tm->tm_sec; +- data[RTC_OFFSET_MIN] = tm->tm_min; +- data[RTC_OFFSET_HOUR] = tm->tm_hour; +- data[RTC_OFFSET_DOM] = tm->tm_mday; +- data[RTC_OFFSET_MTH] = tm->tm_mon; +- data[RTC_OFFSET_YEAR] = tm->tm_year; +- + mutex_lock(&rtc->lock); ++ ret = regmap_bulk_read(rtc->regmap, rtc->addr_base + RTC_AL_SEC, ++ data, RTC_OFFSET_COUNT); ++ if (ret < 0) ++ goto exit; ++ ++ data[RTC_OFFSET_SEC] = ((data[RTC_OFFSET_SEC] & ~(RTC_AL_SEC_MASK)) | ++ (tm->tm_sec & RTC_AL_SEC_MASK)); ++ data[RTC_OFFSET_MIN] = ((data[RTC_OFFSET_MIN] & ~(RTC_AL_MIN_MASK)) | ++ (tm->tm_min & RTC_AL_MIN_MASK)); ++ data[RTC_OFFSET_HOUR] = ((data[RTC_OFFSET_HOUR] & ~(RTC_AL_HOU_MASK)) | ++ (tm->tm_hour & RTC_AL_HOU_MASK)); ++ data[RTC_OFFSET_DOM] = ((data[RTC_OFFSET_DOM] & ~(RTC_AL_DOM_MASK)) | ++ (tm->tm_mday & RTC_AL_DOM_MASK)); ++ data[RTC_OFFSET_MTH] = ((data[RTC_OFFSET_MTH] & ~(RTC_AL_MTH_MASK)) | ++ (tm->tm_mon & RTC_AL_MTH_MASK)); ++ data[RTC_OFFSET_YEAR] = ((data[RTC_OFFSET_YEAR] & ~(RTC_AL_YEA_MASK)) | ++ (tm->tm_year & RTC_AL_YEA_MASK)); ++ + if (alm->enabled) { + ret = regmap_bulk_write(rtc->regmap, + rtc->addr_base + RTC_AL_SEC, +diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c +index 72894378ffcf..81de52943b01 100644 +--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c ++++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c +@@ -915,12 +915,12 @@ void bnx2i_free_hba(struct bnx2i_hba *hba) + INIT_LIST_HEAD(&hba->ep_ofld_list); + INIT_LIST_HEAD(&hba->ep_active_list); + INIT_LIST_HEAD(&hba->ep_destroy_list); +- pci_dev_put(hba->pcidev); + + if (hba->regview) { + pci_iounmap(hba->pcidev, hba->regview); + hba->regview = NULL; + } ++ pci_dev_put(hba->pcidev); + bnx2i_free_mp_bdt(hba); + bnx2i_release_free_cid_que(hba); + iscsi_host_free(shost); +diff --git a/drivers/scsi/esas2r/esas2r_flash.c b/drivers/scsi/esas2r/esas2r_flash.c +index 7bd376d95ed5..b02ac389e6c6 100644 +--- a/drivers/scsi/esas2r/esas2r_flash.c ++++ b/drivers/scsi/esas2r/esas2r_flash.c +@@ -1197,6 +1197,7 @@ bool esas2r_nvram_read_direct(struct esas2r_adapter *a) + if (!esas2r_read_flash_block(a, a->nvram, FLS_OFFSET_NVR, + sizeof(struct esas2r_sas_nvram))) { + esas2r_hdebug("NVRAM read failed, using defaults"); ++ up(&a->nvram_semaphore); + return false; + } + +diff --git a/drivers/scsi/fnic/vnic_dev.c b/drivers/scsi/fnic/vnic_dev.c +index 9795d6f3e197..c5b89a003d2a 100644 +--- a/drivers/scsi/fnic/vnic_dev.c ++++ b/drivers/scsi/fnic/vnic_dev.c +@@ -445,26 +445,26 @@ int vnic_dev_soft_reset_done(struct vnic_dev *vdev, int *done) + + int vnic_dev_hang_notify(struct vnic_dev *vdev) + { +- u64 a0, a1; ++ u64 a0 = 0, a1 = 0; + int wait = 1000; + return vnic_dev_cmd(vdev, CMD_HANG_NOTIFY, &a0, &a1, wait); + } + + int vnic_dev_mac_addr(struct vnic_dev *vdev, u8 *mac_addr) + { +- u64 a0, a1; ++ u64 a[2] = {}; + int wait = 1000; + int err, i; + + for (i = 0; i < ETH_ALEN; i++) + mac_addr[i] = 0; + +- err = vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a0, &a1, wait); ++ err = vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a[0], &a[1], wait); + if (err) + return err; + + for (i = 0; i < ETH_ALEN; i++) +- mac_addr[i] = ((u8 *)&a0)[i]; ++ mac_addr[i] = ((u8 *)&a)[i]; + + return 0; + } +@@ -489,38 +489,32 @@ void vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast, + + void vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr) + { +- u64 a0 = 0, a1 = 0; ++ u64 a[2] = {}; + int wait = 1000; + int err; + int i; + + for (i = 0; i < ETH_ALEN; i++) +- ((u8 *)&a0)[i] = addr[i]; ++ ((u8 *)&a)[i] = addr[i]; + +- err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait); ++ err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a[0], &a[1], wait); + if (err) +- printk(KERN_ERR +- "Can't add addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n", +- addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], +- err); ++ pr_err("Can't add addr [%pM], %d\n", addr, err); + } + + void vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr) + { +- u64 a0 = 0, a1 = 0; ++ u64 a[2] = {}; + int wait = 1000; + int err; + int i; + + for (i = 0; i < ETH_ALEN; i++) +- ((u8 *)&a0)[i] = addr[i]; ++ ((u8 *)&a)[i] = addr[i]; + +- err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait); ++ err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a[0], &a[1], wait); + if (err) +- printk(KERN_ERR +- "Can't del addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n", +- addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], +- err); ++ pr_err("Can't del addr [%pM], %d\n", addr, err); + } + + int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr) +diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c +index c291fdff1b33..ea3b77ba12a2 100644 +--- a/drivers/scsi/qla4xxx/ql4_mbx.c ++++ b/drivers/scsi/qla4xxx/ql4_mbx.c +@@ -641,9 +641,6 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha) + + if (qla4xxx_get_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma) != + QLA_SUCCESS) { +- dma_free_coherent(&ha->pdev->dev, +- sizeof(struct addr_ctrl_blk), +- init_fw_cb, init_fw_cb_dma); + goto exit_init_fw_cb; + } + +diff --git a/drivers/scsi/scsi_trace.c b/drivers/scsi/scsi_trace.c +index 551fd0329bca..33700ce7d499 100644 +--- a/drivers/scsi/scsi_trace.c ++++ b/drivers/scsi/scsi_trace.c +@@ -17,10 +17,11 @@ + */ + #include + #include ++#include + #include + + #define SERVICE_ACTION16(cdb) (cdb[1] & 0x1f) +-#define SERVICE_ACTION32(cdb) ((cdb[8] << 8) | cdb[9]) ++#define SERVICE_ACTION32(cdb) (get_unaligned_be16(&cdb[8])) + + static const char * + scsi_trace_misc(struct trace_seq *, unsigned char *, int); +@@ -50,17 +51,12 @@ static const char * + scsi_trace_rw10(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- sector_t lba = 0, txlen = 0; ++ u32 lba, txlen; + +- lba |= (cdb[2] << 24); +- lba |= (cdb[3] << 16); +- lba |= (cdb[4] << 8); +- lba |= cdb[5]; +- txlen |= (cdb[7] << 8); +- txlen |= cdb[8]; ++ lba = get_unaligned_be32(&cdb[2]); ++ txlen = get_unaligned_be16(&cdb[7]); + +- trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u", +- (unsigned long long)lba, (unsigned long long)txlen, ++ trace_seq_printf(p, "lba=%u txlen=%u protect=%u", lba, txlen, + cdb[1] >> 5); + + if (cdb[0] == WRITE_SAME) +@@ -75,19 +71,12 @@ static const char * + scsi_trace_rw12(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- sector_t lba = 0, txlen = 0; +- +- lba |= (cdb[2] << 24); +- lba |= (cdb[3] << 16); +- lba |= (cdb[4] << 8); +- lba |= cdb[5]; +- txlen |= (cdb[6] << 24); +- txlen |= (cdb[7] << 16); +- txlen |= (cdb[8] << 8); +- txlen |= cdb[9]; +- +- trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u", +- (unsigned long long)lba, (unsigned long long)txlen, ++ u32 lba, txlen; ++ ++ lba = get_unaligned_be32(&cdb[2]); ++ txlen = get_unaligned_be32(&cdb[6]); ++ ++ trace_seq_printf(p, "lba=%u txlen=%u protect=%u", lba, txlen, + cdb[1] >> 5); + trace_seq_putc(p, 0); + +@@ -98,23 +87,13 @@ static const char * + scsi_trace_rw16(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- sector_t lba = 0, txlen = 0; +- +- lba |= ((u64)cdb[2] << 56); +- lba |= ((u64)cdb[3] << 48); +- lba |= ((u64)cdb[4] << 40); +- lba |= ((u64)cdb[5] << 32); +- lba |= (cdb[6] << 24); +- lba |= (cdb[7] << 16); +- lba |= (cdb[8] << 8); +- lba |= cdb[9]; +- txlen |= (cdb[10] << 24); +- txlen |= (cdb[11] << 16); +- txlen |= (cdb[12] << 8); +- txlen |= cdb[13]; +- +- trace_seq_printf(p, "lba=%llu txlen=%llu protect=%u", +- (unsigned long long)lba, (unsigned long long)txlen, ++ u64 lba; ++ u32 txlen; ++ ++ lba = get_unaligned_be64(&cdb[2]); ++ txlen = get_unaligned_be32(&cdb[10]); ++ ++ trace_seq_printf(p, "lba=%llu txlen=%u protect=%u", lba, txlen, + cdb[1] >> 5); + + if (cdb[0] == WRITE_SAME_16) +@@ -129,8 +108,8 @@ static const char * + scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p), *cmd; +- sector_t lba = 0, txlen = 0; +- u32 ei_lbrt = 0; ++ u64 lba; ++ u32 ei_lbrt, txlen; + + switch (SERVICE_ACTION32(cdb)) { + case READ_32: +@@ -150,26 +129,12 @@ scsi_trace_rw32(struct trace_seq *p, unsigned char *cdb, int len) + goto out; + } + +- lba |= ((u64)cdb[12] << 56); +- lba |= ((u64)cdb[13] << 48); +- lba |= ((u64)cdb[14] << 40); +- lba |= ((u64)cdb[15] << 32); +- lba |= (cdb[16] << 24); +- lba |= (cdb[17] << 16); +- lba |= (cdb[18] << 8); +- lba |= cdb[19]; +- ei_lbrt |= (cdb[20] << 24); +- ei_lbrt |= (cdb[21] << 16); +- ei_lbrt |= (cdb[22] << 8); +- ei_lbrt |= cdb[23]; +- txlen |= (cdb[28] << 24); +- txlen |= (cdb[29] << 16); +- txlen |= (cdb[30] << 8); +- txlen |= cdb[31]; +- +- trace_seq_printf(p, "%s_32 lba=%llu txlen=%llu protect=%u ei_lbrt=%u", +- cmd, (unsigned long long)lba, +- (unsigned long long)txlen, cdb[10] >> 5, ei_lbrt); ++ lba = get_unaligned_be64(&cdb[12]); ++ ei_lbrt = get_unaligned_be32(&cdb[20]); ++ txlen = get_unaligned_be32(&cdb[28]); ++ ++ trace_seq_printf(p, "%s_32 lba=%llu txlen=%u protect=%u ei_lbrt=%u", ++ cmd, lba, txlen, cdb[10] >> 5, ei_lbrt); + + if (SERVICE_ACTION32(cdb) == WRITE_SAME_32) + trace_seq_printf(p, " unmap=%u", cdb[10] >> 3 & 1); +@@ -184,7 +149,7 @@ static const char * + scsi_trace_unmap(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p); +- unsigned int regions = cdb[7] << 8 | cdb[8]; ++ unsigned int regions = get_unaligned_be16(&cdb[7]); + + trace_seq_printf(p, "regions=%u", (regions - 8) / 16); + trace_seq_putc(p, 0); +@@ -196,8 +161,8 @@ static const char * + scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len) + { + const char *ret = trace_seq_buffer_ptr(p), *cmd; +- sector_t lba = 0; +- u32 alloc_len = 0; ++ u64 lba; ++ u32 alloc_len; + + switch (SERVICE_ACTION16(cdb)) { + case SAI_READ_CAPACITY_16: +@@ -211,21 +176,10 @@ scsi_trace_service_action_in(struct trace_seq *p, unsigned char *cdb, int len) + goto out; + } + +- lba |= ((u64)cdb[2] << 56); +- lba |= ((u64)cdb[3] << 48); +- lba |= ((u64)cdb[4] << 40); +- lba |= ((u64)cdb[5] << 32); +- lba |= (cdb[6] << 24); +- lba |= (cdb[7] << 16); +- lba |= (cdb[8] << 8); +- lba |= cdb[9]; +- alloc_len |= (cdb[10] << 24); +- alloc_len |= (cdb[11] << 16); +- alloc_len |= (cdb[12] << 8); +- alloc_len |= cdb[13]; +- +- trace_seq_printf(p, "%s lba=%llu alloc_len=%u", cmd, +- (unsigned long long)lba, alloc_len); ++ lba = get_unaligned_be64(&cdb[2]); ++ alloc_len = get_unaligned_be32(&cdb[10]); ++ ++ trace_seq_printf(p, "%s lba=%llu alloc_len=%u", cmd, lba, alloc_len); + + out: + trace_seq_putc(p, 0); +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c +index 91b9eca75b75..cad9ef012a14 100644 +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -1998,8 +1998,10 @@ static int sd_read_protection_type(struct scsi_disk *sdkp, unsigned char *buffer + u8 type; + int ret = 0; + +- if (scsi_device_protection(sdp) == 0 || (buffer[12] & 1) == 0) ++ if (scsi_device_protection(sdp) == 0 || (buffer[12] & 1) == 0) { ++ sdkp->protection_type = 0; + return ret; ++ } + + type = ((buffer[12] >> 1) & 7) + 1; /* P_TYPE 0 = Type 1 */ + +diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c +index 691c04b3e5b6..938840af9c50 100644 +--- a/drivers/spi/spi-atmel.c ++++ b/drivers/spi/spi-atmel.c +@@ -315,7 +315,6 @@ struct atmel_spi { + struct atmel_spi_dma dma; + + bool keep_cs; +- bool cs_active; + + u32 fifo_size; + }; +@@ -1404,11 +1403,9 @@ static int atmel_spi_one_transfer(struct spi_master *master, + &msg->transfers)) { + as->keep_cs = true; + } else { +- as->cs_active = !as->cs_active; +- if (as->cs_active) +- cs_activate(as, msg->spi); +- else +- cs_deactivate(as, msg->spi); ++ cs_deactivate(as, msg->spi); ++ udelay(10); ++ cs_activate(as, msg->spi); + } + } + +@@ -1431,7 +1428,6 @@ static int atmel_spi_transfer_one_message(struct spi_master *master, + atmel_spi_lock(as); + cs_activate(as, spi); + +- as->cs_active = true; + as->keep_cs = false; + + msg->status = 0; +diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c +index cb6497ce4b61..6e75095af681 100644 +--- a/drivers/target/target_core_fabric_lib.c ++++ b/drivers/target/target_core_fabric_lib.c +@@ -130,7 +130,7 @@ static int srp_get_pr_transport_id( + memset(buf + 8, 0, leading_zero_bytes); + rc = hex2bin(buf + 8 + leading_zero_bytes, p, count); + if (rc < 0) { +- pr_debug("hex2bin failed for %s: %d\n", __func__, rc); ++ pr_debug("hex2bin failed for %s: %d\n", p, rc); + return rc; + } + +diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c +index d607cb2eb64e..b59d0dafefab 100644 +--- a/drivers/tty/serial/imx.c ++++ b/drivers/tty/serial/imx.c +@@ -545,7 +545,7 @@ static void imx_dma_tx(struct imx_port *sport) + dev_err(dev, "DMA mapping error for TX.\n"); + return; + } +- desc = dmaengine_prep_slave_sg(chan, sgl, sport->dma_tx_nents, ++ desc = dmaengine_prep_slave_sg(chan, sgl, ret, + DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT); + if (!desc) { + dma_unmap_sg(dev, sgl, sport->dma_tx_nents, +diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c +index ea4ffc2ebb2f..d23f09e151f8 100644 +--- a/drivers/tty/serial/pch_uart.c ++++ b/drivers/tty/serial/pch_uart.c +@@ -251,6 +251,7 @@ struct eg20t_port { + struct dma_chan *chan_rx; + struct scatterlist *sg_tx_p; + int nent; ++ int orig_nent; + struct scatterlist sg_rx; + int tx_dma_use; + void *rx_buf_virt; +@@ -804,9 +805,10 @@ static void pch_dma_tx_complete(void *arg) + } + xmit->tail &= UART_XMIT_SIZE - 1; + async_tx_ack(priv->desc_tx); +- dma_unmap_sg(port->dev, sg, priv->nent, DMA_TO_DEVICE); ++ dma_unmap_sg(port->dev, sg, priv->orig_nent, DMA_TO_DEVICE); + priv->tx_dma_use = 0; + priv->nent = 0; ++ priv->orig_nent = 0; + kfree(priv->sg_tx_p); + pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); + } +@@ -1031,6 +1033,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) + dev_err(priv->port.dev, "%s:dma_map_sg Failed\n", __func__); + return 0; + } ++ priv->orig_nent = num; + priv->nent = nent; + + for (i = 0; i < nent; i++, sg++) { +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c +index 7805f3e535ec..75a07b73a82b 100644 +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -1146,6 +1146,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) + * PORT_OVER_CURRENT is not. So check for any of them. + */ + if (udev || (portstatus & USB_PORT_STAT_CONNECTION) || ++ (portchange & USB_PORT_STAT_C_CONNECTION) || + (portstatus & USB_PORT_STAT_OVERCURRENT) || + (portchange & USB_PORT_STAT_C_OVERCURRENT)) + set_bit(port1, hub->change_bits); +diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c +index f73ea14e8173..e8a8c4fa944f 100644 +--- a/drivers/usb/serial/ch341.c ++++ b/drivers/usb/serial/ch341.c +@@ -555,9 +555,13 @@ static int ch341_tiocmget(struct tty_struct *tty) + static int ch341_reset_resume(struct usb_serial *serial) + { + struct usb_serial_port *port = serial->port[0]; +- struct ch341_private *priv = usb_get_serial_port_data(port); ++ struct ch341_private *priv; + int ret; + ++ priv = usb_get_serial_port_data(port); ++ if (!priv) ++ return 0; ++ + /* reconfigure ch341 serial port after bus-reset */ + ch341_configure(serial->dev, priv); + +diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c +index 0de11898fee7..75c60e74438d 100644 +--- a/drivers/usb/serial/io_edgeport.c ++++ b/drivers/usb/serial/io_edgeport.c +@@ -572,6 +572,7 @@ static void edge_interrupt_callback(struct urb *urb) + struct usb_serial_port *port; + unsigned char *data = urb->transfer_buffer; + int length = urb->actual_length; ++ unsigned long flags; + int bytes_avail; + int position; + int txCredits; +@@ -603,7 +604,7 @@ static void edge_interrupt_callback(struct urb *urb) + if (length > 1) { + bytes_avail = data[0] | (data[1] << 8); + if (bytes_avail) { +- spin_lock(&edge_serial->es_lock); ++ spin_lock_irqsave(&edge_serial->es_lock, flags); + edge_serial->rxBytesAvail += bytes_avail; + dev_dbg(dev, + "%s - bytes_avail=%d, rxBytesAvail=%d, read_in_progress=%d\n", +@@ -626,7 +627,8 @@ static void edge_interrupt_callback(struct urb *urb) + edge_serial->read_in_progress = false; + } + } +- spin_unlock(&edge_serial->es_lock); ++ spin_unlock_irqrestore(&edge_serial->es_lock, ++ flags); + } + } + /* grab the txcredits for the ports if available */ +@@ -638,10 +640,12 @@ static void edge_interrupt_callback(struct urb *urb) + if (txCredits) { + port = edge_serial->serial->port[portNumber]; + edge_port = usb_get_serial_port_data(port); +- if (edge_port->open) { +- spin_lock(&edge_port->ep_lock); ++ if (edge_port && edge_port->open) { ++ spin_lock_irqsave(&edge_port->ep_lock, ++ flags); + edge_port->txCredits += txCredits; +- spin_unlock(&edge_port->ep_lock); ++ spin_unlock_irqrestore(&edge_port->ep_lock, ++ flags); + dev_dbg(dev, "%s - txcredits for port%d = %d\n", + __func__, portNumber, + edge_port->txCredits); +@@ -682,6 +686,7 @@ static void edge_bulk_in_callback(struct urb *urb) + int retval; + __u16 raw_data_length; + int status = urb->status; ++ unsigned long flags; + + if (status) { + dev_dbg(&urb->dev->dev, "%s - nonzero read bulk status received: %d\n", +@@ -701,7 +706,7 @@ static void edge_bulk_in_callback(struct urb *urb) + + usb_serial_debug_data(dev, __func__, raw_data_length, data); + +- spin_lock(&edge_serial->es_lock); ++ spin_lock_irqsave(&edge_serial->es_lock, flags); + + /* decrement our rxBytes available by the number that we just got */ + edge_serial->rxBytesAvail -= raw_data_length; +@@ -725,7 +730,7 @@ static void edge_bulk_in_callback(struct urb *urb) + edge_serial->read_in_progress = false; + } + +- spin_unlock(&edge_serial->es_lock); ++ spin_unlock_irqrestore(&edge_serial->es_lock, flags); + } + + +@@ -1666,7 +1671,8 @@ static void edge_break(struct tty_struct *tty, int break_state) + static void process_rcvd_data(struct edgeport_serial *edge_serial, + unsigned char *buffer, __u16 bufferLength) + { +- struct device *dev = &edge_serial->serial->dev->dev; ++ struct usb_serial *serial = edge_serial->serial; ++ struct device *dev = &serial->dev->dev; + struct usb_serial_port *port; + struct edgeport_port *edge_port; + __u16 lastBufferLength; +@@ -1771,11 +1777,10 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial, + + /* spit this data back into the tty driver if this + port is open */ +- if (rxLen) { +- port = edge_serial->serial->port[ +- edge_serial->rxPort]; ++ if (rxLen && edge_serial->rxPort < serial->num_ports) { ++ port = serial->port[edge_serial->rxPort]; + edge_port = usb_get_serial_port_data(port); +- if (edge_port->open) { ++ if (edge_port && edge_port->open) { + dev_dbg(dev, "%s - Sending %d bytes to TTY for port %d\n", + __func__, rxLen, + edge_serial->rxPort); +@@ -1783,8 +1788,8 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial, + rxLen); + edge_port->port->icount.rx += rxLen; + } +- buffer += rxLen; + } ++ buffer += rxLen; + break; + + case EXPECT_HDR3: /* Expect 3rd byte of status header */ +@@ -1819,6 +1824,8 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial, + __u8 code = edge_serial->rxStatusCode; + + /* switch the port pointer to the one being currently talked about */ ++ if (edge_serial->rxPort >= edge_serial->serial->num_ports) ++ return; + port = edge_serial->serial->port[edge_serial->rxPort]; + edge_port = usb_get_serial_port_data(port); + if (edge_port == NULL) { +diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c +index 38112be0dbae..a79e9adf4e53 100644 +--- a/drivers/usb/serial/keyspan.c ++++ b/drivers/usb/serial/keyspan.c +@@ -565,6 +565,8 @@ static void usa49_glocont_callback(struct urb *urb) + for (i = 0; i < serial->num_ports; ++i) { + port = serial->port[i]; + p_priv = usb_get_serial_port_data(port); ++ if (!p_priv) ++ continue; + + if (p_priv->resend_cont) { + dev_dbg(&port->dev, "%s - sending setup\n", __func__); +@@ -962,6 +964,8 @@ static void usa67_glocont_callback(struct urb *urb) + for (i = 0; i < serial->num_ports; ++i) { + port = serial->port[i]; + p_priv = usb_get_serial_port_data(port); ++ if (!p_priv) ++ continue; + + if (p_priv->resend_cont) { + dev_dbg(&port->dev, "%s - sending setup\n", __func__); +diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c +index 64bf258e7e00..9606dde3194c 100644 +--- a/drivers/usb/serial/opticon.c ++++ b/drivers/usb/serial/opticon.c +@@ -116,7 +116,7 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype, + retval = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), + requesttype, + USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, +- 0, 0, buffer, 1, 0); ++ 0, 0, buffer, 1, USB_CTRL_SET_TIMEOUT); + kfree(buffer); + + if (retval < 0) +diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c +index af0c87276299..82f28192694f 100644 +--- a/drivers/usb/serial/quatech2.c ++++ b/drivers/usb/serial/quatech2.c +@@ -872,7 +872,10 @@ static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch) + u8 newMSR = (u8) *ch; + unsigned long flags; + ++ /* May be called from qt2_process_read_urb() for an unbound port. */ + port_priv = usb_get_serial_port_data(port); ++ if (!port_priv) ++ return; + + spin_lock_irqsave(&port_priv->lock, flags); + port_priv->shadowMSR = newMSR; +@@ -900,7 +903,10 @@ static void qt2_update_lsr(struct usb_serial_port *port, unsigned char *ch) + unsigned long flags; + u8 newLSR = (u8) *ch; + ++ /* May be called from qt2_process_read_urb() for an unbound port. */ + port_priv = usb_get_serial_port_data(port); ++ if (!port_priv) ++ return; + + if (newLSR & UART_LSR_BI) + newLSR &= (u8) (UART_LSR_OE | UART_LSR_BI); +diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c +index 511242111403..15e05ebf37ac 100644 +--- a/drivers/usb/serial/usb-serial-simple.c ++++ b/drivers/usb/serial/usb-serial-simple.c +@@ -89,6 +89,8 @@ DEVICE(moto_modem, MOTO_IDS); + #define MOTOROLA_TETRA_IDS() \ + { USB_DEVICE(0x0cad, 0x9011) }, /* Motorola Solutions TETRA PEI */ \ + { USB_DEVICE(0x0cad, 0x9012) }, /* MTP6550 */ \ ++ { USB_DEVICE(0x0cad, 0x9013) }, /* MTP3xxx */ \ ++ { USB_DEVICE(0x0cad, 0x9015) }, /* MTP85xx */ \ + { USB_DEVICE(0x0cad, 0x9016) } /* TPG2200 */ + DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS); + +diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c +index 80ba818d3a21..25bee7aba690 100644 +--- a/drivers/usb/serial/usb-serial.c ++++ b/drivers/usb/serial/usb-serial.c +@@ -1350,6 +1350,9 @@ static int usb_serial_register(struct usb_serial_driver *driver) + return -EINVAL; + } + ++ /* Prevent individual ports from being unbound. */ ++ driver->driver.suppress_bind_attrs = true; ++ + usb_serial_operations_init(driver); + + /* Add this device to our list of devices */ +diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c +index 1c789056e7e8..d6f5a74df973 100644 +--- a/drivers/xen/balloon.c ++++ b/drivers/xen/balloon.c +@@ -584,8 +584,15 @@ static void balloon_process(struct work_struct *work) + state = reserve_additional_memory(); + } + +- if (credit < 0) +- state = decrease_reservation(-credit, GFP_BALLOON); ++ if (credit < 0) { ++ long n_pages; ++ ++ n_pages = min(-credit, si_mem_available()); ++ state = decrease_reservation(n_pages, GFP_BALLOON); ++ if (state == BP_DONE && n_pages != -credit && ++ n_pages < totalreserve_pages) ++ state = BP_EAGAIN; ++ } + + state = update_schedule(state); + +@@ -624,6 +631,9 @@ static int add_ballooned_pages(int nr_pages) + } + } + ++ if (si_mem_available() < nr_pages) ++ return -ENOMEM; ++ + st = decrease_reservation(nr_pages, GFP_USER); + if (st != BP_DONE) + return -ENOMEM; +@@ -747,7 +757,7 @@ static int __init balloon_init(void) + balloon_stats.schedule_delay = 1; + balloon_stats.max_schedule_delay = 32; + balloon_stats.retry_count = 1; +- balloon_stats.max_retry_count = RETRY_UNLIMITED; ++ balloon_stats.max_retry_count = 4; + + #ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG + set_online_page_callback(&xen_online_page); +diff --git a/firmware/Makefile b/firmware/Makefile +index e297e1b52636..03232621cc08 100644 +--- a/firmware/Makefile ++++ b/firmware/Makefile +@@ -156,7 +156,7 @@ quiet_cmd_fwbin = MK_FW $@ + PROGBITS=$(if $(CONFIG_ARM),%,@)progbits; \ + echo "/* Generated by firmware/Makefile */" > $@;\ + echo " .section .rodata" >>$@;\ +- echo " .p2align $${ASM_ALIGN}" >>$@;\ ++ echo " .p2align 4" >>$@;\ + echo "_fw_$${FWSTR}_bin:" >>$@;\ + echo " .incbin \"$(2)\"" >>$@;\ + echo "_fw_end:" >>$@;\ +diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c +index 41f1a5dd33a5..4dcce3f034f4 100644 +--- a/fs/cifs/smb2file.c ++++ b/fs/cifs/smb2file.c +@@ -69,7 +69,7 @@ smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, + goto out; + + +- if (oparms->tcon->use_resilient) { ++ if (oparms->tcon->use_resilient) { + nr_ioctl_req.Timeout = 0; /* use server default (120 seconds) */ + nr_ioctl_req.Reserved = 0; + rc = SMB2_ioctl(xid, oparms->tcon, fid->persistent_fid, +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c +index 3557c5717c8d..271d8d9d0598 100644 +--- a/fs/ext4/inode.c ++++ b/fs/ext4/inode.c +@@ -5189,10 +5189,25 @@ static int ext4_expand_extra_isize(struct inode *inode, + { + struct ext4_inode *raw_inode; + struct ext4_xattr_ibody_header *header; ++ unsigned int inode_size = EXT4_INODE_SIZE(inode->i_sb); ++ struct ext4_inode_info *ei = EXT4_I(inode); + + if (EXT4_I(inode)->i_extra_isize >= new_extra_isize) + return 0; + ++ /* this was checked at iget time, but double check for good measure */ ++ if ((EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > inode_size) || ++ (ei->i_extra_isize & 3)) { ++ EXT4_ERROR_INODE(inode, "bad extra_isize %u (inode size %u)", ++ ei->i_extra_isize, ++ EXT4_INODE_SIZE(inode->i_sb)); ++ return -EFSCORRUPTED; ++ } ++ if ((new_extra_isize < ei->i_extra_isize) || ++ (new_extra_isize < 4) || ++ (new_extra_isize > inode_size - EXT4_GOOD_OLD_INODE_SIZE)) ++ return -EINVAL; /* Should never happen */ ++ + raw_inode = ext4_raw_inode(&iloc); + + header = IHDR(inode, raw_inode); +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index 6f00388a1471..adf02b1509ca 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -3169,6 +3169,40 @@ int ext4_calculate_overhead(struct super_block *sb) + return 0; + } + ++static void ext4_clamp_want_extra_isize(struct super_block *sb) ++{ ++ struct ext4_sb_info *sbi = EXT4_SB(sb); ++ struct ext4_super_block *es = sbi->s_es; ++ unsigned def_extra_isize = sizeof(struct ext4_inode) - ++ EXT4_GOOD_OLD_INODE_SIZE; ++ ++ if (sbi->s_inode_size == EXT4_GOOD_OLD_INODE_SIZE) { ++ sbi->s_want_extra_isize = 0; ++ return; ++ } ++ if (sbi->s_want_extra_isize < 4) { ++ sbi->s_want_extra_isize = def_extra_isize; ++ if (ext4_has_feature_extra_isize(sb)) { ++ if (sbi->s_want_extra_isize < ++ le16_to_cpu(es->s_want_extra_isize)) ++ sbi->s_want_extra_isize = ++ le16_to_cpu(es->s_want_extra_isize); ++ if (sbi->s_want_extra_isize < ++ le16_to_cpu(es->s_min_extra_isize)) ++ sbi->s_want_extra_isize = ++ le16_to_cpu(es->s_min_extra_isize); ++ } ++ } ++ /* Check if enough inode space is available */ ++ if ((sbi->s_want_extra_isize > sbi->s_inode_size) || ++ (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize > ++ sbi->s_inode_size)) { ++ sbi->s_want_extra_isize = def_extra_isize; ++ ext4_msg(sb, KERN_INFO, ++ "required extra inode space not available"); ++ } ++} ++ + static void ext4_set_resv_clusters(struct super_block *sb) + { + ext4_fsblk_t resv_clusters; +@@ -3991,29 +4025,7 @@ no_journal: + if (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY)) + sb->s_flags |= MS_RDONLY; + +- /* determine the minimum size of new large inodes, if present */ +- if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) { +- sbi->s_want_extra_isize = sizeof(struct ext4_inode) - +- EXT4_GOOD_OLD_INODE_SIZE; +- if (ext4_has_feature_extra_isize(sb)) { +- if (sbi->s_want_extra_isize < +- le16_to_cpu(es->s_want_extra_isize)) +- sbi->s_want_extra_isize = +- le16_to_cpu(es->s_want_extra_isize); +- if (sbi->s_want_extra_isize < +- le16_to_cpu(es->s_min_extra_isize)) +- sbi->s_want_extra_isize = +- le16_to_cpu(es->s_min_extra_isize); +- } +- } +- /* Check if enough inode space is available */ +- if (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize > +- sbi->s_inode_size) { +- sbi->s_want_extra_isize = sizeof(struct ext4_inode) - +- EXT4_GOOD_OLD_INODE_SIZE; +- ext4_msg(sb, KERN_INFO, "required extra inode space not" +- "available"); +- } ++ ext4_clamp_want_extra_isize(sb); + + ext4_set_resv_clusters(sb); + +@@ -4766,6 +4778,8 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) + goto restore_opts; + } + ++ ext4_clamp_want_extra_isize(sb); ++ + if ((old_opts.s_mount_opt & EXT4_MOUNT_JOURNAL_CHECKSUM) ^ + test_opt(sb, JOURNAL_CHECKSUM)) { + ext4_msg(sb, KERN_ERR, "changing journal_checksum " +diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c +index 2301011428a1..bbf1634ff427 100644 +--- a/fs/ocfs2/journal.c ++++ b/fs/ocfs2/journal.c +@@ -1080,6 +1080,14 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local, int replayed) + + ocfs2_clear_journal_error(osb->sb, journal->j_journal, osb->slot_num); + ++ if (replayed) { ++ jbd2_journal_lock_updates(journal->j_journal); ++ status = jbd2_journal_flush(journal->j_journal); ++ jbd2_journal_unlock_updates(journal->j_journal); ++ if (status < 0) ++ mlog_errno(status); ++ } ++ + status = ocfs2_journal_toggle_dirty(osb, 1, replayed); + if (status < 0) { + mlog_errno(status); +diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c +index df4661abadc4..83720460c5bc 100644 +--- a/fs/proc/meminfo.c ++++ b/fs/proc/meminfo.c +@@ -29,10 +29,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) + unsigned long committed; + long cached; + long available; +- unsigned long pagecache; +- unsigned long wmark_low = 0; + unsigned long pages[NR_LRU_LISTS]; +- struct zone *zone; + int lru; + + /* +@@ -51,33 +48,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) + for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++) + pages[lru] = global_page_state(NR_LRU_BASE + lru); + +- for_each_zone(zone) +- wmark_low += zone->watermark[WMARK_LOW]; +- +- /* +- * Estimate the amount of memory available for userspace allocations, +- * without causing swapping. +- */ +- available = i.freeram - totalreserve_pages; +- +- /* +- * Not all the page cache can be freed, otherwise the system will +- * start swapping. Assume at least half of the page cache, or the +- * low watermark worth of cache, needs to stay. +- */ +- pagecache = pages[LRU_ACTIVE_FILE] + pages[LRU_INACTIVE_FILE]; +- pagecache -= min(pagecache / 2, wmark_low); +- available += pagecache; +- +- /* +- * Part of the reclaimable slab consists of items that are in use, +- * and cannot be freed. Cap this estimate at the low watermark. +- */ +- available += global_page_state(NR_SLAB_RECLAIMABLE) - +- min(global_page_state(NR_SLAB_RECLAIMABLE) / 2, wmark_low); +- +- if (available < 0) +- available = 0; ++ available = si_mem_available(); + + /* + * Tagged format, for easy grepping and expansion. +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h +index e4b945925e40..4ae5d6ecd727 100644 +--- a/include/linux/blkdev.h ++++ b/include/linux/blkdev.h +@@ -264,6 +264,7 @@ struct queue_limits { + unsigned int max_sectors; + unsigned int max_segment_size; + unsigned int physical_block_size; ++ unsigned int logical_block_size; + unsigned int alignment_offset; + unsigned int io_min; + unsigned int io_opt; +@@ -273,7 +274,6 @@ struct queue_limits { + unsigned int discard_granularity; + unsigned int discard_alignment; + +- unsigned short logical_block_size; + unsigned short max_segments; + unsigned short max_integrity_segments; + +@@ -975,7 +975,7 @@ extern void blk_queue_max_discard_sectors(struct request_queue *q, + unsigned int max_discard_sectors); + extern void blk_queue_max_write_same_sectors(struct request_queue *q, + unsigned int max_write_same_sectors); +-extern void blk_queue_logical_block_size(struct request_queue *, unsigned short); ++extern void blk_queue_logical_block_size(struct request_queue *, unsigned int); + extern void blk_queue_physical_block_size(struct request_queue *, unsigned int); + extern void blk_queue_alignment_offset(struct request_queue *q, + unsigned int alignment); +@@ -1193,7 +1193,7 @@ static inline unsigned int queue_max_segment_size(struct request_queue *q) + return q->limits.max_segment_size; + } + +-static inline unsigned short queue_logical_block_size(struct request_queue *q) ++static inline unsigned queue_logical_block_size(struct request_queue *q) + { + int retval = 512; + +@@ -1203,7 +1203,7 @@ static inline unsigned short queue_logical_block_size(struct request_queue *q) + return retval; + } + +-static inline unsigned short bdev_logical_block_size(struct block_device *bdev) ++static inline unsigned int bdev_logical_block_size(struct block_device *bdev) + { + return queue_logical_block_size(bdev_get_queue(bdev)); + } +diff --git a/include/linux/mm.h b/include/linux/mm.h +index ed653ba47c46..15f81b2b87ed 100644 +--- a/include/linux/mm.h ++++ b/include/linux/mm.h +@@ -1802,6 +1802,7 @@ extern int __meminit init_per_zone_wmark_min(void); + extern void mem_init(void); + extern void __init mmap_init(void); + extern void show_mem(unsigned int flags); ++extern long si_mem_available(void); + extern void si_meminfo(struct sysinfo * val); + extern void si_meminfo_node(struct sysinfo *val, int nid); + +diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h +index d8ecefaf63ca..6b8ec40af2c4 100644 +--- a/include/linux/regulator/ab8500.h ++++ b/include/linux/regulator/ab8500.h +@@ -44,8 +44,6 @@ enum ab8505_regulator_id { + AB8505_LDO_ANAMIC2, + AB8505_LDO_AUX8, + AB8505_LDO_ANA, +- AB8505_SYSCLKREQ_2, +- AB8505_SYSCLKREQ_4, + AB8505_NUM_REGULATORS, + }; + +diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h +index c05748cc1b20..3fe53101b72a 100644 +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -3855,6 +3855,17 @@ const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); + const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, + const u8 *ies, int len); + ++/** ++ * cfg80211_send_layer2_update - send layer 2 update frame ++ * ++ * @dev: network device ++ * @addr: STA MAC address ++ * ++ * Wireless drivers can use this function to update forwarding tables in bridge ++ * devices upon STA association. ++ */ ++void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr); ++ + /** + * DOC: Regulatory enforcement infrastructure + * +diff --git a/mm/page-writeback.c b/mm/page-writeback.c +index d2211e42b779..698806914be7 100644 +--- a/mm/page-writeback.c ++++ b/mm/page-writeback.c +@@ -200,11 +200,11 @@ static void wb_min_max_ratio(struct bdi_writeback *wb, + if (this_bw < tot_bw) { + if (min) { + min *= this_bw; +- do_div(min, tot_bw); ++ min = div64_ul(min, tot_bw); + } + if (max < 100) { + max *= this_bw; +- do_div(max, tot_bw); ++ max = div64_ul(max, tot_bw); + } + } + +diff --git a/mm/page_alloc.c b/mm/page_alloc.c +index fd75e27c9b40..df589416ace6 100644 +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -3650,6 +3650,49 @@ static inline void show_node(struct zone *zone) + printk("Node %d ", zone_to_nid(zone)); + } + ++long si_mem_available(void) ++{ ++ long available; ++ unsigned long pagecache; ++ unsigned long wmark_low = 0; ++ unsigned long pages[NR_LRU_LISTS]; ++ struct zone *zone; ++ int lru; ++ ++ for (lru = LRU_BASE; lru < NR_LRU_LISTS; lru++) ++ pages[lru] = global_page_state(NR_LRU_BASE + lru); ++ ++ for_each_zone(zone) ++ wmark_low += zone->watermark[WMARK_LOW]; ++ ++ /* ++ * Estimate the amount of memory available for userspace allocations, ++ * without causing swapping. ++ */ ++ available = global_page_state(NR_FREE_PAGES) - totalreserve_pages; ++ ++ /* ++ * Not all the page cache can be freed, otherwise the system will ++ * start swapping. Assume at least half of the page cache, or the ++ * low watermark worth of cache, needs to stay. ++ */ ++ pagecache = pages[LRU_ACTIVE_FILE] + pages[LRU_INACTIVE_FILE]; ++ pagecache -= min(pagecache / 2, wmark_low); ++ available += pagecache; ++ ++ /* ++ * Part of the reclaimable slab consists of items that are in use, ++ * and cannot be freed. Cap this estimate at the low watermark. ++ */ ++ available += global_page_state(NR_SLAB_RECLAIMABLE) - ++ min(global_page_state(NR_SLAB_RECLAIMABLE) / 2, wmark_low); ++ ++ if (available < 0) ++ available = 0; ++ return available; ++} ++EXPORT_SYMBOL_GPL(si_mem_available); ++ + void si_meminfo(struct sysinfo *val) + { + val->totalram = totalram_pages; +diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c +index c2dff7c6e960..76808c5e8183 100644 +--- a/net/batman-adv/distributed-arp-table.c ++++ b/net/batman-adv/distributed-arp-table.c +@@ -226,6 +226,7 @@ static u32 batadv_hash_dat(const void *data, u32 size) + u32 hash = 0; + const struct batadv_dat_entry *dat = data; + const unsigned char *key; ++ __be16 vid; + u32 i; + + key = (const unsigned char *)&dat->ip; +@@ -235,7 +236,8 @@ static u32 batadv_hash_dat(const void *data, u32 size) + hash ^= (hash >> 6); + } + +- key = (const unsigned char *)&dat->vid; ++ vid = htons(dat->vid); ++ key = (__force const unsigned char *)&vid; + for (i = 0; i < sizeof(dat->vid); i++) { + hash += key[i]; + hash += (hash << 10); +diff --git a/net/dccp/feat.c b/net/dccp/feat.c +index f227f002c73d..db87d9f58019 100644 +--- a/net/dccp/feat.c ++++ b/net/dccp/feat.c +@@ -738,7 +738,12 @@ static int __feat_register_sp(struct list_head *fn, u8 feat, u8 is_local, + if (dccp_feat_clone_sp_val(&fval, sp_val, sp_len)) + return -ENOMEM; + +- return dccp_feat_push_change(fn, feat, is_local, mandatory, &fval); ++ if (dccp_feat_push_change(fn, feat, is_local, mandatory, &fval)) { ++ kfree(fval.sp.vec); ++ return -ENOMEM; ++ } ++ ++ return 0; + } + + /** +diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c +index 943378d6e4c3..8dd239214a14 100644 +--- a/net/hsr/hsr_device.c ++++ b/net/hsr/hsr_device.c +@@ -289,6 +289,8 @@ static void send_hsr_supervision_frame(struct hsr_port *master, u8 type) + skb->dev->dev_addr, skb->len) <= 0) + goto out; + skb_reset_mac_header(skb); ++ skb_reset_network_header(skb); ++ skb_reset_transport_header(skb); + + hsr_stag = (typeof(hsr_stag)) skb_put(skb, sizeof(*hsr_stag)); + +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c +index 1abf88aec19d..88bfd663d9a2 100644 +--- a/net/ipv4/tcp_input.c ++++ b/net/ipv4/tcp_input.c +@@ -895,9 +895,10 @@ static void tcp_update_reordering(struct sock *sk, const int metric, + /* This must be called before lost_out is incremented */ + static void tcp_verify_retransmit_hint(struct tcp_sock *tp, struct sk_buff *skb) + { +- if (!tp->retransmit_skb_hint || +- before(TCP_SKB_CB(skb)->seq, +- TCP_SKB_CB(tp->retransmit_skb_hint)->seq)) ++ if ((!tp->retransmit_skb_hint && tp->retrans_out >= tp->lost_out) || ++ (tp->retransmit_skb_hint && ++ before(TCP_SKB_CB(skb)->seq, ++ TCP_SKB_CB(tp->retransmit_skb_hint)->seq))) + tp->retransmit_skb_hint = skb; + + if (!tp->lost_out || +diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c +index 1999a7eaa692..cf3917c6da0a 100644 +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -875,50 +875,6 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev) + return 0; + } + +-/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ +-struct iapp_layer2_update { +- u8 da[ETH_ALEN]; /* broadcast */ +- u8 sa[ETH_ALEN]; /* STA addr */ +- __be16 len; /* 6 */ +- u8 dsap; /* 0 */ +- u8 ssap; /* 0 */ +- u8 control; +- u8 xid_info[3]; +-} __packed; +- +-static void ieee80211_send_layer2_update(struct sta_info *sta) +-{ +- struct iapp_layer2_update *msg; +- struct sk_buff *skb; +- +- /* Send Level 2 Update Frame to update forwarding tables in layer 2 +- * bridge devices */ +- +- skb = dev_alloc_skb(sizeof(*msg)); +- if (!skb) +- return; +- msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg)); +- +- /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) +- * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ +- +- eth_broadcast_addr(msg->da); +- memcpy(msg->sa, sta->sta.addr, ETH_ALEN); +- msg->len = htons(6); +- msg->dsap = 0; +- msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */ +- msg->control = 0xaf; /* XID response lsb.1111F101. +- * F=0 (no poll command; unsolicited frame) */ +- msg->xid_info[0] = 0x81; /* XID format identifier */ +- msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */ +- msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */ +- +- skb->dev = sta->sdata->dev; +- skb->protocol = eth_type_trans(skb, sta->sdata->dev); +- memset(skb->cb, 0, sizeof(skb->cb)); +- netif_rx_ni(skb); +-} +- + static int sta_apply_auth_flags(struct ieee80211_local *local, + struct sta_info *sta, + u32 mask, u32 set) +@@ -1194,7 +1150,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, + struct sta_info *sta; + struct ieee80211_sub_if_data *sdata; + int err; +- int layer2_update; + + if (params->vlan) { + sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); +@@ -1248,18 +1203,12 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, + test_sta_flag(sta, WLAN_STA_ASSOC)) + rate_control_rate_init(sta); + +- layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN || +- sdata->vif.type == NL80211_IFTYPE_AP; +- + err = sta_info_insert_rcu(sta); + if (err) { + rcu_read_unlock(); + return err; + } + +- if (layer2_update) +- ieee80211_send_layer2_update(sta); +- + rcu_read_unlock(); + + return 0; +@@ -1367,7 +1316,9 @@ static int ieee80211_change_station(struct wiphy *wiphy, + atomic_inc(&sta->sdata->bss->num_mcast_sta); + } + +- ieee80211_send_layer2_update(sta); ++ if (sta->sta_state == IEEE80211_STA_AUTHORIZED) ++ cfg80211_send_layer2_update(sta->sdata->dev, ++ sta->sta.addr); + } + + err = sta_apply_parameters(local, sta, params); +diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c +index 7e7b9ef29d8d..1cad7ca9234b 100644 +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -1775,6 +1775,10 @@ int sta_info_move_state(struct sta_info *sta, + set_bit(WLAN_STA_AUTHORIZED, &sta->_flags); + ieee80211_check_fast_xmit(sta); + } ++ if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN || ++ sta->sdata->vif.type == NL80211_IFTYPE_AP) ++ cfg80211_send_layer2_update(sta->sdata->dev, ++ sta->sta.addr); + break; + default: + break; +diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h b/net/netfilter/ipset/ip_set_bitmap_gen.h +index b0bc475f641e..adc703ccd68b 100644 +--- a/net/netfilter/ipset/ip_set_bitmap_gen.h ++++ b/net/netfilter/ipset/ip_set_bitmap_gen.h +@@ -66,9 +66,9 @@ mtype_destroy(struct ip_set *set) + if (SET_WITH_TIMEOUT(set)) + del_timer_sync(&map->gc); + +- ip_set_free(map->members); + if (set->dsize && set->extensions & IPSET_EXT_DESTROY) + mtype_ext_cleanup(set); ++ ip_set_free(map->members); + ip_set_free(map); + + set->data = NULL; +diff --git a/net/socket.c b/net/socket.c +index e5bb73eb36fe..15bdba4211ad 100644 +--- a/net/socket.c ++++ b/net/socket.c +@@ -3143,6 +3143,7 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, + case SIOCSARP: + case SIOCGARP: + case SIOCDARP: ++ case SIOCOUTQNSD: + case SIOCATMARK: + return sock_do_ioctl(net, sock, cmd, arg); + } +diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h +index c23516d0f807..b3a60c3e1934 100644 +--- a/net/wireless/rdev-ops.h ++++ b/net/wireless/rdev-ops.h +@@ -517,6 +517,10 @@ static inline int + rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed) + { + int ret; ++ ++ if (!rdev->ops->set_wiphy_params) ++ return -EOPNOTSUPP; ++ + trace_rdev_set_wiphy_params(&rdev->wiphy, changed); + ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed); + trace_rdev_return_int(&rdev->wiphy, ret); +diff --git a/net/wireless/util.c b/net/wireless/util.c +index 405388772fc4..156a2a6337b9 100644 +--- a/net/wireless/util.c ++++ b/net/wireless/util.c +@@ -1814,3 +1814,48 @@ EXPORT_SYMBOL(rfc1042_header); + const unsigned char bridge_tunnel_header[] __aligned(2) = + { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; + EXPORT_SYMBOL(bridge_tunnel_header); ++ ++/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ ++struct iapp_layer2_update { ++ u8 da[ETH_ALEN]; /* broadcast */ ++ u8 sa[ETH_ALEN]; /* STA addr */ ++ __be16 len; /* 6 */ ++ u8 dsap; /* 0 */ ++ u8 ssap; /* 0 */ ++ u8 control; ++ u8 xid_info[3]; ++} __packed; ++ ++void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr) ++{ ++ struct iapp_layer2_update *msg; ++ struct sk_buff *skb; ++ ++ /* Send Level 2 Update Frame to update forwarding tables in layer 2 ++ * bridge devices */ ++ ++ skb = dev_alloc_skb(sizeof(*msg)); ++ if (!skb) ++ return; ++ msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg)); ++ ++ /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) ++ * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ ++ ++ eth_broadcast_addr(msg->da); ++ ether_addr_copy(msg->sa, addr); ++ msg->len = htons(6); ++ msg->dsap = 0; ++ msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */ ++ msg->control = 0xaf; /* XID response lsb.1111F101. ++ * F=0 (no poll command; unsolicited frame) */ ++ msg->xid_info[0] = 0x81; /* XID format identifier */ ++ msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */ ++ msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */ ++ ++ skb->dev = dev; ++ skb->protocol = eth_type_trans(skb, dev); ++ memset(skb->cb, 0, sizeof(skb->cb)); ++ netif_rx_ni(skb); ++} ++EXPORT_SYMBOL(cfg80211_send_layer2_update); +diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c +index 3be67560ead5..c526201fd0df 100644 +--- a/sound/core/seq/seq_timer.c ++++ b/sound/core/seq/seq_timer.c +@@ -484,15 +484,19 @@ void snd_seq_info_timer_read(struct snd_info_entry *entry, + q = queueptr(idx); + if (q == NULL) + continue; +- if ((tmr = q->timer) == NULL || +- (ti = tmr->timeri) == NULL) { +- queuefree(q); +- continue; +- } ++ mutex_lock(&q->timer_mutex); ++ tmr = q->timer; ++ if (!tmr) ++ goto unlock; ++ ti = tmr->timeri; ++ if (!ti) ++ goto unlock; + snd_iprintf(buffer, "Timer for queue %i : %s\n", q->queue, ti->timer->name); + resolution = snd_timer_resolution(ti) * tmr->ticks; + snd_iprintf(buffer, " Period time : %lu.%09lu\n", resolution / 1000000000, resolution % 1000000000); + snd_iprintf(buffer, " Skew : %u / %u\n", tmr->skew, tmr->skew_base); ++unlock: ++ mutex_unlock(&q->timer_mutex); + queuefree(q); + } + } +diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c +index 41aa3355e920..e85ada14a8e1 100644 +--- a/sound/usb/line6/pcm.c ++++ b/sound/usb/line6/pcm.c +@@ -523,13 +523,6 @@ int line6_init_pcm(struct usb_line6 *line6, + line6pcm->volume_monitor = 255; + line6pcm->line6 = line6; + +- /* Read and write buffers are sized identically, so choose minimum */ +- line6pcm->max_packet_size = min( +- usb_maxpacket(line6->usbdev, +- usb_rcvisocpipe(line6->usbdev, ep_read), 0), +- usb_maxpacket(line6->usbdev, +- usb_sndisocpipe(line6->usbdev, ep_write), 1)); +- + spin_lock_init(&line6pcm->out.lock); + spin_lock_init(&line6pcm->in.lock); + line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD; +@@ -539,6 +532,18 @@ int line6_init_pcm(struct usb_line6 *line6, + pcm->private_data = line6pcm; + pcm->private_free = line6_cleanup_pcm; + ++ /* Read and write buffers are sized identically, so choose minimum */ ++ line6pcm->max_packet_size = min( ++ usb_maxpacket(line6->usbdev, ++ usb_rcvisocpipe(line6->usbdev, ep_read), 0), ++ usb_maxpacket(line6->usbdev, ++ usb_sndisocpipe(line6->usbdev, ep_write), 1)); ++ if (!line6pcm->max_packet_size) { ++ dev_err(line6pcm->line6->ifcdev, ++ "cannot get proper max packet size\n"); ++ return -EINVAL; ++ } ++ + err = line6_create_audio_out_urbs(line6pcm); + if (err < 0) + return err; +diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c +index 5ca8836b16e7..89bb0f76e896 100644 +--- a/tools/perf/util/probe-finder.c ++++ b/tools/perf/util/probe-finder.c +@@ -597,38 +597,26 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwfl_Module *mod, + const char *function, + struct probe_trace_point *tp) + { +- Dwarf_Addr eaddr, highaddr; ++ Dwarf_Addr eaddr; + GElf_Sym sym; + const char *symbol; + + /* Verify the address is correct */ +- if (dwarf_entrypc(sp_die, &eaddr) != 0) { +- pr_warning("Failed to get entry address of %s\n", +- dwarf_diename(sp_die)); +- return -ENOENT; +- } +- if (dwarf_highpc(sp_die, &highaddr) != 0) { +- pr_warning("Failed to get end address of %s\n", +- dwarf_diename(sp_die)); +- return -ENOENT; +- } +- if (paddr > highaddr) { +- pr_warning("Offset specified is greater than size of %s\n", ++ if (!dwarf_haspc(sp_die, paddr)) { ++ pr_warning("Specified offset is out of %s\n", + dwarf_diename(sp_die)); + return -EINVAL; + } + +- symbol = dwarf_diename(sp_die); ++ /* Try to get actual symbol name from symtab */ ++ symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL); + if (!symbol) { +- /* Try to get the symbol name from symtab */ +- symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL); +- if (!symbol) { +- pr_warning("Failed to find symbol at 0x%lx\n", +- (unsigned long)paddr); +- return -ENOENT; +- } +- eaddr = sym.st_value; ++ pr_warning("Failed to find symbol at 0x%lx\n", ++ (unsigned long)paddr); ++ return -ENOENT; + } ++ eaddr = sym.st_value; ++ + tp->offset = (unsigned long)(paddr - eaddr); + tp->address = (unsigned long)paddr; + tp->symbol = strdup(symbol); +diff --git a/tools/testing/selftests/rseq/settings b/tools/testing/selftests/rseq/settings +new file mode 100644 +index 000000000000..e7b9417537fb +--- /dev/null ++++ b/tools/testing/selftests/rseq/settings +@@ -0,0 +1 @@ ++timeout=0