diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/lockref.c | 3 | ||||
| -rw-r--r-- | lib/test_firmware.c | 14 |
2 files changed, 10 insertions, 7 deletions
diff --git a/lib/lockref.c b/lib/lockref.c index 3d468b53d4c9..5b34bbd3eba8 100644 --- a/lib/lockref.c +++ b/lib/lockref.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | * failure case. | 9 | * failure case. |
| 10 | */ | 10 | */ |
| 11 | #define CMPXCHG_LOOP(CODE, SUCCESS) do { \ | 11 | #define CMPXCHG_LOOP(CODE, SUCCESS) do { \ |
| 12 | int retry = 100; \ | ||
| 12 | struct lockref old; \ | 13 | struct lockref old; \ |
| 13 | BUILD_BUG_ON(sizeof(old) != 8); \ | 14 | BUILD_BUG_ON(sizeof(old) != 8); \ |
| 14 | old.lock_count = READ_ONCE(lockref->lock_count); \ | 15 | old.lock_count = READ_ONCE(lockref->lock_count); \ |
| @@ -21,6 +22,8 @@ | |||
| 21 | if (likely(old.lock_count == prev.lock_count)) { \ | 22 | if (likely(old.lock_count == prev.lock_count)) { \ |
| 22 | SUCCESS; \ | 23 | SUCCESS; \ |
| 23 | } \ | 24 | } \ |
| 25 | if (!--retry) \ | ||
| 26 | break; \ | ||
| 24 | cpu_relax(); \ | 27 | cpu_relax(); \ |
| 25 | } \ | 28 | } \ |
| 26 | } while (0) | 29 | } while (0) |
diff --git a/lib/test_firmware.c b/lib/test_firmware.c index 787c146eb485..83ea6c4e623c 100644 --- a/lib/test_firmware.c +++ b/lib/test_firmware.c | |||
| @@ -224,30 +224,30 @@ static ssize_t config_show(struct device *dev, | |||
| 224 | 224 | ||
| 225 | mutex_lock(&test_fw_mutex); | 225 | mutex_lock(&test_fw_mutex); |
| 226 | 226 | ||
| 227 | len += snprintf(buf, PAGE_SIZE, | 227 | len += scnprintf(buf, PAGE_SIZE - len, |
| 228 | "Custom trigger configuration for: %s\n", | 228 | "Custom trigger configuration for: %s\n", |
| 229 | dev_name(dev)); | 229 | dev_name(dev)); |
| 230 | 230 | ||
| 231 | if (test_fw_config->name) | 231 | if (test_fw_config->name) |
| 232 | len += snprintf(buf+len, PAGE_SIZE, | 232 | len += scnprintf(buf+len, PAGE_SIZE - len, |
| 233 | "name:\t%s\n", | 233 | "name:\t%s\n", |
| 234 | test_fw_config->name); | 234 | test_fw_config->name); |
| 235 | else | 235 | else |
| 236 | len += snprintf(buf+len, PAGE_SIZE, | 236 | len += scnprintf(buf+len, PAGE_SIZE - len, |
| 237 | "name:\tEMTPY\n"); | 237 | "name:\tEMTPY\n"); |
| 238 | 238 | ||
| 239 | len += snprintf(buf+len, PAGE_SIZE, | 239 | len += scnprintf(buf+len, PAGE_SIZE - len, |
| 240 | "num_requests:\t%u\n", test_fw_config->num_requests); | 240 | "num_requests:\t%u\n", test_fw_config->num_requests); |
| 241 | 241 | ||
| 242 | len += snprintf(buf+len, PAGE_SIZE, | 242 | len += scnprintf(buf+len, PAGE_SIZE - len, |
| 243 | "send_uevent:\t\t%s\n", | 243 | "send_uevent:\t\t%s\n", |
| 244 | test_fw_config->send_uevent ? | 244 | test_fw_config->send_uevent ? |
| 245 | "FW_ACTION_HOTPLUG" : | 245 | "FW_ACTION_HOTPLUG" : |
| 246 | "FW_ACTION_NOHOTPLUG"); | 246 | "FW_ACTION_NOHOTPLUG"); |
| 247 | len += snprintf(buf+len, PAGE_SIZE, | 247 | len += scnprintf(buf+len, PAGE_SIZE - len, |
| 248 | "sync_direct:\t\t%s\n", | 248 | "sync_direct:\t\t%s\n", |
| 249 | test_fw_config->sync_direct ? "true" : "false"); | 249 | test_fw_config->sync_direct ? "true" : "false"); |
| 250 | len += snprintf(buf+len, PAGE_SIZE, | 250 | len += scnprintf(buf+len, PAGE_SIZE - len, |
| 251 | "read_fw_idx:\t%u\n", test_fw_config->read_fw_idx); | 251 | "read_fw_idx:\t%u\n", test_fw_config->read_fw_idx); |
| 252 | 252 | ||
| 253 | mutex_unlock(&test_fw_mutex); | 253 | mutex_unlock(&test_fw_mutex); |
