Skip to content

Commit bd8f3bf

Browse files
committed
Merge tag 'i2c-for-6.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: - i801: drop superfluous WDT entry for Birch - rtl9300: - fix channel number check in probe - check data length boundaries in xfer - drop broken SMBus quick operation * tag 'i2c-for-6.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: rtl9300: remove broken SMBus Quick operation support i2c: rtl9300: ensure data length is within supported range i2c: rtl9300: fix channel number bound check i2c: i801: Hide Intel Birch Stream SoC TCO WDT
2 parents 2c3bac6 + d035b4b commit bd8f3bf

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

drivers/i2c/busses/i2c-i801.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ static const struct pci_device_id i801_ids[] = {
10521052
{ PCI_DEVICE_DATA(INTEL, METEOR_LAKE_P_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) },
10531053
{ PCI_DEVICE_DATA(INTEL, METEOR_LAKE_SOC_S_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) },
10541054
{ PCI_DEVICE_DATA(INTEL, METEOR_LAKE_PCH_S_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) },
1055-
{ PCI_DEVICE_DATA(INTEL, BIRCH_STREAM_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) },
1055+
{ PCI_DEVICE_DATA(INTEL, BIRCH_STREAM_SMBUS, FEATURES_ICH5) },
10561056
{ PCI_DEVICE_DATA(INTEL, ARROW_LAKE_H_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) },
10571057
{ PCI_DEVICE_DATA(INTEL, PANTHER_LAKE_H_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) },
10581058
{ PCI_DEVICE_DATA(INTEL, PANTHER_LAKE_P_SMBUS, FEATURES_ICH5 | FEATURE_TCO_CNL) },

drivers/i2c/busses/i2c-rtl9300.c

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ static int rtl9300_i2c_config_xfer(struct rtl9300_i2c *i2c, struct rtl9300_i2c_c
9999
{
100100
u32 val, mask;
101101

102+
if (len < 1 || len > 16)
103+
return -EINVAL;
104+
102105
val = chan->bus_freq << RTL9300_I2C_MST_CTRL2_SCL_FREQ_OFS;
103106
mask = RTL9300_I2C_MST_CTRL2_SCL_FREQ_MASK;
104107

@@ -222,15 +225,6 @@ static int rtl9300_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr, unsigned s
222225
}
223226

224227
switch (size) {
225-
case I2C_SMBUS_QUICK:
226-
ret = rtl9300_i2c_config_xfer(i2c, chan, addr, 0);
227-
if (ret)
228-
goto out_unlock;
229-
ret = rtl9300_i2c_reg_addr_set(i2c, 0, 0);
230-
if (ret)
231-
goto out_unlock;
232-
break;
233-
234228
case I2C_SMBUS_BYTE:
235229
if (read_write == I2C_SMBUS_WRITE) {
236230
ret = rtl9300_i2c_config_xfer(i2c, chan, addr, 0);
@@ -312,9 +306,9 @@ static int rtl9300_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr, unsigned s
312306

313307
static u32 rtl9300_i2c_func(struct i2c_adapter *a)
314308
{
315-
return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
316-
I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
317-
I2C_FUNC_SMBUS_BLOCK_DATA;
309+
return I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_BYTE_DATA |
310+
I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BLOCK_DATA |
311+
I2C_FUNC_SMBUS_I2C_BLOCK;
318312
}
319313

320314
static const struct i2c_algorithm rtl9300_i2c_algo = {
@@ -323,7 +317,7 @@ static const struct i2c_algorithm rtl9300_i2c_algo = {
323317
};
324318

325319
static struct i2c_adapter_quirks rtl9300_i2c_quirks = {
326-
.flags = I2C_AQ_NO_CLK_STRETCH,
320+
.flags = I2C_AQ_NO_CLK_STRETCH | I2C_AQ_NO_ZERO_LEN,
327321
.max_read_len = 16,
328322
.max_write_len = 16,
329323
};
@@ -353,7 +347,7 @@ static int rtl9300_i2c_probe(struct platform_device *pdev)
353347

354348
platform_set_drvdata(pdev, i2c);
355349

356-
if (device_get_child_node_count(dev) >= RTL9300_I2C_MUX_NCHAN)
350+
if (device_get_child_node_count(dev) > RTL9300_I2C_MUX_NCHAN)
357351
return dev_err_probe(dev, -EINVAL, "Too many channels\n");
358352

359353
device_for_each_child_node(dev, child) {

0 commit comments

Comments
 (0)