Skip to content

Commit eea1730

Browse files
committed
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: "I2C has a bunch of driver fixes and a core improvement to make the on-going API transition more robust" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: mediatek: disable zero-length transfers for mt8183 i2c: iproc: Stop advertising support of SMBUS quick cmd MAINTAINERS: i2c mv64xxx: Update documentation path i2c: piix4: Fix port selection for AMD Family 16h Model 30h i2c: designware: Synchronize IRQs when unregistering slave client i2c: i801: Avoid memory leak in check_acpi_smo88xx_device() i2c: make i2c_unregister_device() ERR_PTR safe
2 parents 95381de + abf4923 commit eea1730

File tree

7 files changed

+34
-14
lines changed

7 files changed

+34
-14
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7513,7 +7513,7 @@ I2C MV64XXX MARVELL AND ALLWINNER DRIVER
75137513
M: Gregory CLEMENT <[email protected]>
75147514
75157515
S: Maintained
7516-
F: Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
7516+
F: Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml
75177517
F: drivers/i2c/busses/i2c-mv64xxx.c
75187518

75197519
I2C OVER PARALLEL PORT

drivers/i2c/busses/i2c-bcm-iproc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,10 @@ static int bcm_iproc_i2c_xfer(struct i2c_adapter *adapter,
790790

791791
static uint32_t bcm_iproc_i2c_functionality(struct i2c_adapter *adap)
792792
{
793-
u32 val = I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
793+
u32 val;
794+
795+
/* We do not support the SMBUS Quick command */
796+
val = I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
794797

795798
if (adap->algo->reg_slave)
796799
val |= I2C_FUNC_SLAVE;

drivers/i2c/busses/i2c-designware-slave.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ static int i2c_dw_unreg_slave(struct i2c_client *slave)
9494

9595
dev->disable_int(dev);
9696
dev->disable(dev);
97+
synchronize_irq(dev->irq);
9798
dev->slave = NULL;
9899
pm_runtime_put(dev->dev);
99100

drivers/i2c/busses/i2c-i801.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,19 +1194,28 @@ static acpi_status check_acpi_smo88xx_device(acpi_handle obj_handle,
11941194
int i;
11951195

11961196
status = acpi_get_object_info(obj_handle, &info);
1197-
if (!ACPI_SUCCESS(status) || !(info->valid & ACPI_VALID_HID))
1197+
if (ACPI_FAILURE(status))
11981198
return AE_OK;
11991199

1200+
if (!(info->valid & ACPI_VALID_HID))
1201+
goto smo88xx_not_found;
1202+
12001203
hid = info->hardware_id.string;
12011204
if (!hid)
1202-
return AE_OK;
1205+
goto smo88xx_not_found;
12031206

12041207
i = match_string(acpi_smo8800_ids, ARRAY_SIZE(acpi_smo8800_ids), hid);
12051208
if (i < 0)
1206-
return AE_OK;
1209+
goto smo88xx_not_found;
1210+
1211+
kfree(info);
12071212

12081213
*((bool *)return_value) = true;
12091214
return AE_CTRL_TERMINATE;
1215+
1216+
smo88xx_not_found:
1217+
kfree(info);
1218+
return AE_OK;
12101219
}
12111220

12121221
static bool is_dell_system_with_lis3lv02d(void)

drivers/i2c/busses/i2c-mt65xx.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,10 @@ static const struct i2c_adapter_quirks mt7622_i2c_quirks = {
234234
.max_num_msgs = 255,
235235
};
236236

237+
static const struct i2c_adapter_quirks mt8183_i2c_quirks = {
238+
.flags = I2C_AQ_NO_ZERO_LEN,
239+
};
240+
237241
static const struct mtk_i2c_compatible mt2712_compat = {
238242
.regs = mt_i2c_regs_v1,
239243
.pmic_i2c = 0,
@@ -298,6 +302,7 @@ static const struct mtk_i2c_compatible mt8173_compat = {
298302
};
299303

300304
static const struct mtk_i2c_compatible mt8183_compat = {
305+
.quirks = &mt8183_i2c_quirks,
301306
.regs = mt_i2c_regs_v2,
302307
.pmic_i2c = 0,
303308
.dcm = 0,
@@ -870,7 +875,11 @@ static irqreturn_t mtk_i2c_irq(int irqno, void *dev_id)
870875

871876
static u32 mtk_i2c_functionality(struct i2c_adapter *adap)
872877
{
873-
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
878+
if (adap->quirks->flags & I2C_AQ_NO_ZERO_LEN)
879+
return I2C_FUNC_I2C |
880+
(I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
881+
else
882+
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
874883
}
875884

876885
static const struct i2c_algorithm mtk_i2c_algorithm = {

drivers/i2c/busses/i2c-piix4.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
#define SB800_PIIX4_PORT_IDX_MASK 0x06
9292
#define SB800_PIIX4_PORT_IDX_SHIFT 1
9393

94-
/* On kerncz, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */
94+
/* On kerncz and Hudson2, SmBus0Sel is at bit 20:19 of PMx00 DecodeEn */
9595
#define SB800_PIIX4_PORT_IDX_KERNCZ 0x02
9696
#define SB800_PIIX4_PORT_IDX_MASK_KERNCZ 0x18
9797
#define SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ 3
@@ -358,18 +358,16 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
358358
/* Find which register is used for port selection */
359359
if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD ||
360360
PIIX4_dev->vendor == PCI_VENDOR_ID_HYGON) {
361-
switch (PIIX4_dev->device) {
362-
case PCI_DEVICE_ID_AMD_KERNCZ_SMBUS:
361+
if (PIIX4_dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS ||
362+
(PIIX4_dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS &&
363+
PIIX4_dev->revision >= 0x1F)) {
363364
piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_KERNCZ;
364365
piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK_KERNCZ;
365366
piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT_KERNCZ;
366-
break;
367-
case PCI_DEVICE_ID_AMD_HUDSON2_SMBUS:
368-
default:
367+
} else {
369368
piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_ALT;
370369
piix4_port_mask_sb800 = SB800_PIIX4_PORT_IDX_MASK;
371370
piix4_port_shift_sb800 = SB800_PIIX4_PORT_IDX_SHIFT;
372-
break;
373371
}
374372
} else {
375373
if (!request_muxed_region(SB800_PIIX4_SMB_IDX, 2,

drivers/i2c/i2c-core-base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ EXPORT_SYMBOL_GPL(i2c_new_device);
832832
*/
833833
void i2c_unregister_device(struct i2c_client *client)
834834
{
835-
if (!client)
835+
if (IS_ERR_OR_NULL(client))
836836
return;
837837

838838
if (client->dev.of_node) {

0 commit comments

Comments
 (0)