Skip to content

Commit

Permalink
Merge tag 'char-misc-5.4-rc7' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/gregkh/char-misc

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
  • Loading branch information
Linus Torvalds committed Nov 10, 2019
2 parents a5871fc + 9d55499 commit 3de2a3e
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 26 deletions.
3 changes: 3 additions & 0 deletions drivers/hwtracing/intel_th/gth.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,9 @@ static void intel_th_gth_switch(struct intel_th_device *thdev,
if (!count)
dev_dbg(&thdev->dev, "timeout waiting for CTS Trigger\n");

/* De-assert the trigger */
iowrite32(0, gth->base + REG_CTS_CTL);

intel_th_gth_stop(gth, output, false);
intel_th_gth_start(gth, output);
}
Expand Down
11 changes: 8 additions & 3 deletions drivers/hwtracing/intel_th/msu.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ struct msc {
};

static LIST_HEAD(msu_buffer_list);
static struct mutex msu_buffer_mutex;
static DEFINE_MUTEX(msu_buffer_mutex);

/**
* struct msu_buffer_entry - internal MSU buffer bookkeeping
Expand Down Expand Up @@ -327,7 +327,7 @@ static size_t msc_win_total_sz(struct msc_window *win)
struct msc_block_desc *bdesc = sg_virt(sg);

if (msc_block_wrapped(bdesc))
return win->nr_blocks << PAGE_SHIFT;
return (size_t)win->nr_blocks << PAGE_SHIFT;

size += msc_total_sz(bdesc);
if (msc_block_last_written(bdesc))
Expand Down Expand Up @@ -1848,9 +1848,14 @@ mode_store(struct device *dev, struct device_attribute *attr, const char *buf,
len = cp - buf;

mode = kstrndup(buf, len, GFP_KERNEL);
if (!mode)
return -ENOMEM;

i = match_string(msc_mode, ARRAY_SIZE(msc_mode), mode);
if (i >= 0)
if (i >= 0) {
kfree(mode);
goto found;
}

/* Buffer sinks only work with a usable IRQ */
if (!msc->do_irq) {
Expand Down
10 changes: 10 additions & 0 deletions drivers/hwtracing/intel_th/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = {
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x02a6),
.driver_data = (kernel_ulong_t)&intel_th_2x,
},
{
/* Comet Lake PCH */
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x06a6),
.driver_data = (kernel_ulong_t)&intel_th_2x,
},
{
/* Ice Lake NNPI */
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x45c5),
Expand All @@ -209,6 +214,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = {
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa0a6),
.driver_data = (kernel_ulong_t)&intel_th_2x,
},
{
/* Jasper Lake PCH */
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4da6),
.driver_data = (kernel_ulong_t)&intel_th_2x,
},
{ 0 },
};

Expand Down
4 changes: 4 additions & 0 deletions drivers/interconnect/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,12 @@ void icc_set_tag(struct icc_path *path, u32 tag)
if (!path)
return;

mutex_lock(&icc_lock);

for (i = 0; i < path->num_nodes; i++)
path->reqs[i].tag = tag;

mutex_unlock(&icc_lock);
}
EXPORT_SYMBOL_GPL(icc_set_tag);

Expand Down
3 changes: 2 additions & 1 deletion drivers/interconnect/qcom/qcs404.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ static int qnoc_probe(struct platform_device *pdev)
if (!qp)
return -ENOMEM;

data = devm_kcalloc(dev, num_nodes, sizeof(*node), GFP_KERNEL);
data = devm_kzalloc(dev, struct_size(data, nodes, num_nodes),
GFP_KERNEL);
if (!data)
return -ENOMEM;

Expand Down
3 changes: 2 additions & 1 deletion drivers/interconnect/qcom/sdm845.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,8 @@ static int qnoc_probe(struct platform_device *pdev)
if (!qp)
return -ENOMEM;

data = devm_kcalloc(&pdev->dev, num_nodes, sizeof(*node), GFP_KERNEL);
data = devm_kzalloc(&pdev->dev, struct_size(data, nodes, num_nodes),
GFP_KERNEL);
if (!data)
return -ENOMEM;

Expand Down
1 change: 1 addition & 0 deletions drivers/soundwire/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

menuconfig SOUNDWIRE
tristate "SoundWire support"
depends on ACPI || OF
help
SoundWire is a 2-Pin interface with data and clock line ratified
by the MIPI Alliance. SoundWire is used for transporting data
Expand Down
4 changes: 2 additions & 2 deletions drivers/soundwire/intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ static int intel_register_dai(struct sdw_intel *sdw)
/* Create PCM DAIs */
stream = &cdns->pcm;

ret = intel_create_dai(cdns, dais, INTEL_PDI_IN, stream->num_in,
ret = intel_create_dai(cdns, dais, INTEL_PDI_IN, cdns->pcm.num_in,
off, stream->num_ch_in, true);
if (ret)
return ret;
Expand Down Expand Up @@ -931,7 +931,7 @@ static int intel_register_dai(struct sdw_intel *sdw)
if (ret)
return ret;

off += cdns->pdm.num_bd;
off += cdns->pdm.num_out;
ret = intel_create_dai(cdns, dais, INTEL_PDI_BD, cdns->pdm.num_bd,
off, stream->num_ch_bd, false);
if (ret)
Expand Down
3 changes: 2 additions & 1 deletion drivers/soundwire/slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ int sdw_of_find_slaves(struct sdw_bus *bus)
struct device_node *node;

for_each_child_of_node(bus->dev->of_node, node) {
int link_id, sdw_version, ret, len;
int link_id, ret, len;
unsigned int sdw_version;
const char *compat = NULL;
struct sdw_slave_id id;
const __be32 *addr;
Expand Down
1 change: 0 additions & 1 deletion drivers/thunderbolt/nhi_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ static void icl_nhi_lc_mailbox_cmd(struct tb_nhi *nhi, enum icl_lc_mailbox_cmd c
{
u32 data;

pci_read_config_dword(nhi->pdev, VS_CAP_19, &data);
data = (cmd << VS_CAP_19_CMD_SHIFT) & VS_CAP_19_CMD_MASK;
pci_write_config_dword(nhi->pdev, VS_CAP_19, data | VS_CAP_19_VALID);
}
Expand Down
28 changes: 11 additions & 17 deletions drivers/thunderbolt/switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,12 +896,13 @@ int tb_dp_port_set_hops(struct tb_port *port, unsigned int video,
*/
bool tb_dp_port_is_enabled(struct tb_port *port)
{
u32 data;
u32 data[2];

if (tb_port_read(port, &data, TB_CFG_PORT, port->cap_adap, 1))
if (tb_port_read(port, data, TB_CFG_PORT, port->cap_adap,
ARRAY_SIZE(data)))
return false;

return !!(data & (TB_DP_VIDEO_EN | TB_DP_AUX_EN));
return !!(data[0] & (TB_DP_VIDEO_EN | TB_DP_AUX_EN));
}

/**
Expand All @@ -914,19 +915,21 @@ bool tb_dp_port_is_enabled(struct tb_port *port)
*/
int tb_dp_port_enable(struct tb_port *port, bool enable)
{
u32 data;
u32 data[2];
int ret;

ret = tb_port_read(port, &data, TB_CFG_PORT, port->cap_adap, 1);
ret = tb_port_read(port, data, TB_CFG_PORT, port->cap_adap,
ARRAY_SIZE(data));
if (ret)
return ret;

if (enable)
data |= TB_DP_VIDEO_EN | TB_DP_AUX_EN;
data[0] |= TB_DP_VIDEO_EN | TB_DP_AUX_EN;
else
data &= ~(TB_DP_VIDEO_EN | TB_DP_AUX_EN);
data[0] &= ~(TB_DP_VIDEO_EN | TB_DP_AUX_EN);

return tb_port_write(port, &data, TB_CFG_PORT, port->cap_adap, 1);
return tb_port_write(port, data, TB_CFG_PORT, port->cap_adap,
ARRAY_SIZE(data));
}

/* switch utility functions */
Expand Down Expand Up @@ -1031,13 +1034,6 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val)
if (sw->authorized)
goto unlock;

/*
* Make sure there is no PCIe rescan ongoing when a new PCIe
* tunnel is created. Otherwise the PCIe rescan code might find
* the new tunnel too early.
*/
pci_lock_rescan_remove();

switch (val) {
/* Approve switch */
case 1:
Expand All @@ -1057,8 +1053,6 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val)
break;
}

pci_unlock_rescan_remove();

if (!ret) {
sw->authorized = val;
/* Notify status change to the userspace */
Expand Down

0 comments on commit 3de2a3e

Please sign in to comment.