static int apds990x_runtime_suspend(struct device *dev) { struct i2c_client *client = container_of(dev, struct i2c_client, dev); struct apds990x_chip *chip = i2c_get_clientdata(client); apds990x_chip_off(chip); return 0; }
static int __devexit apds990x_remove(struct i2c_client *client) { struct apds990x_chip *chip = i2c_get_clientdata(client); free_irq(client->irq, chip); sysfs_remove_group(&chip->client->dev.kobj, apds990x_attribute_group); if (chip->pdata && chip->pdata->release_resources) chip->pdata->release_resources(); if (!pm_runtime_suspended(&client->dev)) apds990x_chip_off(chip); pm_runtime_disable(&client->dev); pm_runtime_set_suspended(&client->dev); kfree(chip); return 0; }