Commit 88a8049f authored by Jiri Kosina's avatar Jiri Kosina

Merge branch 'for-6.10/hid-sysfs-emit' into for-linus

- conversion from sprintf() to sysfs_emit() (Li Zhijian)
parents 5a95cc9c 209eb1f3
...@@ -298,7 +298,7 @@ static ssize_t k90_show_macro_mode(struct device *dev, ...@@ -298,7 +298,7 @@ static ssize_t k90_show_macro_mode(struct device *dev,
goto out; goto out;
} }
ret = snprintf(buf, PAGE_SIZE, "%s\n", macro_mode); ret = sysfs_emit(buf, "%s\n", macro_mode);
out: out:
kfree(data); kfree(data);
...@@ -367,7 +367,7 @@ static ssize_t k90_show_current_profile(struct device *dev, ...@@ -367,7 +367,7 @@ static ssize_t k90_show_current_profile(struct device *dev,
goto out; goto out;
} }
ret = snprintf(buf, PAGE_SIZE, "%d\n", current_profile); ret = sysfs_emit(buf, "%d\n", current_profile);
out: out:
kfree(data); kfree(data);
......
...@@ -555,7 +555,7 @@ static ssize_t attr_fn_lock_show(struct device *dev, ...@@ -555,7 +555,7 @@ static ssize_t attr_fn_lock_show(struct device *dev,
struct hid_device *hdev = to_hid_device(dev); struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *data = hid_get_drvdata(hdev); struct lenovo_drvdata *data = hid_get_drvdata(hdev);
return snprintf(buf, PAGE_SIZE, "%u\n", data->fn_lock); return sysfs_emit(buf, "%u\n", data->fn_lock);
} }
static ssize_t attr_fn_lock_store(struct device *dev, static ssize_t attr_fn_lock_store(struct device *dev,
...@@ -599,8 +599,7 @@ static ssize_t attr_sensitivity_show_cptkbd(struct device *dev, ...@@ -599,8 +599,7 @@ static ssize_t attr_sensitivity_show_cptkbd(struct device *dev,
struct hid_device *hdev = to_hid_device(dev); struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *cptkbd_data = hid_get_drvdata(hdev); struct lenovo_drvdata *cptkbd_data = hid_get_drvdata(hdev);
return snprintf(buf, PAGE_SIZE, "%u\n", return sysfs_emit(buf, "%u\n", cptkbd_data->sensitivity);
cptkbd_data->sensitivity);
} }
static ssize_t attr_sensitivity_store_cptkbd(struct device *dev, static ssize_t attr_sensitivity_store_cptkbd(struct device *dev,
...@@ -628,8 +627,8 @@ static ssize_t attr_middleclick_workaround_show_cptkbd(struct device *dev, ...@@ -628,8 +627,8 @@ static ssize_t attr_middleclick_workaround_show_cptkbd(struct device *dev,
struct hid_device *hdev = to_hid_device(dev); struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *cptkbd_data = hid_get_drvdata(hdev); struct lenovo_drvdata *cptkbd_data = hid_get_drvdata(hdev);
return snprintf(buf, PAGE_SIZE, "%u\n", return sysfs_emit(buf, "%u\n",
cptkbd_data->middleclick_workaround_cptkbd); cptkbd_data->middleclick_workaround_cptkbd);
} }
static ssize_t attr_middleclick_workaround_store_cptkbd(struct device *dev, static ssize_t attr_middleclick_workaround_store_cptkbd(struct device *dev,
...@@ -809,7 +808,7 @@ static ssize_t attr_press_to_select_show_tpkbd(struct device *dev, ...@@ -809,7 +808,7 @@ static ssize_t attr_press_to_select_show_tpkbd(struct device *dev,
struct hid_device *hdev = to_hid_device(dev); struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev); struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);
return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->press_to_select); return sysfs_emit(buf, "%u\n", data_pointer->press_to_select);
} }
static ssize_t attr_press_to_select_store_tpkbd(struct device *dev, static ssize_t attr_press_to_select_store_tpkbd(struct device *dev,
...@@ -839,7 +838,7 @@ static ssize_t attr_dragging_show_tpkbd(struct device *dev, ...@@ -839,7 +838,7 @@ static ssize_t attr_dragging_show_tpkbd(struct device *dev,
struct hid_device *hdev = to_hid_device(dev); struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev); struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);
return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->dragging); return sysfs_emit(buf, "%u\n", data_pointer->dragging);
} }
static ssize_t attr_dragging_store_tpkbd(struct device *dev, static ssize_t attr_dragging_store_tpkbd(struct device *dev,
...@@ -869,7 +868,7 @@ static ssize_t attr_release_to_select_show_tpkbd(struct device *dev, ...@@ -869,7 +868,7 @@ static ssize_t attr_release_to_select_show_tpkbd(struct device *dev,
struct hid_device *hdev = to_hid_device(dev); struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev); struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);
return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->release_to_select); return sysfs_emit(buf, "%u\n", data_pointer->release_to_select);
} }
static ssize_t attr_release_to_select_store_tpkbd(struct device *dev, static ssize_t attr_release_to_select_store_tpkbd(struct device *dev,
...@@ -899,7 +898,7 @@ static ssize_t attr_select_right_show_tpkbd(struct device *dev, ...@@ -899,7 +898,7 @@ static ssize_t attr_select_right_show_tpkbd(struct device *dev,
struct hid_device *hdev = to_hid_device(dev); struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev); struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);
return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->select_right); return sysfs_emit(buf, "%u\n", data_pointer->select_right);
} }
static ssize_t attr_select_right_store_tpkbd(struct device *dev, static ssize_t attr_select_right_store_tpkbd(struct device *dev,
...@@ -929,8 +928,7 @@ static ssize_t attr_sensitivity_show_tpkbd(struct device *dev, ...@@ -929,8 +928,7 @@ static ssize_t attr_sensitivity_show_tpkbd(struct device *dev,
struct hid_device *hdev = to_hid_device(dev); struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev); struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);
return snprintf(buf, PAGE_SIZE, "%u\n", return sysfs_emit(buf, "%u\n", data_pointer->sensitivity);
data_pointer->sensitivity);
} }
static ssize_t attr_sensitivity_store_tpkbd(struct device *dev, static ssize_t attr_sensitivity_store_tpkbd(struct device *dev,
...@@ -958,8 +956,7 @@ static ssize_t attr_press_speed_show_tpkbd(struct device *dev, ...@@ -958,8 +956,7 @@ static ssize_t attr_press_speed_show_tpkbd(struct device *dev,
struct hid_device *hdev = to_hid_device(dev); struct hid_device *hdev = to_hid_device(dev);
struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev); struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);
return snprintf(buf, PAGE_SIZE, "%u\n", return sysfs_emit(buf, "%u\n", data_pointer->press_speed);
data_pointer->press_speed);
} }
static ssize_t attr_press_speed_store_tpkbd(struct device *dev, static ssize_t attr_press_speed_store_tpkbd(struct device *dev,
......
...@@ -256,9 +256,9 @@ static ssize_t picolcd_operation_mode_show(struct device *dev, ...@@ -256,9 +256,9 @@ static ssize_t picolcd_operation_mode_show(struct device *dev,
struct picolcd_data *data = dev_get_drvdata(dev); struct picolcd_data *data = dev_get_drvdata(dev);
if (data->status & PICOLCD_BOOTLOADER) if (data->status & PICOLCD_BOOTLOADER)
return snprintf(buf, PAGE_SIZE, "[bootloader] lcd\n"); return sysfs_emit(buf, "[bootloader] lcd\n");
else else
return snprintf(buf, PAGE_SIZE, "bootloader [lcd]\n"); return sysfs_emit(buf, "bootloader [lcd]\n");
} }
static ssize_t picolcd_operation_mode_store(struct device *dev, static ssize_t picolcd_operation_mode_store(struct device *dev,
...@@ -301,7 +301,7 @@ static ssize_t picolcd_operation_mode_delay_show(struct device *dev, ...@@ -301,7 +301,7 @@ static ssize_t picolcd_operation_mode_delay_show(struct device *dev,
{ {
struct picolcd_data *data = dev_get_drvdata(dev); struct picolcd_data *data = dev_get_drvdata(dev);
return snprintf(buf, PAGE_SIZE, "%hu\n", data->opmode_delay); return sysfs_emit(buf, "%hu\n", data->opmode_delay);
} }
static ssize_t picolcd_operation_mode_delay_store(struct device *dev, static ssize_t picolcd_operation_mode_delay_store(struct device *dev,
......
...@@ -421,12 +421,10 @@ static ssize_t picolcd_fb_update_rate_show(struct device *dev, ...@@ -421,12 +421,10 @@ static ssize_t picolcd_fb_update_rate_show(struct device *dev,
size_t ret = 0; size_t ret = 0;
for (i = 1; i <= PICOLCDFB_UPDATE_RATE_LIMIT; i++) for (i = 1; i <= PICOLCDFB_UPDATE_RATE_LIMIT; i++)
if (ret >= PAGE_SIZE) if (i == fb_update_rate)
break; ret += sysfs_emit_at(buf, ret, "[%u] ", i);
else if (i == fb_update_rate)
ret += scnprintf(buf+ret, PAGE_SIZE-ret, "[%u] ", i);
else else
ret += scnprintf(buf+ret, PAGE_SIZE-ret, "%u ", i); ret += sysfs_emit_at(buf, ret, "%u ", i);
if (ret > 0) if (ret > 0)
buf[min(ret, (size_t)PAGE_SIZE)-1] = '\n'; buf[min(ret, (size_t)PAGE_SIZE)-1] = '\n';
return ret; return ret;
......
...@@ -61,7 +61,7 @@ static ssize_t isku_sysfs_show_actual_profile(struct device *dev, ...@@ -61,7 +61,7 @@ static ssize_t isku_sysfs_show_actual_profile(struct device *dev,
{ {
struct isku_device *isku = struct isku_device *isku =
hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
return snprintf(buf, PAGE_SIZE, "%d\n", isku->actual_profile); return sysfs_emit(buf, "%d\n", isku->actual_profile);
} }
static ssize_t isku_sysfs_set_actual_profile(struct device *dev, static ssize_t isku_sysfs_set_actual_profile(struct device *dev,
......
...@@ -400,7 +400,7 @@ static ssize_t kone_sysfs_show_actual_profile(struct device *dev, ...@@ -400,7 +400,7 @@ static ssize_t kone_sysfs_show_actual_profile(struct device *dev,
{ {
struct kone_device *kone = struct kone_device *kone =
hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_profile); return sysfs_emit(buf, "%d\n", kone->actual_profile);
} }
static DEVICE_ATTR(actual_profile, 0440, kone_sysfs_show_actual_profile, NULL); static DEVICE_ATTR(actual_profile, 0440, kone_sysfs_show_actual_profile, NULL);
...@@ -409,7 +409,7 @@ static ssize_t kone_sysfs_show_actual_dpi(struct device *dev, ...@@ -409,7 +409,7 @@ static ssize_t kone_sysfs_show_actual_dpi(struct device *dev,
{ {
struct kone_device *kone = struct kone_device *kone =
hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_dpi); return sysfs_emit(buf, "%d\n", kone->actual_dpi);
} }
static DEVICE_ATTR(actual_dpi, 0440, kone_sysfs_show_actual_dpi, NULL); static DEVICE_ATTR(actual_dpi, 0440, kone_sysfs_show_actual_dpi, NULL);
...@@ -432,7 +432,7 @@ static ssize_t kone_sysfs_show_weight(struct device *dev, ...@@ -432,7 +432,7 @@ static ssize_t kone_sysfs_show_weight(struct device *dev,
if (retval) if (retval)
return retval; return retval;
return snprintf(buf, PAGE_SIZE, "%d\n", weight); return sysfs_emit(buf, "%d\n", weight);
} }
static DEVICE_ATTR(weight, 0440, kone_sysfs_show_weight, NULL); static DEVICE_ATTR(weight, 0440, kone_sysfs_show_weight, NULL);
...@@ -441,7 +441,7 @@ static ssize_t kone_sysfs_show_firmware_version(struct device *dev, ...@@ -441,7 +441,7 @@ static ssize_t kone_sysfs_show_firmware_version(struct device *dev,
{ {
struct kone_device *kone = struct kone_device *kone =
hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
return snprintf(buf, PAGE_SIZE, "%d\n", kone->firmware_version); return sysfs_emit(buf, "%d\n", kone->firmware_version);
} }
static DEVICE_ATTR(firmware_version, 0440, kone_sysfs_show_firmware_version, static DEVICE_ATTR(firmware_version, 0440, kone_sysfs_show_firmware_version,
NULL); NULL);
...@@ -451,7 +451,7 @@ static ssize_t kone_sysfs_show_tcu(struct device *dev, ...@@ -451,7 +451,7 @@ static ssize_t kone_sysfs_show_tcu(struct device *dev,
{ {
struct kone_device *kone = struct kone_device *kone =
hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
return snprintf(buf, PAGE_SIZE, "%d\n", kone->settings.tcu); return sysfs_emit(buf, "%d\n", kone->settings.tcu);
} }
static int kone_tcu_command(struct usb_device *usb_dev, int number) static int kone_tcu_command(struct usb_device *usb_dev, int number)
...@@ -553,7 +553,7 @@ static ssize_t kone_sysfs_show_startup_profile(struct device *dev, ...@@ -553,7 +553,7 @@ static ssize_t kone_sysfs_show_startup_profile(struct device *dev,
{ {
struct kone_device *kone = struct kone_device *kone =
hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
return snprintf(buf, PAGE_SIZE, "%d\n", kone->settings.startup_profile); return sysfs_emit(buf, "%d\n", kone->settings.startup_profile);
} }
static ssize_t kone_sysfs_set_startup_profile(struct device *dev, static ssize_t kone_sysfs_set_startup_profile(struct device *dev,
......
...@@ -242,7 +242,7 @@ static ssize_t koneplus_sysfs_show_actual_profile(struct device *dev, ...@@ -242,7 +242,7 @@ static ssize_t koneplus_sysfs_show_actual_profile(struct device *dev,
{ {
struct koneplus_device *koneplus = struct koneplus_device *koneplus =
hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
return snprintf(buf, PAGE_SIZE, "%d\n", koneplus->actual_profile); return sysfs_emit(buf, "%d\n", koneplus->actual_profile);
} }
static ssize_t koneplus_sysfs_set_actual_profile(struct device *dev, static ssize_t koneplus_sysfs_set_actual_profile(struct device *dev,
...@@ -309,7 +309,7 @@ static ssize_t koneplus_sysfs_show_firmware_version(struct device *dev, ...@@ -309,7 +309,7 @@ static ssize_t koneplus_sysfs_show_firmware_version(struct device *dev,
&info, KONEPLUS_SIZE_INFO); &info, KONEPLUS_SIZE_INFO);
mutex_unlock(&koneplus->koneplus_lock); mutex_unlock(&koneplus->koneplus_lock);
return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version); return sysfs_emit(buf, "%d\n", info.firmware_version);
} }
static DEVICE_ATTR(firmware_version, 0440, static DEVICE_ATTR(firmware_version, 0440,
koneplus_sysfs_show_firmware_version, NULL); koneplus_sysfs_show_firmware_version, NULL);
......
...@@ -272,7 +272,7 @@ static ssize_t kovaplus_sysfs_show_actual_profile(struct device *dev, ...@@ -272,7 +272,7 @@ static ssize_t kovaplus_sysfs_show_actual_profile(struct device *dev,
{ {
struct kovaplus_device *kovaplus = struct kovaplus_device *kovaplus =
hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_profile); return sysfs_emit(buf, "%d\n", kovaplus->actual_profile);
} }
static ssize_t kovaplus_sysfs_set_actual_profile(struct device *dev, static ssize_t kovaplus_sysfs_set_actual_profile(struct device *dev,
...@@ -325,7 +325,7 @@ static ssize_t kovaplus_sysfs_show_actual_cpi(struct device *dev, ...@@ -325,7 +325,7 @@ static ssize_t kovaplus_sysfs_show_actual_cpi(struct device *dev,
{ {
struct kovaplus_device *kovaplus = struct kovaplus_device *kovaplus =
hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_cpi); return sysfs_emit(buf, "%d\n", kovaplus->actual_cpi);
} }
static DEVICE_ATTR(actual_cpi, 0440, kovaplus_sysfs_show_actual_cpi, NULL); static DEVICE_ATTR(actual_cpi, 0440, kovaplus_sysfs_show_actual_cpi, NULL);
...@@ -334,7 +334,7 @@ static ssize_t kovaplus_sysfs_show_actual_sensitivity_x(struct device *dev, ...@@ -334,7 +334,7 @@ static ssize_t kovaplus_sysfs_show_actual_sensitivity_x(struct device *dev,
{ {
struct kovaplus_device *kovaplus = struct kovaplus_device *kovaplus =
hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_x_sensitivity); return sysfs_emit(buf, "%d\n", kovaplus->actual_x_sensitivity);
} }
static DEVICE_ATTR(actual_sensitivity_x, 0440, static DEVICE_ATTR(actual_sensitivity_x, 0440,
kovaplus_sysfs_show_actual_sensitivity_x, NULL); kovaplus_sysfs_show_actual_sensitivity_x, NULL);
...@@ -344,7 +344,7 @@ static ssize_t kovaplus_sysfs_show_actual_sensitivity_y(struct device *dev, ...@@ -344,7 +344,7 @@ static ssize_t kovaplus_sysfs_show_actual_sensitivity_y(struct device *dev,
{ {
struct kovaplus_device *kovaplus = struct kovaplus_device *kovaplus =
hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_y_sensitivity); return sysfs_emit(buf, "%d\n", kovaplus->actual_y_sensitivity);
} }
static DEVICE_ATTR(actual_sensitivity_y, 0440, static DEVICE_ATTR(actual_sensitivity_y, 0440,
kovaplus_sysfs_show_actual_sensitivity_y, NULL); kovaplus_sysfs_show_actual_sensitivity_y, NULL);
...@@ -365,7 +365,7 @@ static ssize_t kovaplus_sysfs_show_firmware_version(struct device *dev, ...@@ -365,7 +365,7 @@ static ssize_t kovaplus_sysfs_show_firmware_version(struct device *dev,
&info, KOVAPLUS_SIZE_INFO); &info, KOVAPLUS_SIZE_INFO);
mutex_unlock(&kovaplus->kovaplus_lock); mutex_unlock(&kovaplus->kovaplus_lock);
return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version); return sysfs_emit(buf, "%d\n", info.firmware_version);
} }
static DEVICE_ATTR(firmware_version, 0440, static DEVICE_ATTR(firmware_version, 0440,
kovaplus_sysfs_show_firmware_version, NULL); kovaplus_sysfs_show_firmware_version, NULL);
......
...@@ -283,7 +283,7 @@ static ssize_t pyra_sysfs_show_actual_cpi(struct device *dev, ...@@ -283,7 +283,7 @@ static ssize_t pyra_sysfs_show_actual_cpi(struct device *dev,
{ {
struct pyra_device *pyra = struct pyra_device *pyra =
hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
return snprintf(buf, PAGE_SIZE, "%d\n", pyra->actual_cpi); return sysfs_emit(buf, "%d\n", pyra->actual_cpi);
} }
static DEVICE_ATTR(actual_cpi, 0440, pyra_sysfs_show_actual_cpi, NULL); static DEVICE_ATTR(actual_cpi, 0440, pyra_sysfs_show_actual_cpi, NULL);
...@@ -300,7 +300,7 @@ static ssize_t pyra_sysfs_show_actual_profile(struct device *dev, ...@@ -300,7 +300,7 @@ static ssize_t pyra_sysfs_show_actual_profile(struct device *dev,
&settings, PYRA_SIZE_SETTINGS); &settings, PYRA_SIZE_SETTINGS);
mutex_unlock(&pyra->pyra_lock); mutex_unlock(&pyra->pyra_lock);
return snprintf(buf, PAGE_SIZE, "%d\n", settings.startup_profile); return sysfs_emit(buf, "%d\n", settings.startup_profile);
} }
static DEVICE_ATTR(actual_profile, 0440, pyra_sysfs_show_actual_profile, NULL); static DEVICE_ATTR(actual_profile, 0440, pyra_sysfs_show_actual_profile, NULL);
static DEVICE_ATTR(startup_profile, 0440, pyra_sysfs_show_actual_profile, NULL); static DEVICE_ATTR(startup_profile, 0440, pyra_sysfs_show_actual_profile, NULL);
...@@ -321,7 +321,7 @@ static ssize_t pyra_sysfs_show_firmware_version(struct device *dev, ...@@ -321,7 +321,7 @@ static ssize_t pyra_sysfs_show_firmware_version(struct device *dev,
&info, PYRA_SIZE_INFO); &info, PYRA_SIZE_INFO);
mutex_unlock(&pyra->pyra_lock); mutex_unlock(&pyra->pyra_lock);
return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version); return sysfs_emit(buf, "%d\n", info.firmware_version);
} }
static DEVICE_ATTR(firmware_version, 0440, pyra_sysfs_show_firmware_version, static DEVICE_ATTR(firmware_version, 0440, pyra_sysfs_show_firmware_version,
NULL); NULL);
......
...@@ -155,7 +155,7 @@ static ssize_t enable_sensor_show(struct device *dev, ...@@ -155,7 +155,7 @@ static ssize_t enable_sensor_show(struct device *dev,
{ {
struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev); struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", sensor_inst->enable); return sysfs_emit(buf, "%d\n", sensor_inst->enable);
} }
static int set_power_report_state(struct hid_sensor_custom *sensor_inst, static int set_power_report_state(struct hid_sensor_custom *sensor_inst,
...@@ -372,14 +372,13 @@ static ssize_t show_value(struct device *dev, struct device_attribute *attr, ...@@ -372,14 +372,13 @@ static ssize_t show_value(struct device *dev, struct device_attribute *attr,
sizeof(struct hid_custom_usage_desc), sizeof(struct hid_custom_usage_desc),
usage_id_cmp); usage_id_cmp);
if (usage_desc) if (usage_desc)
return snprintf(buf, PAGE_SIZE, "%s\n", return sysfs_emit(buf, "%s\n", usage_desc->desc);
usage_desc->desc);
else else
return sprintf(buf, "not-specified\n"); return sysfs_emit(buf, "not-specified\n");
} else } else
return -EINVAL; return -EINVAL;
return sprintf(buf, "%d\n", value); return sysfs_emit(buf, "%d\n", value);
} }
static ssize_t store_value(struct device *dev, struct device_attribute *attr, static ssize_t store_value(struct device *dev, struct device_attribute *attr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment