Skip to content

Commit d3dca69

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 quite some regression fixes this time. One is also related to watchdogs, we have proper acks from Guenter for them" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: acpi: put device when verifying client fails misc: eeprom: at24: fix regulator underflow i2c: gpio: suppress error on probe defer macintosh: windfarm: fix MODINFO regression i2c: designware-pci: Fix BUG_ON during device removal i2c: i801: Do not add ICH_RES_IO_SMI for the iTCO_wdt device watchdog: iTCO_wdt: Make ICH_RES_IO_SMI optional watchdog: iTCO_wdt: Export vendorsupport
2 parents 3086ae0 + 92bd1f2 commit d3dca69

14 files changed

+102
-56
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev)
313313
pm_runtime_get_noresume(&pdev->dev);
314314

315315
i2c_del_adapter(&dev->adapter);
316+
devm_free_irq(&pdev->dev, dev->irq, dev);
316317
pci_free_irq_vectors(pdev);
317318
}
318319

drivers/i2c/busses/i2c-gpio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ static struct gpio_desc *i2c_gpio_get_desc(struct device *dev,
348348
if (ret == -ENOENT)
349349
retdesc = ERR_PTR(-EPROBE_DEFER);
350350

351-
if (ret != -EPROBE_DEFER)
351+
if (PTR_ERR(retdesc) != -EPROBE_DEFER)
352352
dev_err(dev, "error trying to get descriptor: %d\n", ret);
353353

354354
return retdesc;

drivers/i2c/busses/i2c-i801.c

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,6 @@
132132
#define TCOBASE 0x050
133133
#define TCOCTL 0x054
134134

135-
#define ACPIBASE 0x040
136-
#define ACPIBASE_SMI_OFF 0x030
137-
#define ACPICTRL 0x044
138-
#define ACPICTRL_EN 0x080
139-
140135
#define SBREG_BAR 0x10
141136
#define SBREG_SMBCTRL 0xc6000c
142137
#define SBREG_SMBCTRL_DNV 0xcf000c
@@ -1553,7 +1548,7 @@ i801_add_tco_spt(struct i801_priv *priv, struct pci_dev *pci_dev,
15531548
pci_bus_write_config_byte(pci_dev->bus, devfn, 0xe1, hidden);
15541549
spin_unlock(&p2sb_spinlock);
15551550

1556-
res = &tco_res[ICH_RES_MEM_OFF];
1551+
res = &tco_res[1];
15571552
if (pci_dev->device == PCI_DEVICE_ID_INTEL_DNV_SMBUS)
15581553
res->start = (resource_size_t)base64_addr + SBREG_SMBCTRL_DNV;
15591554
else
@@ -1563,7 +1558,7 @@ i801_add_tco_spt(struct i801_priv *priv, struct pci_dev *pci_dev,
15631558
res->flags = IORESOURCE_MEM;
15641559

15651560
return platform_device_register_resndata(&pci_dev->dev, "iTCO_wdt", -1,
1566-
tco_res, 3, &spt_tco_platform_data,
1561+
tco_res, 2, &spt_tco_platform_data,
15671562
sizeof(spt_tco_platform_data));
15681563
}
15691564

@@ -1576,17 +1571,16 @@ static struct platform_device *
15761571
i801_add_tco_cnl(struct i801_priv *priv, struct pci_dev *pci_dev,
15771572
struct resource *tco_res)
15781573
{
1579-
return platform_device_register_resndata(&pci_dev->dev, "iTCO_wdt", -1,
1580-
tco_res, 2, &cnl_tco_platform_data,
1581-
sizeof(cnl_tco_platform_data));
1574+
return platform_device_register_resndata(&pci_dev->dev,
1575+
"iTCO_wdt", -1, tco_res, 1, &cnl_tco_platform_data,
1576+
sizeof(cnl_tco_platform_data));
15821577
}
15831578

15841579
static void i801_add_tco(struct i801_priv *priv)
15851580
{
1586-
u32 base_addr, tco_base, tco_ctl, ctrl_val;
15871581
struct pci_dev *pci_dev = priv->pci_dev;
1588-
struct resource tco_res[3], *res;
1589-
unsigned int devfn;
1582+
struct resource tco_res[2], *res;
1583+
u32 tco_base, tco_ctl;
15901584

15911585
/* If we have ACPI based watchdog use that instead */
15921586
if (acpi_has_watchdog())
@@ -1601,30 +1595,15 @@ static void i801_add_tco(struct i801_priv *priv)
16011595
return;
16021596

16031597
memset(tco_res, 0, sizeof(tco_res));
1604-
1605-
res = &tco_res[ICH_RES_IO_TCO];
1606-
res->start = tco_base & ~1;
1607-
res->end = res->start + 32 - 1;
1608-
res->flags = IORESOURCE_IO;
1609-
16101598
/*
1611-
* Power Management registers.
1599+
* Always populate the main iTCO IO resource here. The second entry
1600+
* for NO_REBOOT MMIO is filled by the SPT specific function.
16121601
*/
1613-
devfn = PCI_DEVFN(PCI_SLOT(pci_dev->devfn), 2);
1614-
pci_bus_read_config_dword(pci_dev->bus, devfn, ACPIBASE, &base_addr);
1615-
1616-
res = &tco_res[ICH_RES_IO_SMI];
1617-
res->start = (base_addr & ~1) + ACPIBASE_SMI_OFF;
1618-
res->end = res->start + 3;
1602+
res = &tco_res[0];
1603+
res->start = tco_base & ~1;
1604+
res->end = res->start + 32 - 1;
16191605
res->flags = IORESOURCE_IO;
16201606

1621-
/*
1622-
* Enable the ACPI I/O space.
1623-
*/
1624-
pci_bus_read_config_dword(pci_dev->bus, devfn, ACPICTRL, &ctrl_val);
1625-
ctrl_val |= ACPICTRL_EN;
1626-
pci_bus_write_config_dword(pci_dev->bus, devfn, ACPICTRL, ctrl_val);
1627-
16281607
if (priv->features & FEATURE_TCO_CNL)
16291608
priv->tco_pdev = i801_add_tco_cnl(priv, pci_dev, tco_res);
16301609
else

drivers/i2c/i2c-core-acpi.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,17 @@ EXPORT_SYMBOL_GPL(i2c_acpi_find_adapter_by_handle);
394394
static struct i2c_client *i2c_acpi_find_client_by_adev(struct acpi_device *adev)
395395
{
396396
struct device *dev;
397+
struct i2c_client *client;
397398

398399
dev = bus_find_device_by_acpi_dev(&i2c_bus_type, adev);
399-
return dev ? i2c_verify_client(dev) : NULL;
400+
if (!dev)
401+
return NULL;
402+
403+
client = i2c_verify_client(dev);
404+
if (!client)
405+
put_device(dev);
406+
407+
return client;
400408
}
401409

402410
static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value,

drivers/macintosh/windfarm_ad7417_sensor.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,16 @@ static const struct i2c_device_id wf_ad7417_id[] = {
312312
};
313313
MODULE_DEVICE_TABLE(i2c, wf_ad7417_id);
314314

315+
static const struct of_device_id wf_ad7417_of_id[] = {
316+
{ .compatible = "ad7417", },
317+
{ }
318+
};
319+
MODULE_DEVICE_TABLE(of, wf_ad7417_of_id);
320+
315321
static struct i2c_driver wf_ad7417_driver = {
316322
.driver = {
317323
.name = "wf_ad7417",
324+
.of_match_table = wf_ad7417_of_id,
318325
},
319326
.probe = wf_ad7417_probe,
320327
.remove = wf_ad7417_remove,

drivers/macintosh/windfarm_fcu_controls.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,16 @@ static const struct i2c_device_id wf_fcu_id[] = {
580580
};
581581
MODULE_DEVICE_TABLE(i2c, wf_fcu_id);
582582

583+
static const struct of_device_id wf_fcu_of_id[] = {
584+
{ .compatible = "fcu", },
585+
{ }
586+
};
587+
MODULE_DEVICE_TABLE(of, wf_fcu_of_id);
588+
583589
static struct i2c_driver wf_fcu_driver = {
584590
.driver = {
585591
.name = "wf_fcu",
592+
.of_match_table = wf_fcu_of_id,
586593
},
587594
.probe = wf_fcu_probe,
588595
.remove = wf_fcu_remove,

drivers/macintosh/windfarm_lm75_sensor.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/init.h>
1515
#include <linux/wait.h>
1616
#include <linux/i2c.h>
17+
#include <linux/of_device.h>
1718
#include <asm/prom.h>
1819
#include <asm/machdep.h>
1920
#include <asm/io.h>
@@ -91,9 +92,14 @@ static int wf_lm75_probe(struct i2c_client *client,
9192
const struct i2c_device_id *id)
9293
{
9394
struct wf_lm75_sensor *lm;
94-
int rc, ds1775 = id->driver_data;
95+
int rc, ds1775;
9596
const char *name, *loc;
9697

98+
if (id)
99+
ds1775 = id->driver_data;
100+
else
101+
ds1775 = !!of_device_get_match_data(&client->dev);
102+
97103
DBG("wf_lm75: creating %s device at address 0x%02x\n",
98104
ds1775 ? "ds1775" : "lm75", client->addr);
99105

@@ -164,9 +170,17 @@ static const struct i2c_device_id wf_lm75_id[] = {
164170
};
165171
MODULE_DEVICE_TABLE(i2c, wf_lm75_id);
166172

173+
static const struct of_device_id wf_lm75_of_id[] = {
174+
{ .compatible = "lm75", .data = (void *)0},
175+
{ .compatible = "ds1775", .data = (void *)1 },
176+
{ }
177+
};
178+
MODULE_DEVICE_TABLE(of, wf_lm75_of_id);
179+
167180
static struct i2c_driver wf_lm75_driver = {
168181
.driver = {
169182
.name = "wf_lm75",
183+
.of_match_table = wf_lm75_of_id,
170184
},
171185
.probe = wf_lm75_probe,
172186
.remove = wf_lm75_remove,

drivers/macintosh/windfarm_lm87_sensor.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,16 @@ static const struct i2c_device_id wf_lm87_id[] = {
166166
};
167167
MODULE_DEVICE_TABLE(i2c, wf_lm87_id);
168168

169+
static const struct of_device_id wf_lm87_of_id[] = {
170+
{ .compatible = "lm87cimt", },
171+
{ }
172+
};
173+
MODULE_DEVICE_TABLE(of, wf_lm87_of_id);
174+
169175
static struct i2c_driver wf_lm87_driver = {
170176
.driver = {
171177
.name = "wf_lm87",
178+
.of_match_table = wf_lm87_of_id,
172179
},
173180
.probe = wf_lm87_probe,
174181
.remove = wf_lm87_remove,

drivers/macintosh/windfarm_max6690_sensor.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,16 @@ static const struct i2c_device_id wf_max6690_id[] = {
120120
};
121121
MODULE_DEVICE_TABLE(i2c, wf_max6690_id);
122122

123+
static const struct of_device_id wf_max6690_of_id[] = {
124+
{ .compatible = "max6690", },
125+
{ }
126+
};
127+
MODULE_DEVICE_TABLE(of, wf_max6690_of_id);
128+
123129
static struct i2c_driver wf_max6690_driver = {
124130
.driver = {
125131
.name = "wf_max6690",
132+
.of_match_table = wf_max6690_of_id,
126133
},
127134
.probe = wf_max6690_probe,
128135
.remove = wf_max6690_remove,

drivers/macintosh/windfarm_smu_sat.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,16 @@ static const struct i2c_device_id wf_sat_id[] = {
341341
};
342342
MODULE_DEVICE_TABLE(i2c, wf_sat_id);
343343

344+
static const struct of_device_id wf_sat_of_id[] = {
345+
{ .compatible = "smu-sat", },
346+
{ }
347+
};
348+
MODULE_DEVICE_TABLE(of, wf_sat_of_id);
349+
344350
static struct i2c_driver wf_sat_driver = {
345351
.driver = {
346352
.name = "wf_smu_sat",
353+
.of_match_table = wf_sat_of_id,
347354
},
348355
.probe = wf_sat_probe,
349356
.remove = wf_sat_remove,

0 commit comments

Comments
 (0)