Pull char/misc driver fixes from Greg KH: "Here are a number of late-arrival driver fixes for issues reported for some char/misc drivers for 5.4-rc7 These all come from the different subsystem/driver maintainers as things that they had reports for and wanted to see fixed. All of these have been in linux-next with no reported issues" * tag 'char-misc-5.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: intel_th: pci: Add Jasper Lake PCH support intel_th: pci: Add Comet Lake PCH support intel_th: msu: Fix possible memory leak in mode_store() intel_th: msu: Fix overflow in shift of an unsigned int intel_th: msu: Fix missing allocation failure check on a kstrndup intel_th: msu: Fix an uninitialized mutex intel_th: gth: Fix the window switching sequence soundwire: slave: fix scanf format soundwire: intel: fix intel_register_dai PDI offsets and numbers interconnect: Add locking in icc_set_tag() interconnect: qcom: Fix icc_onecell_data allocation soundwire: depend on ACPI || OF soundwire: depend on ACPI thunderbolt: Drop unnecessary read when writing LC command in Ice Lake thunderbolt: Fix lockdep circular locking depedency warning thunderbolt: Read DP IN adapter first two dwords in one go
Unified · Split
| @@ -626,6 +626,9 @@ static void intel_th_gth_switch(struct intel_th_device *thdev, · 625 unmodified lines | ||
| 626 | 626 | if (!count) |
| 627 | 627 | dev_dbg(&thdev->dev, "timeout waiting for CTS Trigger\n"); |
| 628 | 628 | |
| 629 | + /* De-assert the trigger */ | |
| 630 | + iowrite32(0, gth->base + REG_CTS_CTL); | |
| 631 | + | |
| 629 | 632 | intel_th_gth_stop(gth, output, false); |
| 630 | 633 | intel_th_gth_start(gth, output); |
| 631 | 634 | } |
| @@ -164,7 +164,7 @@ struct msc { · 163 unmodified lines | ||
| 164 | 164 | }; |
| 165 | 165 | |
| 166 | 166 | static LIST_HEAD(msu_buffer_list); |
| 167 | −static struct mutex msu_buffer_mutex; | |
| 167 | +static DEFINE_MUTEX(msu_buffer_mutex); | |
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | 170 | * struct msu_buffer_entry - internal MSU buffer bookkeeping |
| @@ -327,7 +327,7 @@ static size_t msc_win_total_sz(struct msc_window *win) · 156 unmodified lines | ||
| 327 | 327 | struct msc_block_desc *bdesc = sg_virt(sg); |
| 328 | 328 | |
| 329 | 329 | if (msc_block_wrapped(bdesc)) |
| 330 | − return win->nr_blocks << PAGE_SHIFT; | |
| 330 | + return (size_t)win->nr_blocks << PAGE_SHIFT; | |
| 331 | 331 | |
| 332 | 332 | size += msc_total_sz(bdesc); |
| 333 | 333 | if (msc_block_last_written(bdesc)) |
| @@ -1848,9 +1848,14 @@ mode_store(struct device *dev, struct device_attribute *attr, const char *buf, · 1514 unmodified lines | ||
| 1848 | 1848 | len = cp - buf; |
| 1849 | 1849 | |
| 1850 | 1850 | mode = kstrndup(buf, len, GFP_KERNEL); |
| 1851 | + if (!mode) | |
| 1852 | + return -ENOMEM; | |
| 1853 | + | |
| 1851 | 1854 | i = match_string(msc_mode, ARRAY_SIZE(msc_mode), mode); |
| 1852 | − if (i >= 0) | |
| 1855 | + if (i >= 0) { | |
| 1856 | + kfree(mode); | |
| 1853 | 1857 | goto found; |
| 1858 | + } | |
| 1854 | 1859 | |
| 1855 | 1860 | /* Buffer sinks only work with a usable IRQ */ |
| 1856 | 1861 | if (!msc->do_irq) { |
| @@ -199,6 +199,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { · 198 unmodified lines | ||
| 199 | 199 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x02a6), |
| 200 | 200 | .driver_data = (kernel_ulong_t)&intel_th_2x, |
| 201 | 201 | }, |
| 202 | + { | |
| 203 | + /* Comet Lake PCH */ | |
| 204 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x06a6), | |
| 205 | + .driver_data = (kernel_ulong_t)&intel_th_2x, | |
| 206 | + }, | |
| 202 | 207 | { |
| 203 | 208 | /* Ice Lake NNPI */ |
| 204 | 209 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x45c5), |
| @@ -209,6 +214,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { · 4 unmodified lines | ||
| 209 | 214 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa0a6), |
| 210 | 215 | .driver_data = (kernel_ulong_t)&intel_th_2x, |
| 211 | 216 | }, |
| 217 | + { | |
| 218 | + /* Jasper Lake PCH */ | |
| 219 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4da6), | |
| 220 | + .driver_data = (kernel_ulong_t)&intel_th_2x, | |
| 221 | + }, | |
| 212 | 222 | { 0 }, |
| 213 | 223 | }; |
| 214 | 224 | |
| @@ -405,8 +405,12 @@ void icc_set_tag(struct icc_path *path, u32 tag) · 404 unmodified lines | ||
| 405 | 405 | if (!path) |
| 406 | 406 | return; |
| 407 | 407 | |
| 408 | + mutex_lock(&icc_lock); | |
| 409 | + | |
| 408 | 410 | for (i = 0; i < path->num_nodes; i++) |
| 409 | 411 | path->reqs[i].tag = tag; |
| 412 | + | |
| 413 | + mutex_unlock(&icc_lock); | |
| 410 | 414 | } |
| 411 | 415 | EXPORT_SYMBOL_GPL(icc_set_tag); |
| 412 | 416 | |
| @@ -433,7 +433,8 @@ static int qnoc_probe(struct platform_device *pdev) · 432 unmodified lines | ||
| 433 | 433 | if (!qp) |
| 434 | 434 | return -ENOMEM; |
| 435 | 435 | |
| 436 | − data = devm_kcalloc(dev, num_nodes, sizeof(*node), GFP_KERNEL); | |
| 436 | + data = devm_kzalloc(dev, struct_size(data, nodes, num_nodes), | |
| 437 | + GFP_KERNEL); | |
| 437 | 438 | if (!data) |
| 438 | 439 | return -ENOMEM; |
| 439 | 440 | |
| @@ -790,7 +790,8 @@ static int qnoc_probe(struct platform_device *pdev) · 789 unmodified lines | ||
| 790 | 790 | if (!qp) |
| 791 | 791 | return -ENOMEM; |
| 792 | 792 | |
| 793 | − data = devm_kcalloc(&pdev->dev, num_nodes, sizeof(*node), GFP_KERNEL); | |
| 793 | + data = devm_kzalloc(&pdev->dev, struct_size(data, nodes, num_nodes), | |
| 794 | + GFP_KERNEL); | |
| 794 | 795 | if (!data) |
| 795 | 796 | return -ENOMEM; |
| 796 | 797 | |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | |
| 6 | 6 | menuconfig SOUNDWIRE |
| 7 | 7 | tristate "SoundWire support" |
| 8 | + depends on ACPI || OF | |
| 8 | 9 | help |
| 9 | 10 | SoundWire is a 2-Pin interface with data and clock line ratified |
| 10 | 11 | by the MIPI Alliance. SoundWire is used for transporting data |
| @@ -900,7 +900,7 @@ static int intel_register_dai(struct sdw_intel *sdw) · 899 unmodified lines | ||
| 900 | 900 | /* Create PCM DAIs */ |
| 901 | 901 | stream = &cdns->pcm; |
| 902 | 902 | |
| 903 | − ret = intel_create_dai(cdns, dais, INTEL_PDI_IN, stream->num_in, | |
| 903 | + ret = intel_create_dai(cdns, dais, INTEL_PDI_IN, cdns->pcm.num_in, | |
| 904 | 904 | off, stream->num_ch_in, true); |
| 905 | 905 | if (ret) |
| 906 | 906 | return ret; |
| @@ -931,7 +931,7 @@ static int intel_register_dai(struct sdw_intel *sdw) · 24 unmodified lines | ||
| 931 | 931 | if (ret) |
| 932 | 932 | return ret; |
| 933 | 933 | |
| 934 | − off += cdns->pdm.num_bd; | |
| 934 | + off += cdns->pdm.num_out; | |
| 935 | 935 | ret = intel_create_dai(cdns, dais, INTEL_PDI_BD, cdns->pdm.num_bd, |
| 936 | 936 | off, stream->num_ch_bd, false); |
| 937 | 937 | if (ret) |
| @@ -128,7 +128,8 @@ int sdw_of_find_slaves(struct sdw_bus *bus) · 127 unmodified lines | ||
| 128 | 128 | struct device_node *node; |
| 129 | 129 | |
| 130 | 130 | for_each_child_of_node(bus->dev->of_node, node) { |
| 131 | − int link_id, sdw_version, ret, len; | |
| 131 | + int link_id, ret, len; | |
| 132 | + unsigned int sdw_version; | |
| 132 | 133 | const char *compat = NULL; |
| 133 | 134 | struct sdw_slave_id id; |
| 134 | 135 | const __be32 *addr; |
| @@ -80,7 +80,6 @@ static void icl_nhi_lc_mailbox_cmd(struct tb_nhi *nhi, enum icl_lc_mailbox_cmd c · 79 unmodified lines | ||
| 80 | 80 | { |
| 81 | 81 | u32 data; |
| 82 | 82 | |
| 83 | − pci_read_config_dword(nhi->pdev, VS_CAP_19, &data); | |
| 84 | 83 | data = (cmd << VS_CAP_19_CMD_SHIFT) & VS_CAP_19_CMD_MASK; |
| 85 | 84 | pci_write_config_dword(nhi->pdev, VS_CAP_19, data | VS_CAP_19_VALID); |
| 86 | 85 | } |
| @@ -896,12 +896,13 @@ int tb_dp_port_set_hops(struct tb_port *port, unsigned int video, · 895 unmodified lines | ||
| 896 | 896 | */ |
| 897 | 897 | bool tb_dp_port_is_enabled(struct tb_port *port) |
| 898 | 898 | { |
| 899 | − u32 data; | |
| 899 | + u32 data[2]; | |
| 900 | 900 | |
| 901 | − if (tb_port_read(port, &data, TB_CFG_PORT, port->cap_adap, 1)) | |
| 901 | + if (tb_port_read(port, data, TB_CFG_PORT, port->cap_adap, | |
| 902 | + ARRAY_SIZE(data))) | |
| 902 | 903 | return false; |
| 903 | 904 | |
| 904 | − return !!(data & (TB_DP_VIDEO_EN | TB_DP_AUX_EN)); | |
| 905 | + return !!(data[0] & (TB_DP_VIDEO_EN | TB_DP_AUX_EN)); | |
| 905 | 906 | } |
| 906 | 907 | |
| 907 | 908 | /** |
| @@ -914,19 +915,21 @@ bool tb_dp_port_is_enabled(struct tb_port *port) · 6 unmodified lines | ||
| 914 | 915 | */ |
| 915 | 916 | int tb_dp_port_enable(struct tb_port *port, bool enable) |
| 916 | 917 | { |
| 917 | − u32 data; | |
| 918 | + u32 data[2]; | |
| 918 | 919 | int ret; |
| 919 | 920 | |
| 920 | − ret = tb_port_read(port, &data, TB_CFG_PORT, port->cap_adap, 1); | |
| 921 | + ret = tb_port_read(port, data, TB_CFG_PORT, port->cap_adap, | |
| 922 | + ARRAY_SIZE(data)); | |
| 921 | 923 | if (ret) |
| 922 | 924 | return ret; |
| 923 | 925 | |
| 924 | 926 | if (enable) |
| 925 | − data |= TB_DP_VIDEO_EN | TB_DP_AUX_EN; | |
| 927 | + data[0] |= TB_DP_VIDEO_EN | TB_DP_AUX_EN; | |
| 926 | 928 | else |
| 927 | − data &= ~(TB_DP_VIDEO_EN | TB_DP_AUX_EN); | |
| 929 | + data[0] &= ~(TB_DP_VIDEO_EN | TB_DP_AUX_EN); | |
| 928 | 930 | |
| 929 | − return tb_port_write(port, &data, TB_CFG_PORT, port->cap_adap, 1); | |
| 931 | + return tb_port_write(port, data, TB_CFG_PORT, port->cap_adap, | |
| 932 | + ARRAY_SIZE(data)); | |
| 930 | 933 | } |
| 931 | 934 | |
| 932 | 935 | /* switch utility functions */ |
| @@ -1031,13 +1034,6 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val) · 98 unmodified lines | ||
| 1031 | 1034 | if (sw->authorized) |
| 1032 | 1035 | goto unlock; |
| 1033 | 1036 | |
| 1034 | − /* | |
| 1035 | − * Make sure there is no PCIe rescan ongoing when a new PCIe | |
| 1036 | − * tunnel is created. Otherwise the PCIe rescan code might find | |
| 1037 | − * the new tunnel too early. | |
| 1038 | − */ | |
| 1039 | − pci_lock_rescan_remove(); | |
| 1040 | − | |
| 1041 | 1037 | switch (val) { |
| 1042 | 1038 | /* Approve switch */ |
| 1043 | 1039 | case 1: |
| @@ -1057,8 +1053,6 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val) · 13 unmodified lines | ||
| 1057 | 1053 | break; |
| 1058 | 1054 | } |
| 1059 | 1055 | |
| 1060 | − pci_unlock_rescan_remove(); | |
| 1061 | − | |
| 1062 | 1056 | if (!ret) { |
| 1063 | 1057 | sw->authorized = val; |
| 1064 | 1058 | /* Notify status change to the userspace */ |