diff options
| author | Dmitry Torokhov <[email protected]> | 2022-12-12 10:47:03 -0800 |
|---|---|---|
| committer | Dmitry Torokhov <[email protected]> | 2022-12-12 10:47:03 -0800 |
| commit | e291c116f60f3c1ca98090f0f8e7c77e658562fb (patch) | |
| tree | 2fbe810f2a6f8b29f1cdaefd87b24debbfa0ec07 /drivers/acpi/utils.c | |
| parent | 8c9a59939deb4bfafdc451100c03d1e848b4169b (diff) | |
| parent | c3991107a28a5ad0bd90660ca3bbf8c2c220ea98 (diff) | |
Merge branch 'next' into for-linus
Prepare input updates for 6.2 merge window.
Diffstat (limited to 'drivers/acpi/utils.c')
| -rw-r--r-- | drivers/acpi/utils.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 5a7b8065e77f..2ea14648a661 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -794,6 +794,30 @@ bool acpi_dev_hid_uid_match(struct acpi_device *adev, EXPORT_SYMBOL(acpi_dev_hid_uid_match); /** + * acpi_dev_uid_to_integer - treat ACPI device _UID as integer + * @adev: ACPI device to get _UID from + * @integer: output buffer for integer + * + * Considers _UID as integer and converts it to @integer. + * + * Returns 0 on success, or negative error code otherwise. + */ +int acpi_dev_uid_to_integer(struct acpi_device *adev, u64 *integer) +{ + const char *uid; + + if (!adev) + return -ENODEV; + + uid = acpi_device_uid(adev); + if (!uid) + return -ENODATA; + + return kstrtou64(uid, 0, integer); +} +EXPORT_SYMBOL(acpi_dev_uid_to_integer); + +/** * acpi_dev_found - Detect presence of a given ACPI device in the namespace. * @hid: Hardware ID of the device. * @@ -878,7 +902,7 @@ bool acpi_dev_present(const char *hid, const char *uid, s64 hrv) struct acpi_dev_match_info match = {}; struct device *dev; - strlcpy(match.hid[0].id, hid, sizeof(match.hid[0].id)); + strscpy(match.hid[0].id, hid, sizeof(match.hid[0].id)); match.uid = uid; match.hrv = hrv; @@ -911,7 +935,7 @@ acpi_dev_get_next_match_dev(struct acpi_device *adev, const char *hid, const cha struct acpi_dev_match_info match = {}; struct device *dev; - strlcpy(match.hid[0].id, hid, sizeof(match.hid[0].id)); + strscpy(match.hid[0].id, hid, sizeof(match.hid[0].id)); match.uid = uid; match.hrv = hrv; @@ -961,7 +985,7 @@ EXPORT_SYMBOL(acpi_video_backlight_string); static int __init acpi_backlight(char *str) { - strlcpy(acpi_video_backlight_string, str, + strscpy(acpi_video_backlight_string, str, sizeof(acpi_video_backlight_string)); return 1; } |