From: Greg Kroah-Hartman Date: Mon, 4 Apr 2022 13:37:56 +0000 (+0200) Subject: 5.16-stable patches X-Git-Tag: v5.17.2~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=983a5ffca2f8aee48a69abf9ceef16edf45af6d4;p=thirdparty%2Fkernel%2Fstable-queue.git 5.16-stable patches added patches: mmc-rtsx-fix-build-errors-warnings-for-unused-variable.patch mmc-rtsx-let-mmc-core-handle-runtime-pm.patch revert-nbd-fix-possible-overflow-on-first_minor-in-nbd_dev_add.patch --- diff --git a/queue-5.16/mmc-rtsx-fix-build-errors-warnings-for-unused-variable.patch b/queue-5.16/mmc-rtsx-fix-build-errors-warnings-for-unused-variable.patch new file mode 100644 index 00000000000..377c00c78fc --- /dev/null +++ b/queue-5.16/mmc-rtsx-fix-build-errors-warnings-for-unused-variable.patch @@ -0,0 +1,72 @@ +From 3dd9a926ec2308e49445f22abef149fc64e9332e Mon Sep 17 00:00:00 2001 +From: Ulf Hansson +Date: Tue, 1 Mar 2022 12:53:00 +0100 +Subject: mmc: rtsx: Fix build errors/warnings for unused variable + +From: Ulf Hansson + +commit 3dd9a926ec2308e49445f22abef149fc64e9332e upstream. + +The struct device *dev, is no longer needed at various functions, let's +therefore drop it to fix the build errors/warnings. + +Fixes: 7570fb41e450 ("mmc: rtsx: Let MMC core handle runtime PM") +Cc: Kai-Heng Feng +Reported-by: kernel test robot +Signed-off-by: Ulf Hansson +Link: https://lore.kernel.org/r/20220301115300.64332-1-ulf.hansson@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/host/rtsx_pci_sdmmc.c | 6 ------ + 1 file changed, 6 deletions(-) + +--- a/drivers/mmc/host/rtsx_pci_sdmmc.c ++++ b/drivers/mmc/host/rtsx_pci_sdmmc.c +@@ -806,7 +806,6 @@ static void sd_request(struct work_struc + struct mmc_request *mrq = host->mrq; + struct mmc_command *cmd = mrq->cmd; + struct mmc_data *data = mrq->data; +- struct device *dev = &host->pdev->dev; + + unsigned int data_size = 0; + int err; +@@ -1081,7 +1080,6 @@ static void sdmmc_set_ios(struct mmc_hos + { + struct realtek_pci_sdmmc *host = mmc_priv(mmc); + struct rtsx_pcr *pcr = host->pcr; +- struct device *dev = &host->pdev->dev; + + if (host->eject) + return; +@@ -1130,7 +1128,6 @@ static int sdmmc_get_ro(struct mmc_host + { + struct realtek_pci_sdmmc *host = mmc_priv(mmc); + struct rtsx_pcr *pcr = host->pcr; +- struct device *dev = &host->pdev->dev; + int ro = 0; + u32 val; + +@@ -1156,7 +1153,6 @@ static int sdmmc_get_cd(struct mmc_host + { + struct realtek_pci_sdmmc *host = mmc_priv(mmc); + struct rtsx_pcr *pcr = host->pcr; +- struct device *dev = &host->pdev->dev; + int cd = 0; + u32 val; + +@@ -1255,7 +1251,6 @@ static int sdmmc_switch_voltage(struct m + { + struct realtek_pci_sdmmc *host = mmc_priv(mmc); + struct rtsx_pcr *pcr = host->pcr; +- struct device *dev = &host->pdev->dev; + int err = 0; + u8 voltage; + +@@ -1308,7 +1303,6 @@ static int sdmmc_execute_tuning(struct m + { + struct realtek_pci_sdmmc *host = mmc_priv(mmc); + struct rtsx_pcr *pcr = host->pcr; +- struct device *dev = &host->pdev->dev; + int err = 0; + + if (host->eject) diff --git a/queue-5.16/mmc-rtsx-let-mmc-core-handle-runtime-pm.patch b/queue-5.16/mmc-rtsx-let-mmc-core-handle-runtime-pm.patch new file mode 100644 index 00000000000..8a83bdac19e --- /dev/null +++ b/queue-5.16/mmc-rtsx-let-mmc-core-handle-runtime-pm.patch @@ -0,0 +1,128 @@ +From 7570fb41e450ba37bf9335fe3751fa9f502c30fa Mon Sep 17 00:00:00 2001 +From: Kai-Heng Feng +Date: Wed, 16 Feb 2022 13:54:31 +0800 +Subject: mmc: rtsx: Let MMC core handle runtime PM + +From: Kai-Heng Feng + +commit 7570fb41e450ba37bf9335fe3751fa9f502c30fa upstream. + +Since MMC core handles runtime PM reference counting, we can avoid doing +redundant runtime PM work in the driver. That means the only thing +commit 5b4258f6721f ("misc: rtsx: rts5249 support runtime PM") misses is +to always enable runtime PM, to let its parent driver enable ASPM in the +runtime idle routine. + +Fixes: 7499b529d97f ("mmc: rtsx: Use pm_runtime_{get,put}() to handle runtime PM") +Reviewed-by: Ulf Hansson +Signed-off-by: Kai-Heng Feng +Link: https://lore.kernel.org/r/20220216055435.2335297-1-kai.heng.feng@canonical.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/host/rtsx_pci_sdmmc.c | 18 ------------------ + 1 file changed, 18 deletions(-) + +--- a/drivers/mmc/host/rtsx_pci_sdmmc.c ++++ b/drivers/mmc/host/rtsx_pci_sdmmc.c +@@ -823,7 +823,6 @@ static void sd_request(struct work_struc + } + + mutex_lock(&pcr->pcr_mutex); +- pm_runtime_get_sync(dev); + + rtsx_pci_start_run(pcr); + +@@ -860,8 +859,6 @@ static void sd_request(struct work_struc + data->bytes_xfered = data->blocks * data->blksz; + } + +- pm_runtime_mark_last_busy(dev); +- pm_runtime_put_autosuspend(dev); + mutex_unlock(&pcr->pcr_mutex); + + finish: +@@ -1093,7 +1090,6 @@ static void sdmmc_set_ios(struct mmc_hos + return; + + mutex_lock(&pcr->pcr_mutex); +- pm_runtime_get_sync(dev); + + rtsx_pci_start_run(pcr); + +@@ -1127,8 +1123,6 @@ static void sdmmc_set_ios(struct mmc_hos + rtsx_pci_switch_clock(pcr, ios->clock, host->ssc_depth, + host->initial_mode, host->double_clk, host->vpclk); + +- pm_runtime_mark_last_busy(dev); +- pm_runtime_put_autosuspend(dev); + mutex_unlock(&pcr->pcr_mutex); + } + +@@ -1144,7 +1138,6 @@ static int sdmmc_get_ro(struct mmc_host + return -ENOMEDIUM; + + mutex_lock(&pcr->pcr_mutex); +- pm_runtime_get_sync(dev); + + rtsx_pci_start_run(pcr); + +@@ -1154,8 +1147,6 @@ static int sdmmc_get_ro(struct mmc_host + if (val & SD_WRITE_PROTECT) + ro = 1; + +- pm_runtime_mark_last_busy(dev); +- pm_runtime_put_autosuspend(dev); + mutex_unlock(&pcr->pcr_mutex); + + return ro; +@@ -1173,7 +1164,6 @@ static int sdmmc_get_cd(struct mmc_host + return cd; + + mutex_lock(&pcr->pcr_mutex); +- pm_runtime_get_sync(dev); + + rtsx_pci_start_run(pcr); + +@@ -1183,8 +1173,6 @@ static int sdmmc_get_cd(struct mmc_host + if (val & SD_EXIST) + cd = 1; + +- pm_runtime_mark_last_busy(dev); +- pm_runtime_put_autosuspend(dev); + mutex_unlock(&pcr->pcr_mutex); + + return cd; +@@ -1282,7 +1270,6 @@ static int sdmmc_switch_voltage(struct m + return err; + + mutex_lock(&pcr->pcr_mutex); +- pm_runtime_get_sync(dev); + + rtsx_pci_start_run(pcr); + +@@ -1312,8 +1299,6 @@ out: + err = rtsx_pci_write_register(pcr, SD_BUS_STAT, + SD_CLK_TOGGLE_EN | SD_CLK_FORCE_STOP, 0); + +- pm_runtime_mark_last_busy(dev); +- pm_runtime_put_autosuspend(dev); + mutex_unlock(&pcr->pcr_mutex); + + return err; +@@ -1334,7 +1319,6 @@ static int sdmmc_execute_tuning(struct m + return err; + + mutex_lock(&pcr->pcr_mutex); +- pm_runtime_get_sync(dev); + + rtsx_pci_start_run(pcr); + +@@ -1367,8 +1351,6 @@ static int sdmmc_execute_tuning(struct m + err = sd_change_phase(host, DDR50_RX_PHASE(pcr), true); + + out: +- pm_runtime_mark_last_busy(dev); +- pm_runtime_put_autosuspend(dev); + mutex_unlock(&pcr->pcr_mutex); + + return err; diff --git a/queue-5.16/revert-nbd-fix-possible-overflow-on-first_minor-in-nbd_dev_add.patch b/queue-5.16/revert-nbd-fix-possible-overflow-on-first_minor-in-nbd_dev_add.patch new file mode 100644 index 00000000000..ca398d71e77 --- /dev/null +++ b/queue-5.16/revert-nbd-fix-possible-overflow-on-first_minor-in-nbd_dev_add.patch @@ -0,0 +1,69 @@ +From 7198bfc2017644c6b92d2ecef9b8b8e0363bb5fd Mon Sep 17 00:00:00 2001 +From: Jens Axboe +Date: Sat, 2 Apr 2022 11:40:23 -0600 +Subject: Revert "nbd: fix possible overflow on 'first_minor' in nbd_dev_add()" + +From: Jens Axboe + +commit 7198bfc2017644c6b92d2ecef9b8b8e0363bb5fd upstream. + +This reverts commit 6d35d04a9e18990040e87d2bbf72689252669d54. + +Both Gabriel and Borislav report that this commit casues a regression +with nbd: + +sysfs: cannot create duplicate filename '/dev/block/43:0' + +Revert it before 5.18-rc1 and we'll investigage this separately in +due time. + +Link: https://lore.kernel.org/all/YkiJTnFOt9bTv6A2@zn.tnic/ +Reported-by: Gabriel L. Somlo +Reported-by: Borislav Petkov +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + drivers/block/nbd.c | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +--- a/drivers/block/nbd.c ++++ b/drivers/block/nbd.c +@@ -1800,6 +1800,17 @@ static struct nbd_device *nbd_dev_add(in + refcount_set(&nbd->refs, 0); + INIT_LIST_HEAD(&nbd->list); + disk->major = NBD_MAJOR; ++ ++ /* Too big first_minor can cause duplicate creation of ++ * sysfs files/links, since index << part_shift might overflow, or ++ * MKDEV() expect that the max bits of first_minor is 20. ++ */ ++ disk->first_minor = index << part_shift; ++ if (disk->first_minor < index || disk->first_minor > MINORMASK) { ++ err = -EINVAL; ++ goto out_free_work; ++ } ++ + disk->minors = 1 << part_shift; + disk->fops = &nbd_fops; + disk->private_data = nbd; +@@ -1904,19 +1915,8 @@ static int nbd_genl_connect(struct sk_bu + if (!netlink_capable(skb, CAP_SYS_ADMIN)) + return -EPERM; + +- if (info->attrs[NBD_ATTR_INDEX]) { ++ if (info->attrs[NBD_ATTR_INDEX]) + index = nla_get_u32(info->attrs[NBD_ATTR_INDEX]); +- +- /* +- * Too big first_minor can cause duplicate creation of +- * sysfs files/links, since index << part_shift might overflow, or +- * MKDEV() expect that the max bits of first_minor is 20. +- */ +- if (index < 0 || index > MINORMASK >> part_shift) { +- printk(KERN_ERR "nbd: illegal input index %d\n", index); +- return -EINVAL; +- } +- } + if (!info->attrs[NBD_ATTR_SOCKETS]) { + printk(KERN_ERR "nbd: must specify at least one socket\n"); + return -EINVAL; diff --git a/queue-5.16/series b/queue-5.16/series index cf191ac2f3b..a53dc013729 100644 --- a/queue-5.16/series +++ b/queue-5.16/series @@ -1007,3 +1007,6 @@ vdpa-mlx5-avoid-processing-works-if-workqueue-was-destroyed.patch openvswitch-fixed-nd-target-mask-field-in-the-flow-dump.patch torture-make-torture.sh-help-message-match-reality.patch n64cart-convert-bi_disk-to-bi_bdev-bd_disk-fix-build.patch +revert-nbd-fix-possible-overflow-on-first_minor-in-nbd_dev_add.patch +mmc-rtsx-let-mmc-core-handle-runtime-pm.patch +mmc-rtsx-fix-build-errors-warnings-for-unused-variable.patch