diff options
Diffstat (limited to 'drivers/base/memory.c')
-rw-r--r-- | drivers/base/memory.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 89f752dd8465..a2e13e250bba 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
@@ -284,7 +284,7 @@ static int memory_subsys_online(struct device *dev) | |||
284 | * attribute and need to set the online_type. | 284 | * attribute and need to set the online_type. |
285 | */ | 285 | */ |
286 | if (mem->online_type < 0) | 286 | if (mem->online_type < 0) |
287 | mem->online_type = ONLINE_KEEP; | 287 | mem->online_type = MMOP_ONLINE_KEEP; |
288 | 288 | ||
289 | ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE); | 289 | ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE); |
290 | 290 | ||
@@ -315,23 +315,23 @@ store_mem_state(struct device *dev, | |||
315 | if (ret) | 315 | if (ret) |
316 | return ret; | 316 | return ret; |
317 | 317 | ||
318 | if (!strncmp(buf, "online_kernel", min_t(int, count, 13))) | 318 | if (sysfs_streq(buf, "online_kernel")) |
319 | online_type = ONLINE_KERNEL; | 319 | online_type = MMOP_ONLINE_KERNEL; |
320 | else if (!strncmp(buf, "online_movable", min_t(int, count, 14))) | 320 | else if (sysfs_streq(buf, "online_movable")) |
321 | online_type = ONLINE_MOVABLE; | 321 | online_type = MMOP_ONLINE_MOVABLE; |
322 | else if (!strncmp(buf, "online", min_t(int, count, 6))) | 322 | else if (sysfs_streq(buf, "online")) |
323 | online_type = ONLINE_KEEP; | 323 | online_type = MMOP_ONLINE_KEEP; |
324 | else if (!strncmp(buf, "offline", min_t(int, count, 7))) | 324 | else if (sysfs_streq(buf, "offline")) |
325 | online_type = -1; | 325 | online_type = MMOP_OFFLINE; |
326 | else { | 326 | else { |
327 | ret = -EINVAL; | 327 | ret = -EINVAL; |
328 | goto err; | 328 | goto err; |
329 | } | 329 | } |
330 | 330 | ||
331 | switch (online_type) { | 331 | switch (online_type) { |
332 | case ONLINE_KERNEL: | 332 | case MMOP_ONLINE_KERNEL: |
333 | case ONLINE_MOVABLE: | 333 | case MMOP_ONLINE_MOVABLE: |
334 | case ONLINE_KEEP: | 334 | case MMOP_ONLINE_KEEP: |
335 | /* | 335 | /* |
336 | * mem->online_type is not protected so there can be a | 336 | * mem->online_type is not protected so there can be a |
337 | * race here. However, when racing online, the first | 337 | * race here. However, when racing online, the first |
@@ -342,7 +342,7 @@ store_mem_state(struct device *dev, | |||
342 | mem->online_type = online_type; | 342 | mem->online_type = online_type; |
343 | ret = device_online(&mem->dev); | 343 | ret = device_online(&mem->dev); |
344 | break; | 344 | break; |
345 | case -1: | 345 | case MMOP_OFFLINE: |
346 | ret = device_offline(&mem->dev); | 346 | ret = device_offline(&mem->dev); |
347 | break; | 347 | break; |
348 | default: | 348 | default: |
@@ -406,7 +406,9 @@ memory_probe_store(struct device *dev, struct device_attribute *attr, | |||
406 | int i, ret; | 406 | int i, ret; |
407 | unsigned long pages_per_block = PAGES_PER_SECTION * sections_per_block; | 407 | unsigned long pages_per_block = PAGES_PER_SECTION * sections_per_block; |
408 | 408 | ||
409 | phys_addr = simple_strtoull(buf, NULL, 0); | 409 | ret = kstrtoull(buf, 0, &phys_addr); |
410 | if (ret) | ||
411 | return ret; | ||
410 | 412 | ||
411 | if (phys_addr & ((pages_per_block << PAGE_SHIFT) - 1)) | 413 | if (phys_addr & ((pages_per_block << PAGE_SHIFT) - 1)) |
412 | return -EINVAL; | 414 | return -EINVAL; |