static int tsl2550_remove(struct i2c_client *client) { sysfs_remove_group(&client->dev.kobj, &tsl2550_attr_group); /* Power down the device */ tsl2550_set_power_state(client, 0); kfree(i2c_get_clientdata(client)); return 0; }
static ssize_t tsl2550_store_power_state(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct tsl2550_data *data = i2c_get_clientdata(client); unsigned long val = simple_strtoul(buf, NULL, 10); int ret; if (val > 1) return -EINVAL; mutex_lock(&data->update_lock); ret = tsl2550_set_power_state(client, val); mutex_unlock(&data->update_lock); if (ret < 0) return ret; return count; }
static int tsl2550_resume(struct device *dev) { return tsl2550_set_power_state(to_i2c_client(dev), 1); }
static int tsl2550_suspend(struct device *dev) { return tsl2550_set_power_state(to_i2c_client(dev), 0); }
static int tsl2550_resume(struct i2c_client *client) { return tsl2550_set_power_state(client, 1); }
static int tsl2550_suspend(struct i2c_client *client, pm_message_t mesg) { return tsl2550_set_power_state(client, 0); }