You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: of/i2c: Fix module load order issue caused by of_i2c.c i2c: Fix checks which cause legacy suspend to never get called i2c-pca: Fix waitforcompletion() return value i2c: Fix for suspend/resume issue i2c: Remove obsolete cleanup for clientdata
This commit is contained in:
@@ -677,6 +677,11 @@ static int __devinit cpm_i2c_probe(struct platform_device *ofdev,
|
|||||||
dev_dbg(&ofdev->dev, "hw routines for %s registered.\n",
|
dev_dbg(&ofdev->dev, "hw routines for %s registered.\n",
|
||||||
cpm->adap.name);
|
cpm->adap.name);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* register OF I2C devices
|
||||||
|
*/
|
||||||
|
of_i2c_register_devices(&cpm->adap);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
out_shut:
|
out_shut:
|
||||||
cpm_i2c_shutdown(cpm);
|
cpm_i2c_shutdown(cpm);
|
||||||
|
|||||||
@@ -761,6 +761,9 @@ static int __devinit iic_probe(struct platform_device *ofdev,
|
|||||||
dev_info(&ofdev->dev, "using %s mode\n",
|
dev_info(&ofdev->dev, "using %s mode\n",
|
||||||
dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
|
dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
|
||||||
|
|
||||||
|
/* Now register all the child nodes */
|
||||||
|
of_i2c_register_devices(adap);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error_cleanup:
|
error_cleanup:
|
||||||
|
|||||||
@@ -632,6 +632,7 @@ static int __devinit fsl_i2c_probe(struct platform_device *op,
|
|||||||
dev_err(i2c->dev, "failed to add adapter\n");
|
dev_err(i2c->dev, "failed to add adapter\n");
|
||||||
goto fail_add;
|
goto fail_add;
|
||||||
}
|
}
|
||||||
|
of_i2c_register_devices(&i2c->adap);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|||||||
@@ -71,8 +71,8 @@ static int pca_isa_readbyte(void *pd, int reg)
|
|||||||
|
|
||||||
static int pca_isa_waitforcompletion(void *pd)
|
static int pca_isa_waitforcompletion(void *pd)
|
||||||
{
|
{
|
||||||
long ret = ~0;
|
|
||||||
unsigned long timeout;
|
unsigned long timeout;
|
||||||
|
long ret;
|
||||||
|
|
||||||
if (irq > -1) {
|
if (irq > -1) {
|
||||||
ret = wait_event_timeout(pca_wait,
|
ret = wait_event_timeout(pca_wait,
|
||||||
@@ -81,11 +81,15 @@ static int pca_isa_waitforcompletion(void *pd)
|
|||||||
} else {
|
} else {
|
||||||
/* Do polling */
|
/* Do polling */
|
||||||
timeout = jiffies + pca_isa_ops.timeout;
|
timeout = jiffies + pca_isa_ops.timeout;
|
||||||
while (((pca_isa_readbyte(pd, I2C_PCA_CON)
|
do {
|
||||||
& I2C_PCA_CON_SI) == 0)
|
ret = time_before(jiffies, timeout);
|
||||||
&& (ret = time_before(jiffies, timeout)))
|
if (pca_isa_readbyte(pd, I2C_PCA_CON)
|
||||||
|
& I2C_PCA_CON_SI)
|
||||||
|
break;
|
||||||
udelay(100);
|
udelay(100);
|
||||||
|
} while (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret > 0;
|
return ret > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ static void i2c_pca_pf_writebyte32(void *pd, int reg, int val)
|
|||||||
static int i2c_pca_pf_waitforcompletion(void *pd)
|
static int i2c_pca_pf_waitforcompletion(void *pd)
|
||||||
{
|
{
|
||||||
struct i2c_pca_pf_data *i2c = pd;
|
struct i2c_pca_pf_data *i2c = pd;
|
||||||
long ret = ~0;
|
|
||||||
unsigned long timeout;
|
unsigned long timeout;
|
||||||
|
long ret;
|
||||||
|
|
||||||
if (i2c->irq) {
|
if (i2c->irq) {
|
||||||
ret = wait_event_timeout(i2c->wait,
|
ret = wait_event_timeout(i2c->wait,
|
||||||
@@ -90,10 +90,13 @@ static int i2c_pca_pf_waitforcompletion(void *pd)
|
|||||||
} else {
|
} else {
|
||||||
/* Do polling */
|
/* Do polling */
|
||||||
timeout = jiffies + i2c->adap.timeout;
|
timeout = jiffies + i2c->adap.timeout;
|
||||||
while (((i2c->algo_data.read_byte(i2c, I2C_PCA_CON)
|
do {
|
||||||
& I2C_PCA_CON_SI) == 0)
|
ret = time_before(jiffies, timeout);
|
||||||
&& (ret = time_before(jiffies, timeout)))
|
if (i2c->algo_data.read_byte(i2c, I2C_PCA_CON)
|
||||||
|
& I2C_PCA_CON_SI)
|
||||||
|
break;
|
||||||
udelay(100);
|
udelay(100);
|
||||||
|
} while (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret > 0;
|
return ret > 0;
|
||||||
|
|||||||
+24
-30
@@ -32,7 +32,6 @@
|
|||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/idr.h>
|
#include <linux/idr.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
#include <linux/of_i2c.h>
|
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
#include <linux/completion.h>
|
#include <linux/completion.h>
|
||||||
#include <linux/hardirq.h>
|
#include <linux/hardirq.h>
|
||||||
@@ -197,11 +196,12 @@ static int i2c_device_pm_suspend(struct device *dev)
|
|||||||
{
|
{
|
||||||
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
|
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
|
||||||
|
|
||||||
if (pm_runtime_suspended(dev))
|
if (pm) {
|
||||||
return 0;
|
if (pm_runtime_suspended(dev))
|
||||||
|
return 0;
|
||||||
if (pm)
|
else
|
||||||
return pm->suspend ? pm->suspend(dev) : 0;
|
return pm->suspend ? pm->suspend(dev) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
return i2c_legacy_suspend(dev, PMSG_SUSPEND);
|
return i2c_legacy_suspend(dev, PMSG_SUSPEND);
|
||||||
}
|
}
|
||||||
@@ -216,12 +216,6 @@ static int i2c_device_pm_resume(struct device *dev)
|
|||||||
else
|
else
|
||||||
ret = i2c_legacy_resume(dev);
|
ret = i2c_legacy_resume(dev);
|
||||||
|
|
||||||
if (!ret) {
|
|
||||||
pm_runtime_disable(dev);
|
|
||||||
pm_runtime_set_active(dev);
|
|
||||||
pm_runtime_enable(dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,11 +223,12 @@ static int i2c_device_pm_freeze(struct device *dev)
|
|||||||
{
|
{
|
||||||
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
|
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
|
||||||
|
|
||||||
if (pm_runtime_suspended(dev))
|
if (pm) {
|
||||||
return 0;
|
if (pm_runtime_suspended(dev))
|
||||||
|
return 0;
|
||||||
if (pm)
|
else
|
||||||
return pm->freeze ? pm->freeze(dev) : 0;
|
return pm->freeze ? pm->freeze(dev) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
return i2c_legacy_suspend(dev, PMSG_FREEZE);
|
return i2c_legacy_suspend(dev, PMSG_FREEZE);
|
||||||
}
|
}
|
||||||
@@ -242,11 +237,12 @@ static int i2c_device_pm_thaw(struct device *dev)
|
|||||||
{
|
{
|
||||||
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
|
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
|
||||||
|
|
||||||
if (pm_runtime_suspended(dev))
|
if (pm) {
|
||||||
return 0;
|
if (pm_runtime_suspended(dev))
|
||||||
|
return 0;
|
||||||
if (pm)
|
else
|
||||||
return pm->thaw ? pm->thaw(dev) : 0;
|
return pm->thaw ? pm->thaw(dev) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
return i2c_legacy_resume(dev);
|
return i2c_legacy_resume(dev);
|
||||||
}
|
}
|
||||||
@@ -255,11 +251,12 @@ static int i2c_device_pm_poweroff(struct device *dev)
|
|||||||
{
|
{
|
||||||
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
|
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
|
||||||
|
|
||||||
if (pm_runtime_suspended(dev))
|
if (pm) {
|
||||||
return 0;
|
if (pm_runtime_suspended(dev))
|
||||||
|
return 0;
|
||||||
if (pm)
|
else
|
||||||
return pm->poweroff ? pm->poweroff(dev) : 0;
|
return pm->poweroff ? pm->poweroff(dev) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
return i2c_legacy_suspend(dev, PMSG_HIBERNATE);
|
return i2c_legacy_suspend(dev, PMSG_HIBERNATE);
|
||||||
}
|
}
|
||||||
@@ -876,9 +873,6 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
|
|||||||
if (adap->nr < __i2c_first_dynamic_bus_num)
|
if (adap->nr < __i2c_first_dynamic_bus_num)
|
||||||
i2c_scan_static_board_info(adap);
|
i2c_scan_static_board_info(adap);
|
||||||
|
|
||||||
/* Register devices from the device tree */
|
|
||||||
of_i2c_register_devices(adap);
|
|
||||||
|
|
||||||
/* Notify drivers */
|
/* Notify drivers */
|
||||||
mutex_lock(&core_lock);
|
mutex_lock(&core_lock);
|
||||||
bus_for_each_drv(&i2c_bus_type, NULL, adap, __process_new_adapter);
|
bus_for_each_drv(&i2c_bus_type, NULL, adap, __process_new_adapter);
|
||||||
|
|||||||
@@ -190,7 +190,6 @@ static int __devexit bh1780_remove(struct i2c_client *client)
|
|||||||
|
|
||||||
ddata = i2c_get_clientdata(client);
|
ddata = i2c_get_clientdata(client);
|
||||||
sysfs_remove_group(&client->dev.kobj, &bh1780_attr_group);
|
sysfs_remove_group(&client->dev.kobj, &bh1780_attr_group);
|
||||||
i2c_set_clientdata(client, NULL);
|
|
||||||
kfree(ddata);
|
kfree(ddata);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -256,7 +256,6 @@ static int __devexit ad5398_remove(struct i2c_client *client)
|
|||||||
|
|
||||||
regulator_unregister(chip->rdev);
|
regulator_unregister(chip->rdev);
|
||||||
kfree(chip);
|
kfree(chip);
|
||||||
i2c_set_clientdata(client, NULL);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,8 +191,6 @@ static int __devexit isl6271a_remove(struct i2c_client *i2c)
|
|||||||
struct isl_pmic *pmic = i2c_get_clientdata(i2c);
|
struct isl_pmic *pmic = i2c_get_clientdata(i2c);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i2c_set_clientdata(i2c, NULL);
|
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
regulator_unregister(pmic->rdev[i]);
|
regulator_unregister(pmic->rdev[i]);
|
||||||
|
|
||||||
|
|||||||
@@ -268,7 +268,6 @@ out_irq:
|
|||||||
free_irq(client->irq, client);
|
free_irq(client->irq, client);
|
||||||
|
|
||||||
out_free:
|
out_free:
|
||||||
i2c_set_clientdata(client, NULL);
|
|
||||||
kfree(ds3232);
|
kfree(ds3232);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -287,7 +286,6 @@ static int __devexit ds3232_remove(struct i2c_client *client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rtc_device_unregister(ds3232->rtc);
|
rtc_device_unregister(ds3232->rtc);
|
||||||
i2c_set_clientdata(client, NULL);
|
|
||||||
kfree(ds3232);
|
kfree(ds3232);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user