static ssize_t attr_flash_current_show(struct device *dev, struct device_attribute *attr, char *buf) { struct lm3561_drv_data *data = dev_get_drvdata(dev); int result; unsigned long flash_current; result = lm3561_get_flash_current(data, &flash_current); if (result != 0) return result; return snprintf(buf, PAGE_SIZE, "%lu\n", flash_current); }
static ssize_t attr_flash_current_show(struct device *dev, struct device_attribute *attr, char *buf) { struct lm3561_drv_data *data = dev_get_drvdata(dev); int result; unsigned long flash_current; result = pm_runtime_get_sync(&data->client->dev); if (result < 0) return result; result = lm3561_get_flash_current(data, &flash_current); pm_runtime_mark_last_busy(&data->client->dev); pm_runtime_put_autosuspend(&data->client->dev); if (result != 0) return result; return snprintf(buf, PAGE_SIZE, "%lu\n", flash_current); }