Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
88a8049f
Commit
88a8049f
authored
May 14, 2024
by
Jiri Kosina
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-6.10/hid-sysfs-emit' into for-linus
- conversion from sprintf() to sysfs_emit() (Li Zhijian)
parents
5a95cc9c
209eb1f3
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
39 additions
and
45 deletions
+39
-45
drivers/hid/hid-corsair.c
drivers/hid/hid-corsair.c
+2
-2
drivers/hid/hid-lenovo.c
drivers/hid/hid-lenovo.c
+10
-13
drivers/hid/hid-picolcd_core.c
drivers/hid/hid-picolcd_core.c
+3
-3
drivers/hid/hid-picolcd_fb.c
drivers/hid/hid-picolcd_fb.c
+3
-5
drivers/hid/hid-roccat-isku.c
drivers/hid/hid-roccat-isku.c
+1
-1
drivers/hid/hid-roccat-kone.c
drivers/hid/hid-roccat-kone.c
+6
-6
drivers/hid/hid-roccat-koneplus.c
drivers/hid/hid-roccat-koneplus.c
+2
-2
drivers/hid/hid-roccat-kovaplus.c
drivers/hid/hid-roccat-kovaplus.c
+5
-5
drivers/hid/hid-roccat-pyra.c
drivers/hid/hid-roccat-pyra.c
+3
-3
drivers/hid/hid-sensor-custom.c
drivers/hid/hid-sensor-custom.c
+4
-5
No files found.
drivers/hid/hid-corsair.c
View file @
88a8049f
...
...
@@ -298,7 +298,7 @@ static ssize_t k90_show_macro_mode(struct device *dev,
goto
out
;
}
ret
=
s
nprintf
(
buf
,
PAGE_SIZE
,
"%s
\n
"
,
macro_mode
);
ret
=
s
ysfs_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
=
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
current_profile
);
ret
=
s
ysfs_emit
(
buf
,
"%d
\n
"
,
current_profile
);
out:
kfree
(
data
);
...
...
drivers/hid/hid-lenovo.c
View file @
88a8049f
...
...
@@ -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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%u
\n
"
,
data
->
fn_lock
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%u
\n
"
,
cptkbd_data
->
middleclick_workaround_cptkbd
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%u
\n
"
,
data_pointer
->
press_to_select
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%u
\n
"
,
data_pointer
->
dragging
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%u
\n
"
,
data_pointer
->
release_to_select
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%u
\n
"
,
data_pointer
->
select_right
);
return
s
ysfs_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
,
...
...
drivers/hid/hid-picolcd_core.c
View file @
88a8049f
...
...
@@ -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
s
nprintf
(
buf
,
PAGE_SIZE
,
"[bootloader] lcd
\n
"
);
return
s
ysfs_emit
(
buf
,
"[bootloader] lcd
\n
"
);
else
return
s
nprintf
(
buf
,
PAGE_SIZE
,
"bootloader [lcd]
\n
"
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%hu
\n
"
,
data
->
opmode_delay
);
return
s
ysfs_emit
(
buf
,
"%hu
\n
"
,
data
->
opmode_delay
);
}
static
ssize_t
picolcd_operation_mode_delay_store
(
struct
device
*
dev
,
...
...
drivers/hid/hid-picolcd_fb.c
View file @
88a8049f
...
...
@@ -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
+=
s
cnprintf
(
buf
+
ret
,
PAGE_SIZE
-
ret
,
"%u "
,
i
);
ret
+=
s
ysfs_emit_at
(
buf
,
ret
,
"%u "
,
i
);
if
(
ret
>
0
)
buf
[
min
(
ret
,
(
size_t
)
PAGE_SIZE
)
-
1
]
=
'\n'
;
return
ret
;
...
...
drivers/hid/hid-roccat-isku.c
View file @
88a8049f
...
...
@@ -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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
isku
->
actual_profile
);
return
s
ysfs_emit
(
buf
,
"%d
\n
"
,
isku
->
actual_profile
);
}
static
ssize_t
isku_sysfs_set_actual_profile
(
struct
device
*
dev
,
...
...
drivers/hid/hid-roccat-kone.c
View file @
88a8049f
...
...
@@ -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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
kone
->
actual_profile
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
kone
->
actual_dpi
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
weight
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
kone
->
firmware_version
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
kone
->
settings
.
tcu
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
kone
->
settings
.
startup_profile
);
return
s
ysfs_emit
(
buf
,
"%d
\n
"
,
kone
->
settings
.
startup_profile
);
}
static
ssize_t
kone_sysfs_set_startup_profile
(
struct
device
*
dev
,
...
...
drivers/hid/hid-roccat-koneplus.c
View file @
88a8049f
...
...
@@ -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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
koneplus
->
actual_profile
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
info
.
firmware_version
);
return
s
ysfs_emit
(
buf
,
"%d
\n
"
,
info
.
firmware_version
);
}
static
DEVICE_ATTR
(
firmware_version
,
0440
,
koneplus_sysfs_show_firmware_version
,
NULL
);
...
...
drivers/hid/hid-roccat-kovaplus.c
View file @
88a8049f
...
...
@@ -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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
kovaplus
->
actual_profile
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
kovaplus
->
actual_cpi
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
kovaplus
->
actual_x_sensitivity
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
kovaplus
->
actual_y_sensitivity
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
info
.
firmware_version
);
return
s
ysfs_emit
(
buf
,
"%d
\n
"
,
info
.
firmware_version
);
}
static
DEVICE_ATTR
(
firmware_version
,
0440
,
kovaplus_sysfs_show_firmware_version
,
NULL
);
...
...
drivers/hid/hid-roccat-pyra.c
View file @
88a8049f
...
...
@@ -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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
pyra
->
actual_cpi
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
settings
.
startup_profile
);
return
s
ysfs_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
s
nprintf
(
buf
,
PAGE_SIZE
,
"%d
\n
"
,
info
.
firmware_version
);
return
s
ysfs_emit
(
buf
,
"%d
\n
"
,
info
.
firmware_version
);
}
static
DEVICE_ATTR
(
firmware_version
,
0440
,
pyra_sysfs_show_firmware_version
,
NULL
);
...
...
drivers/hid/hid-sensor-custom.c
View file @
88a8049f
...
...
@@ -155,7 +155,7 @@ static ssize_t enable_sensor_show(struct device *dev,
{
struct
hid_sensor_custom
*
sensor_inst
=
dev_get_drvdata
(
dev
);
return
s
printf
(
buf
,
"%d
\n
"
,
sensor_inst
->
enable
);
return
s
ysfs_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
s
printf
(
buf
,
"not-specified
\n
"
);
return
s
ysfs_emit
(
buf
,
"not-specified
\n
"
);
}
else
return
-
EINVAL
;
return
s
printf
(
buf
,
"%d
\n
"
,
value
);
return
s
ysfs_emit
(
buf
,
"%d
\n
"
,
value
);
}
static
ssize_t
store_value
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment