From: Greg Kroah-Hartman Date: Wed, 24 Nov 2021 08:32:32 +0000 (+0100) Subject: 5.10-stable patches X-Git-Tag: v5.15.5~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e67abb71ae739e701d9fae57466b7f1aaf5b485c;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: asoc-dapm-cover-regression-by-kctl-change-notification-fix.patch btrfs-update-device-path-inode-time-instead-of-bd_inode.patch fs-export-an-inode_update_time-helper.patch hugetlbfs-flush-tlbs-correctly-after-huge_pmd_unshare.patch ice-delete-always-true-check-of-pf-pointer.patch rdma-netlink-add-__maybe_unused-to-static-inline-in-c-file.patch selinux-fix-null-pointer-dereference-when-hashtab-allocation-fails.patch usb-max-3421-use-driver-data-instead-of-maintaining-a-list-of-bound-devices.patch x86-kconfig-fix-an-unused-variable-error-in-dell-smm-hwmon.patch --- diff --git a/queue-5.10/asoc-dapm-cover-regression-by-kctl-change-notification-fix.patch b/queue-5.10/asoc-dapm-cover-regression-by-kctl-change-notification-fix.patch new file mode 100644 index 00000000000..43025945722 --- /dev/null +++ b/queue-5.10/asoc-dapm-cover-regression-by-kctl-change-notification-fix.patch @@ -0,0 +1,82 @@ +From 827b0913a9d9d07a0c3e559dbb20ca4d6d285a54 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Fri, 5 Nov 2021 10:09:25 +0100 +Subject: ASoC: DAPM: Cover regression by kctl change notification fix + +From: Takashi Iwai + +commit 827b0913a9d9d07a0c3e559dbb20ca4d6d285a54 upstream. + +The recent fix for DAPM to correct the kctl change notification by the +commit 5af82c81b2c4 ("ASoC: DAPM: Fix missing kctl change +notifications") caused other regressions since it changed the behavior +of snd_soc_dapm_set_pin() that is called from several API functions. +Formerly it returned always 0 for success, but now it returns 0 or 1. + +This patch addresses it, restoring the old behavior of +snd_soc_dapm_set_pin() while keeping the fix in +snd_soc_dapm_put_pin_switch(). + +Fixes: 5af82c81b2c4 ("ASoC: DAPM: Fix missing kctl change notifications") +Reported-by: Yu-Hsuan Hsu +Cc: +Signed-off-by: Takashi Iwai +Link: https://lore.kernel.org/r/20211105090925.20575-1-tiwai@suse.de +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman +--- + sound/soc/soc-dapm.c | 29 +++++++++++++++++++++++------ + 1 file changed, 23 insertions(+), 6 deletions(-) + +--- a/sound/soc/soc-dapm.c ++++ b/sound/soc/soc-dapm.c +@@ -2555,8 +2555,13 @@ static struct snd_soc_dapm_widget *dapm_ + return NULL; + } + +-static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm, +- const char *pin, int status) ++/* ++ * set the DAPM pin status: ++ * returns 1 when the value has been updated, 0 when unchanged, or a negative ++ * error code; called from kcontrol put callback ++ */ ++static int __snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm, ++ const char *pin, int status) + { + struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); + int ret = 0; +@@ -2582,6 +2587,18 @@ static int snd_soc_dapm_set_pin(struct s + return ret; + } + ++/* ++ * similar as __snd_soc_dapm_set_pin(), but returns 0 when successful; ++ * called from several API functions below ++ */ ++static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm, ++ const char *pin, int status) ++{ ++ int ret = __snd_soc_dapm_set_pin(dapm, pin, status); ++ ++ return ret < 0 ? ret : 0; ++} ++ + /** + * snd_soc_dapm_sync_unlocked - scan and power dapm paths + * @dapm: DAPM context +@@ -3586,10 +3603,10 @@ int snd_soc_dapm_put_pin_switch(struct s + const char *pin = (const char *)kcontrol->private_value; + int ret; + +- if (ucontrol->value.integer.value[0]) +- ret = snd_soc_dapm_enable_pin(&card->dapm, pin); +- else +- ret = snd_soc_dapm_disable_pin(&card->dapm, pin); ++ mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); ++ ret = __snd_soc_dapm_set_pin(&card->dapm, pin, ++ !!ucontrol->value.integer.value[0]); ++ mutex_unlock(&card->dapm_mutex); + + snd_soc_dapm_sync(&card->dapm); + return ret; diff --git a/queue-5.10/btrfs-update-device-path-inode-time-instead-of-bd_inode.patch b/queue-5.10/btrfs-update-device-path-inode-time-instead-of-bd_inode.patch new file mode 100644 index 00000000000..09b125a869c --- /dev/null +++ b/queue-5.10/btrfs-update-device-path-inode-time-instead-of-bd_inode.patch @@ -0,0 +1,84 @@ +From 54fde91f52f515e0b1514f0f0fa146e87a672227 Mon Sep 17 00:00:00 2001 +From: Josef Bacik +Date: Thu, 14 Oct 2021 13:11:01 -0400 +Subject: btrfs: update device path inode time instead of bd_inode + +From: Josef Bacik + +commit 54fde91f52f515e0b1514f0f0fa146e87a672227 upstream. + +Christoph pointed out that I'm updating bdev->bd_inode for the device +time when we remove block devices from a btrfs file system, however this +isn't actually exposed to anything. The inode we want to update is the +one that's associated with the path to the device, usually on devtmpfs, +so that blkid notices the difference. + +We still don't want to do the blkdev_open, so use kern_path() to get the +path to the given device and do the update time on that inode. + +Fixes: 8f96a5bfa150 ("btrfs: update the bdev time directly when closing") +Reported-by: Christoph Hellwig +Signed-off-by: Josef Bacik +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman +--- + fs/btrfs/volumes.c | 21 +++++++++++++-------- + 1 file changed, 13 insertions(+), 8 deletions(-) + +--- a/fs/btrfs/volumes.c ++++ b/fs/btrfs/volumes.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + #include "misc.h" + #include "ctree.h" + #include "extent_map.h" +@@ -1871,18 +1872,22 @@ out: + /* + * Function to update ctime/mtime for a given device path. + * Mainly used for ctime/mtime based probe like libblkid. ++ * ++ * We don't care about errors here, this is just to be kind to userspace. + */ +-static void update_dev_time(struct block_device *bdev) ++static void update_dev_time(const char *device_path) + { +- struct inode *inode = bdev->bd_inode; ++ struct path path; + struct timespec64 now; ++ int ret; + +- /* Shouldn't happen but just in case. */ +- if (!inode) ++ ret = kern_path(device_path, LOOKUP_FOLLOW, &path); ++ if (ret) + return; + +- now = current_time(inode); +- generic_update_time(inode, &now, S_MTIME | S_CTIME); ++ now = current_time(d_inode(path.dentry)); ++ inode_update_time(d_inode(path.dentry), &now, S_MTIME | S_CTIME); ++ path_put(&path); + } + + static int btrfs_rm_dev_item(struct btrfs_device *device) +@@ -2057,7 +2062,7 @@ void btrfs_scratch_superblocks(struct bt + btrfs_kobject_uevent(bdev, KOBJ_CHANGE); + + /* Update ctime/mtime for device path for libblkid */ +- update_dev_time(bdev); ++ update_dev_time(device_path); + } + + int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path, +@@ -2700,7 +2705,7 @@ int btrfs_init_new_device(struct btrfs_f + btrfs_forget_devices(device_path); + + /* Update ctime/mtime for blkid or udev */ +- update_dev_time(bdev); ++ update_dev_time(device_path); + + return ret; + diff --git a/queue-5.10/fs-export-an-inode_update_time-helper.patch b/queue-5.10/fs-export-an-inode_update_time-helper.patch new file mode 100644 index 00000000000..96f20accf5b --- /dev/null +++ b/queue-5.10/fs-export-an-inode_update_time-helper.patch @@ -0,0 +1,69 @@ +From e60feb445fce9e51c1558a6aa7faf9dd5ded533b Mon Sep 17 00:00:00 2001 +From: Josef Bacik +Date: Thu, 14 Oct 2021 13:11:00 -0400 +Subject: fs: export an inode_update_time helper + +From: Josef Bacik + +commit e60feb445fce9e51c1558a6aa7faf9dd5ded533b upstream. + +If you already have an inode and need to update the time on the inode +there is no way to do this properly. Export this helper to allow file +systems to update time on the inode so the appropriate handler is +called, either ->update_time or generic_update_time. + +Signed-off-by: Josef Bacik +Reviewed-by: David Sterba +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman +--- + fs/inode.c | 7 ++++--- + include/linux/fs.h | 2 ++ + 2 files changed, 6 insertions(+), 3 deletions(-) + +--- a/fs/inode.c ++++ b/fs/inode.c +@@ -1772,12 +1772,13 @@ EXPORT_SYMBOL(generic_update_time); + * This does the actual work of updating an inodes time or version. Must have + * had called mnt_want_write() before calling this. + */ +-static int update_time(struct inode *inode, struct timespec64 *time, int flags) ++int inode_update_time(struct inode *inode, struct timespec64 *time, int flags) + { + if (inode->i_op->update_time) + return inode->i_op->update_time(inode, time, flags); + return generic_update_time(inode, time, flags); + } ++EXPORT_SYMBOL(inode_update_time); + + /** + * touch_atime - update the access time +@@ -1847,7 +1848,7 @@ void touch_atime(const struct path *path + * of the fs read only, e.g. subvolumes in Btrfs. + */ + now = current_time(inode); +- update_time(inode, &now, S_ATIME); ++ inode_update_time(inode, &now, S_ATIME); + __mnt_drop_write(mnt); + skip_update: + sb_end_write(inode->i_sb); +@@ -1991,7 +1992,7 @@ int file_update_time(struct file *file) + if (__mnt_want_write_file(file)) + return 0; + +- ret = update_time(inode, &now, sync_it); ++ ret = inode_update_time(inode, &now, sync_it); + __mnt_drop_write_file(file); + + return ret; +--- a/include/linux/fs.h ++++ b/include/linux/fs.h +@@ -2214,6 +2214,8 @@ enum file_time_flags { + + extern bool atime_needs_update(const struct path *, struct inode *); + extern void touch_atime(const struct path *); ++int inode_update_time(struct inode *inode, struct timespec64 *time, int flags); ++ + static inline void file_accessed(struct file *file) + { + if (!(file->f_flags & O_NOATIME)) diff --git a/queue-5.10/hugetlbfs-flush-tlbs-correctly-after-huge_pmd_unshare.patch b/queue-5.10/hugetlbfs-flush-tlbs-correctly-after-huge_pmd_unshare.patch new file mode 100644 index 00000000000..82dd47a5235 --- /dev/null +++ b/queue-5.10/hugetlbfs-flush-tlbs-correctly-after-huge_pmd_unshare.patch @@ -0,0 +1,83 @@ +From a4a118f2eead1d6c49e00765de89878288d4b890 Mon Sep 17 00:00:00 2001 +From: Nadav Amit +Date: Sun, 21 Nov 2021 12:40:07 -0800 +Subject: hugetlbfs: flush TLBs correctly after huge_pmd_unshare + +From: Nadav Amit + +commit a4a118f2eead1d6c49e00765de89878288d4b890 upstream. + +When __unmap_hugepage_range() calls to huge_pmd_unshare() succeed, a TLB +flush is missing. This TLB flush must be performed before releasing the +i_mmap_rwsem, in order to prevent an unshared PMDs page from being +released and reused before the TLB flush took place. + +Arguably, a comprehensive solution would use mmu_gather interface to +batch the TLB flushes and the PMDs page release, however it is not an +easy solution: (1) try_to_unmap_one() and try_to_migrate_one() also call +huge_pmd_unshare() and they cannot use the mmu_gather interface; and (2) +deferring the release of the page reference for the PMDs page until +after i_mmap_rwsem is dropeed can confuse huge_pmd_unshare() into +thinking PMDs are shared when they are not. + +Fix __unmap_hugepage_range() by adding the missing TLB flush, and +forcing a flush when unshare is successful. + +Fixes: 24669e58477e ("hugetlb: use mmu_gather instead of a temporary linked list for accumulating pages)" # 3.6 +Signed-off-by: Nadav Amit +Reviewed-by: Mike Kravetz +Cc: Aneesh Kumar K.V +Cc: KAMEZAWA Hiroyuki +Cc: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + mm/hugetlb.c | 23 +++++++++++++++++++---- + 1 file changed, 19 insertions(+), 4 deletions(-) + +--- a/mm/hugetlb.c ++++ b/mm/hugetlb.c +@@ -3913,6 +3913,7 @@ void __unmap_hugepage_range(struct mmu_g + struct hstate *h = hstate_vma(vma); + unsigned long sz = huge_page_size(h); + struct mmu_notifier_range range; ++ bool force_flush = false; + + WARN_ON(!is_vm_hugetlb_page(vma)); + BUG_ON(start & ~huge_page_mask(h)); +@@ -3941,10 +3942,8 @@ void __unmap_hugepage_range(struct mmu_g + ptl = huge_pte_lock(h, mm, ptep); + if (huge_pmd_unshare(mm, vma, &address, ptep)) { + spin_unlock(ptl); +- /* +- * We just unmapped a page of PMDs by clearing a PUD. +- * The caller's TLB flush range should cover this area. +- */ ++ tlb_flush_pmd_range(tlb, address & PUD_MASK, PUD_SIZE); ++ force_flush = true; + continue; + } + +@@ -4001,6 +4000,22 @@ void __unmap_hugepage_range(struct mmu_g + } + mmu_notifier_invalidate_range_end(&range); + tlb_end_vma(tlb, vma); ++ ++ /* ++ * If we unshared PMDs, the TLB flush was not recorded in mmu_gather. We ++ * could defer the flush until now, since by holding i_mmap_rwsem we ++ * guaranteed that the last refernece would not be dropped. But we must ++ * do the flushing before we return, as otherwise i_mmap_rwsem will be ++ * dropped and the last reference to the shared PMDs page might be ++ * dropped as well. ++ * ++ * In theory we could defer the freeing of the PMD pages as well, but ++ * huge_pmd_unshare() relies on the exact page_count for the PMD page to ++ * detect sharing, so we cannot defer the release of the page either. ++ * Instead, do flush now. ++ */ ++ if (force_flush) ++ tlb_flush_mmu_tlbonly(tlb); + } + + void __unmap_hugepage_range_final(struct mmu_gather *tlb, diff --git a/queue-5.10/ice-delete-always-true-check-of-pf-pointer.patch b/queue-5.10/ice-delete-always-true-check-of-pf-pointer.patch new file mode 100644 index 00000000000..e990a1652a0 --- /dev/null +++ b/queue-5.10/ice-delete-always-true-check-of-pf-pointer.patch @@ -0,0 +1,32 @@ +From 2ff04286a9569675948f39cec2c6ad47c3584633 Mon Sep 17 00:00:00 2001 +From: Leon Romanovsky +Date: Thu, 23 Sep 2021 21:12:52 +0300 +Subject: ice: Delete always true check of PF pointer + +From: Leon Romanovsky + +commit 2ff04286a9569675948f39cec2c6ad47c3584633 upstream. + +PF pointer is always valid when PCI core calls its .shutdown() and +.remove() callbacks. There is no need to check it again. + +Fixes: 837f08fdecbe ("ice: Add basic driver framework for Intel(R) E800 Series") +Signed-off-by: Leon Romanovsky +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/intel/ice/ice_main.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/net/ethernet/intel/ice/ice_main.c ++++ b/drivers/net/ethernet/intel/ice/ice_main.c +@@ -4361,9 +4361,6 @@ static void ice_remove(struct pci_dev *p + struct ice_pf *pf = pci_get_drvdata(pdev); + int i; + +- if (!pf) +- return; +- + for (i = 0; i < ICE_MAX_RESET_WAIT; i++) { + if (!ice_is_reset_in_progress(pf->state)) + break; diff --git a/queue-5.10/rdma-netlink-add-__maybe_unused-to-static-inline-in-c-file.patch b/queue-5.10/rdma-netlink-add-__maybe_unused-to-static-inline-in-c-file.patch new file mode 100644 index 00000000000..4f08a857d90 --- /dev/null +++ b/queue-5.10/rdma-netlink-add-__maybe_unused-to-static-inline-in-c-file.patch @@ -0,0 +1,37 @@ +From 83dde7498fefeb920b1def317421262317d178e5 Mon Sep 17 00:00:00 2001 +From: Leon Romanovsky +Date: Sun, 7 Nov 2021 08:40:47 +0200 +Subject: RDMA/netlink: Add __maybe_unused to static inline in C file + +From: Leon Romanovsky + +commit 83dde7498fefeb920b1def317421262317d178e5 upstream. + +Like other commits in the tree add __maybe_unused to a static inline in a +C file because some clang compilers will complain about unused code: + +>> drivers/infiniband/core/nldev.c:2543:1: warning: unused function '__chk_RDMA_NL_NLDEV' + MODULE_ALIAS_RDMA_NETLINK(RDMA_NL_NLDEV, 5); + ^ + +Fixes: e3bf14bdc17a ("rdma: Autoload netlink client modules") +Link: https://lore.kernel.org/r/4a8101919b765e01d7fde6f27fd572c958deeb4a.1636267207.git.leonro@nvidia.com +Reported-by: kernel test robot +Signed-off-by: Leon Romanovsky +Signed-off-by: Jason Gunthorpe +Signed-off-by: Greg Kroah-Hartman +--- + include/rdma/rdma_netlink.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/include/rdma/rdma_netlink.h ++++ b/include/rdma/rdma_netlink.h +@@ -30,7 +30,7 @@ enum rdma_nl_flags { + * constant as well and the compiler checks they are the same. + */ + #define MODULE_ALIAS_RDMA_NETLINK(_index, _val) \ +- static inline void __chk_##_index(void) \ ++ static inline void __maybe_unused __chk_##_index(void) \ + { \ + BUILD_BUG_ON(_index != _val); \ + } \ diff --git a/queue-5.10/selinux-fix-null-pointer-dereference-when-hashtab-allocation-fails.patch b/queue-5.10/selinux-fix-null-pointer-dereference-when-hashtab-allocation-fails.patch new file mode 100644 index 00000000000..4ae2462c161 --- /dev/null +++ b/queue-5.10/selinux-fix-null-pointer-dereference-when-hashtab-allocation-fails.patch @@ -0,0 +1,56 @@ +From dc27f3c5d10c58069672215787a96b4fae01818b Mon Sep 17 00:00:00 2001 +From: Ondrej Mosnacek +Date: Fri, 19 Nov 2021 14:45:20 +0100 +Subject: selinux: fix NULL-pointer dereference when hashtab allocation fails + +From: Ondrej Mosnacek + +commit dc27f3c5d10c58069672215787a96b4fae01818b upstream. + +When the hash table slot array allocation fails in hashtab_init(), +h->size is left initialized with a non-zero value, but the h->htable +pointer is NULL. This may then cause a NULL pointer dereference, since +the policydb code relies on the assumption that even after a failed +hashtab_init(), hashtab_map() and hashtab_destroy() can be safely called +on it. Yet, these detect an empty hashtab only by looking at the size. + +Fix this by making sure that hashtab_init() always leaves behind a valid +empty hashtab when the allocation fails. + +Cc: stable@vger.kernel.org +Fixes: 03414a49ad5f ("selinux: do not allocate hashtabs dynamically") +Signed-off-by: Ondrej Mosnacek +Signed-off-by: Paul Moore +Signed-off-by: Greg Kroah-Hartman +--- + security/selinux/ss/hashtab.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +--- a/security/selinux/ss/hashtab.c ++++ b/security/selinux/ss/hashtab.c +@@ -30,13 +30,20 @@ static u32 hashtab_compute_size(u32 nel) + + int hashtab_init(struct hashtab *h, u32 nel_hint) + { +- h->size = hashtab_compute_size(nel_hint); ++ u32 size = hashtab_compute_size(nel_hint); ++ ++ /* should already be zeroed, but better be safe */ + h->nel = 0; +- if (!h->size) +- return 0; ++ h->size = 0; ++ h->htable = NULL; + +- h->htable = kcalloc(h->size, sizeof(*h->htable), GFP_KERNEL); +- return h->htable ? 0 : -ENOMEM; ++ if (size) { ++ h->htable = kcalloc(size, sizeof(*h->htable), GFP_KERNEL); ++ if (!h->htable) ++ return -ENOMEM; ++ h->size = size; ++ } ++ return 0; + } + + int __hashtab_insert(struct hashtab *h, struct hashtab_node **dst, diff --git a/queue-5.10/series b/queue-5.10/series index 4da8eb2ab63..3f431a72a2e 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -144,3 +144,12 @@ drm-i915-dp-ensure-sink-rate-values-are-always-valid.patch drm-amdgpu-fix-set-scaling-mode-full-full-aspect-center-not-works-on-vga-and-dvi-connectors.patch scsi-ufs-core-fix-task-management-completion.patch scsi-ufs-core-fix-task-management-completion-timeout-race.patch +hugetlbfs-flush-tlbs-correctly-after-huge_pmd_unshare.patch +rdma-netlink-add-__maybe_unused-to-static-inline-in-c-file.patch +selinux-fix-null-pointer-dereference-when-hashtab-allocation-fails.patch +asoc-dapm-cover-regression-by-kctl-change-notification-fix.patch +usb-max-3421-use-driver-data-instead-of-maintaining-a-list-of-bound-devices.patch +ice-delete-always-true-check-of-pf-pointer.patch +fs-export-an-inode_update_time-helper.patch +btrfs-update-device-path-inode-time-instead-of-bd_inode.patch +x86-kconfig-fix-an-unused-variable-error-in-dell-smm-hwmon.patch diff --git a/queue-5.10/usb-max-3421-use-driver-data-instead-of-maintaining-a-list-of-bound-devices.patch b/queue-5.10/usb-max-3421-use-driver-data-instead-of-maintaining-a-list-of-bound-devices.patch new file mode 100644 index 00000000000..ada947ab1e6 --- /dev/null +++ b/queue-5.10/usb-max-3421-use-driver-data-instead-of-maintaining-a-list-of-bound-devices.patch @@ -0,0 +1,98 @@ +From fc153aba3ef371d0d76eb88230ed4e0dee5b38f2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= +Date: Mon, 18 Oct 2021 22:40:28 +0200 +Subject: usb: max-3421: Use driver data instead of maintaining a list of bound devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +commit fc153aba3ef371d0d76eb88230ed4e0dee5b38f2 upstream. + +Instead of maintaining a single-linked list of devices that must be +searched linearly in .remove() just use spi_set_drvdata() to remember the +link between the spi device and the driver struct. Then the global list +and the next member can be dropped. + +This simplifies the driver, reduces the memory footprint and the time to +search the list. Also it makes obvious that there is always a corresponding +driver struct for a given device in .remove(), so the error path for +!max3421_hcd can be dropped, too. + +As a side effect this fixes a data inconsistency when .probe() races with +itself for a second max3421 device in manipulating max3421_hcd_list. A +similar race is fixed in .remove(), too. + +Fixes: 2d53139f3162 ("Add support for using a MAX3421E chip as a host driver.") +Signed-off-by: Uwe Kleine-König +Link: https://lore.kernel.org/r/20211018204028.2914597-1-u.kleine-koenig@pengutronix.de +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/host/max3421-hcd.c | 25 +++++-------------------- + 1 file changed, 5 insertions(+), 20 deletions(-) + +--- a/drivers/usb/host/max3421-hcd.c ++++ b/drivers/usb/host/max3421-hcd.c +@@ -125,8 +125,6 @@ struct max3421_hcd { + + struct task_struct *spi_thread; + +- struct max3421_hcd *next; +- + enum max3421_rh_state rh_state; + /* lower 16 bits contain port status, upper 16 bits the change mask: */ + u32 port_status; +@@ -174,8 +172,6 @@ struct max3421_ep { + u8 retransmit; /* packet needs retransmission */ + }; + +-static struct max3421_hcd *max3421_hcd_list; +- + #define MAX3421_FIFO_SIZE 64 + + #define MAX3421_SPI_DIR_RD 0 /* read register from MAX3421 */ +@@ -1882,9 +1878,8 @@ max3421_probe(struct spi_device *spi) + } + set_bit(HCD_FLAG_POLL_RH, &hcd->flags); + max3421_hcd = hcd_to_max3421(hcd); +- max3421_hcd->next = max3421_hcd_list; +- max3421_hcd_list = max3421_hcd; + INIT_LIST_HEAD(&max3421_hcd->ep_list); ++ spi_set_drvdata(spi, max3421_hcd); + + max3421_hcd->tx = kmalloc(sizeof(*max3421_hcd->tx), GFP_KERNEL); + if (!max3421_hcd->tx) +@@ -1934,28 +1929,18 @@ error: + static int + max3421_remove(struct spi_device *spi) + { +- struct max3421_hcd *max3421_hcd = NULL, **prev; +- struct usb_hcd *hcd = NULL; ++ struct max3421_hcd *max3421_hcd; ++ struct usb_hcd *hcd; + unsigned long flags; + +- for (prev = &max3421_hcd_list; *prev; prev = &(*prev)->next) { +- max3421_hcd = *prev; +- hcd = max3421_to_hcd(max3421_hcd); +- if (hcd->self.controller == &spi->dev) +- break; +- } +- if (!max3421_hcd) { +- dev_err(&spi->dev, "no MAX3421 HCD found for SPI device %p\n", +- spi); +- return -ENODEV; +- } ++ max3421_hcd = spi_get_drvdata(spi); ++ hcd = max3421_to_hcd(max3421_hcd); + + usb_remove_hcd(hcd); + + spin_lock_irqsave(&max3421_hcd->lock, flags); + + kthread_stop(max3421_hcd->spi_thread); +- *prev = max3421_hcd->next; + + spin_unlock_irqrestore(&max3421_hcd->lock, flags); + diff --git a/queue-5.10/x86-kconfig-fix-an-unused-variable-error-in-dell-smm-hwmon.patch b/queue-5.10/x86-kconfig-fix-an-unused-variable-error-in-dell-smm-hwmon.patch new file mode 100644 index 00000000000..fe4add40392 --- /dev/null +++ b/queue-5.10/x86-kconfig-fix-an-unused-variable-error-in-dell-smm-hwmon.patch @@ -0,0 +1,50 @@ +From ef775a0e36c6a81c5b07cb228c02f967133fe768 Mon Sep 17 00:00:00 2001 +From: Randy Dunlap +Date: Fri, 10 Sep 2021 00:19:21 -0700 +Subject: x86/Kconfig: Fix an unused variable error in dell-smm-hwmon +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Randy Dunlap + +commit ef775a0e36c6a81c5b07cb228c02f967133fe768 upstream. + +When CONFIG_PROC_FS is not set, there is a build warning (turned +into an error): + + ../drivers/hwmon/dell-smm-hwmon.c: In function 'i8k_init_procfs': + ../drivers/hwmon/dell-smm-hwmon.c:624:24: error: unused variable 'data' [-Werror=unused-variable] + struct dell_smm_data *data = dev_get_drvdata(dev); + +Make I8K depend on PROC_FS and HWMON (instead of selecting HWMON -- it +is strongly preferred to not select entire subsystems). + +Build tested in all possible combinations of SENSORS_DELL_SMM, I8K, and +PROC_FS. + +Fixes: 039ae58503f3 ("hwmon: Allow to compile dell-smm-hwmon driver without /proc/i8k") +Reported-by: Arnd Bergmann +Signed-off-by: Randy Dunlap +Signed-off-by: Borislav Petkov +Reviewed-by: Arnd Bergmann +Acked-by: Guenter Roeck +Acked-by: Pali Rohár +Link: https://lkml.kernel.org/r/20210910071921.16777-1-rdunlap@infradead.org +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/Kconfig | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -1266,7 +1266,8 @@ config TOSHIBA + + config I8K + tristate "Dell i8k legacy laptop support" +- select HWMON ++ depends on HWMON ++ depends on PROC_FS + select SENSORS_DELL_SMM + help + This option enables legacy /proc/i8k userspace interface in hwmon