mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 15:41:52 +02:00
Merge branch 'for-6.10/hid-sysfs-emit' into for-linus
- conversion from sprintf() to sysfs_emit() (Li Zhijian)
This commit is contained in:
commit
88a8049f8d
|
|
@ -298,7 +298,7 @@ static ssize_t k90_show_macro_mode(struct device *dev,
|
|||
goto out;
|
||||
}
|
||||
|
||||
ret = snprintf(buf, PAGE_SIZE, "%s\n", macro_mode);
|
||||
ret = sysfs_emit(buf, "%s\n", macro_mode);
|
||||
out:
|
||||
kfree(data);
|
||||
|
||||
|
|
@ -367,7 +367,7 @@ static ssize_t k90_show_current_profile(struct device *dev,
|
|||
goto out;
|
||||
}
|
||||
|
||||
ret = snprintf(buf, PAGE_SIZE, "%d\n", current_profile);
|
||||
ret = sysfs_emit(buf, "%d\n", current_profile);
|
||||
out:
|
||||
kfree(data);
|
||||
|
||||
|
|
|
|||
|
|
@ -555,7 +555,7 @@ static ssize_t attr_fn_lock_show(struct device *dev,
|
|||
struct hid_device *hdev = to_hid_device(dev);
|
||||
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,
|
||||
|
|
@ -599,8 +599,7 @@ static ssize_t attr_sensitivity_show_cptkbd(struct device *dev,
|
|||
struct hid_device *hdev = to_hid_device(dev);
|
||||
struct lenovo_drvdata *cptkbd_data = hid_get_drvdata(hdev);
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%u\n",
|
||||
cptkbd_data->sensitivity);
|
||||
return sysfs_emit(buf, "%u\n", cptkbd_data->sensitivity);
|
||||
}
|
||||
|
||||
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,
|
|||
struct hid_device *hdev = to_hid_device(dev);
|
||||
struct lenovo_drvdata *cptkbd_data = hid_get_drvdata(hdev);
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%u\n",
|
||||
cptkbd_data->middleclick_workaround_cptkbd);
|
||||
return sysfs_emit(buf, "%u\n",
|
||||
cptkbd_data->middleclick_workaround_cptkbd);
|
||||
}
|
||||
|
||||
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,
|
|||
struct hid_device *hdev = to_hid_device(dev);
|
||||
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,
|
||||
|
|
@ -839,7 +838,7 @@ static ssize_t attr_dragging_show_tpkbd(struct device *dev,
|
|||
struct hid_device *hdev = to_hid_device(dev);
|
||||
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,
|
||||
|
|
@ -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 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,
|
||||
|
|
@ -899,7 +898,7 @@ static ssize_t attr_select_right_show_tpkbd(struct device *dev,
|
|||
struct hid_device *hdev = to_hid_device(dev);
|
||||
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,
|
||||
|
|
@ -929,8 +928,7 @@ static ssize_t attr_sensitivity_show_tpkbd(struct device *dev,
|
|||
struct hid_device *hdev = to_hid_device(dev);
|
||||
struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%u\n",
|
||||
data_pointer->sensitivity);
|
||||
return sysfs_emit(buf, "%u\n", data_pointer->sensitivity);
|
||||
}
|
||||
|
||||
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,
|
|||
struct hid_device *hdev = to_hid_device(dev);
|
||||
struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev);
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%u\n",
|
||||
data_pointer->press_speed);
|
||||
return sysfs_emit(buf, "%u\n", data_pointer->press_speed);
|
||||
}
|
||||
|
||||
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,
|
|||
struct picolcd_data *data = dev_get_drvdata(dev);
|
||||
|
||||
if (data->status & PICOLCD_BOOTLOADER)
|
||||
return snprintf(buf, PAGE_SIZE, "[bootloader] lcd\n");
|
||||
return sysfs_emit(buf, "[bootloader] lcd\n");
|
||||
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,
|
||||
|
|
@ -301,7 +301,7 @@ static ssize_t picolcd_operation_mode_delay_show(struct device *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,
|
||||
|
|
|
|||
|
|
@ -421,12 +421,10 @@ static ssize_t picolcd_fb_update_rate_show(struct device *dev,
|
|||
size_t ret = 0;
|
||||
|
||||
for (i = 1; i <= PICOLCDFB_UPDATE_RATE_LIMIT; i++)
|
||||
if (ret >= PAGE_SIZE)
|
||||
break;
|
||||
else if (i == fb_update_rate)
|
||||
ret += scnprintf(buf+ret, PAGE_SIZE-ret, "[%u] ", i);
|
||||
if (i == fb_update_rate)
|
||||
ret += sysfs_emit_at(buf, ret, "[%u] ", i);
|
||||
else
|
||||
ret += scnprintf(buf+ret, PAGE_SIZE-ret, "%u ", i);
|
||||
ret += sysfs_emit_at(buf, ret, "%u ", i);
|
||||
if (ret > 0)
|
||||
buf[min(ret, (size_t)PAGE_SIZE)-1] = '\n';
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ static ssize_t isku_sysfs_show_actual_profile(struct device *dev,
|
|||
{
|
||||
struct isku_device *isku =
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ static ssize_t kone_sysfs_show_actual_profile(struct device *dev,
|
|||
{
|
||||
struct kone_device *kone =
|
||||
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);
|
||||
|
||||
|
|
@ -409,7 +409,7 @@ static ssize_t kone_sysfs_show_actual_dpi(struct device *dev,
|
|||
{
|
||||
struct kone_device *kone =
|
||||
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);
|
||||
|
||||
|
|
@ -432,7 +432,7 @@ static ssize_t kone_sysfs_show_weight(struct device *dev,
|
|||
|
||||
if (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);
|
||||
|
||||
|
|
@ -441,7 +441,7 @@ static ssize_t kone_sysfs_show_firmware_version(struct device *dev,
|
|||
{
|
||||
struct kone_device *kone =
|
||||
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,
|
||||
NULL);
|
||||
|
|
@ -451,7 +451,7 @@ static ssize_t kone_sysfs_show_tcu(struct device *dev,
|
|||
{
|
||||
struct kone_device *kone =
|
||||
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)
|
||||
|
|
@ -553,7 +553,7 @@ static ssize_t kone_sysfs_show_startup_profile(struct device *dev,
|
|||
{
|
||||
struct kone_device *kone =
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ static ssize_t koneplus_sysfs_show_actual_profile(struct device *dev,
|
|||
{
|
||||
struct koneplus_device *koneplus =
|
||||
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,
|
||||
|
|
@ -309,7 +309,7 @@ static ssize_t koneplus_sysfs_show_firmware_version(struct device *dev,
|
|||
&info, KONEPLUS_SIZE_INFO);
|
||||
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,
|
||||
koneplus_sysfs_show_firmware_version, NULL);
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ static ssize_t kovaplus_sysfs_show_actual_profile(struct device *dev,
|
|||
{
|
||||
struct kovaplus_device *kovaplus =
|
||||
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,
|
||||
|
|
@ -325,7 +325,7 @@ static ssize_t kovaplus_sysfs_show_actual_cpi(struct device *dev,
|
|||
{
|
||||
struct kovaplus_device *kovaplus =
|
||||
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);
|
||||
|
||||
|
|
@ -334,7 +334,7 @@ static ssize_t kovaplus_sysfs_show_actual_sensitivity_x(struct device *dev,
|
|||
{
|
||||
struct kovaplus_device *kovaplus =
|
||||
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,
|
||||
kovaplus_sysfs_show_actual_sensitivity_x, NULL);
|
||||
|
|
@ -344,7 +344,7 @@ static ssize_t kovaplus_sysfs_show_actual_sensitivity_y(struct device *dev,
|
|||
{
|
||||
struct kovaplus_device *kovaplus =
|
||||
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,
|
||||
kovaplus_sysfs_show_actual_sensitivity_y, NULL);
|
||||
|
|
@ -365,7 +365,7 @@ static ssize_t kovaplus_sysfs_show_firmware_version(struct device *dev,
|
|||
&info, KOVAPLUS_SIZE_INFO);
|
||||
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,
|
||||
kovaplus_sysfs_show_firmware_version, NULL);
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ static ssize_t pyra_sysfs_show_actual_cpi(struct device *dev,
|
|||
{
|
||||
struct pyra_device *pyra =
|
||||
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);
|
||||
|
||||
|
|
@ -300,7 +300,7 @@ static ssize_t pyra_sysfs_show_actual_profile(struct device *dev,
|
|||
&settings, PYRA_SIZE_SETTINGS);
|
||||
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(startup_profile, 0440, pyra_sysfs_show_actual_profile, NULL);
|
||||
|
|
@ -321,7 +321,7 @@ static ssize_t pyra_sysfs_show_firmware_version(struct device *dev,
|
|||
&info, PYRA_SIZE_INFO);
|
||||
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,
|
||||
NULL);
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ static ssize_t enable_sensor_show(struct device *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,
|
||||
|
|
@ -372,14 +372,13 @@ static ssize_t show_value(struct device *dev, struct device_attribute *attr,
|
|||
sizeof(struct hid_custom_usage_desc),
|
||||
usage_id_cmp);
|
||||
if (usage_desc)
|
||||
return snprintf(buf, PAGE_SIZE, "%s\n",
|
||||
usage_desc->desc);
|
||||
return sysfs_emit(buf, "%s\n", usage_desc->desc);
|
||||
else
|
||||
return sprintf(buf, "not-specified\n");
|
||||
return sysfs_emit(buf, "not-specified\n");
|
||||
} else
|
||||
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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user