Skip to content

Commit 513fc69

Browse files
committed
Merge tag 'i2c-for-6.16-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: - qup: avoid potential hang when waiting for bus idle - tegra: improve ACPI reset error handling - virtio: use interruptible wait to prevent hang during transfer * tag 'i2c-for-6.16-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: qup: jump out of the loop in case of timeout i2c: virtio: Avoid hang by using interruptible completion wait i2c: tegra: Fix reset error handling with ACPI
2 parents 8748859 + 31f0884 commit 513fc69

File tree

3 files changed

+12
-31
lines changed

3 files changed

+12
-31
lines changed

drivers/i2c/busses/i2c-qup.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,10 @@ static int qup_i2c_bus_active(struct qup_i2c_dev *qup, int len)
452452
if (!(status & I2C_STATUS_BUS_ACTIVE))
453453
break;
454454

455-
if (time_after(jiffies, timeout))
455+
if (time_after(jiffies, timeout)) {
456456
ret = -ETIMEDOUT;
457+
break;
458+
}
457459

458460
usleep_range(len, len * 2);
459461
}

drivers/i2c/busses/i2c-tegra.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,6 @@ static int tegra_i2c_wait_for_config_load(struct tegra_i2c_dev *i2c_dev)
607607
static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
608608
{
609609
u32 val, clk_divisor, clk_multiplier, tsu_thd, tlow, thigh, non_hs_mode;
610-
acpi_handle handle = ACPI_HANDLE(i2c_dev->dev);
611610
struct i2c_timings *t = &i2c_dev->timings;
612611
int err;
613612

@@ -619,11 +618,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
619618
* emit a noisy warning on error, which won't stay unnoticed and
620619
* won't hose machine entirely.
621620
*/
622-
if (handle)
623-
err = acpi_evaluate_object(handle, "_RST", NULL, NULL);
624-
else
625-
err = reset_control_reset(i2c_dev->rst);
626-
621+
err = device_reset(i2c_dev->dev);
627622
WARN_ON_ONCE(err);
628623

629624
if (IS_DVC(i2c_dev))
@@ -1666,19 +1661,6 @@ static void tegra_i2c_parse_dt(struct tegra_i2c_dev *i2c_dev)
16661661
i2c_dev->is_vi = true;
16671662
}
16681663

1669-
static int tegra_i2c_init_reset(struct tegra_i2c_dev *i2c_dev)
1670-
{
1671-
if (ACPI_HANDLE(i2c_dev->dev))
1672-
return 0;
1673-
1674-
i2c_dev->rst = devm_reset_control_get_exclusive(i2c_dev->dev, "i2c");
1675-
if (IS_ERR(i2c_dev->rst))
1676-
return dev_err_probe(i2c_dev->dev, PTR_ERR(i2c_dev->rst),
1677-
"failed to get reset control\n");
1678-
1679-
return 0;
1680-
}
1681-
16821664
static int tegra_i2c_init_clocks(struct tegra_i2c_dev *i2c_dev)
16831665
{
16841666
int err;
@@ -1788,10 +1770,6 @@ static int tegra_i2c_probe(struct platform_device *pdev)
17881770

17891771
tegra_i2c_parse_dt(i2c_dev);
17901772

1791-
err = tegra_i2c_init_reset(i2c_dev);
1792-
if (err)
1793-
return err;
1794-
17951773
err = tegra_i2c_init_clocks(i2c_dev);
17961774
if (err)
17971775
return err;

drivers/i2c/busses/i2c-virtio.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,16 @@ static int virtio_i2c_complete_reqs(struct virtqueue *vq,
116116
for (i = 0; i < num; i++) {
117117
struct virtio_i2c_req *req = &reqs[i];
118118

119-
wait_for_completion(&req->completion);
120-
121-
if (!failed && req->in_hdr.status != VIRTIO_I2C_MSG_OK)
122-
failed = true;
119+
if (!failed) {
120+
if (wait_for_completion_interruptible(&req->completion))
121+
failed = true;
122+
else if (req->in_hdr.status != VIRTIO_I2C_MSG_OK)
123+
failed = true;
124+
else
125+
j++;
126+
}
123127

124128
i2c_put_dma_safe_msg_buf(reqs[i].buf, &msgs[i], !failed);
125-
126-
if (!failed)
127-
j++;
128129
}
129130

130131
return j;

0 commit comments

Comments
 (0)