diff options
Diffstat (limited to 'arch/powerpc/platforms/pseries/reconfig.c')
-rw-r--r-- | arch/powerpc/platforms/pseries/reconfig.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c index dfa2ebd2deb5..7637bd38c795 100644 --- a/arch/powerpc/platforms/pseries/reconfig.c +++ b/arch/powerpc/platforms/pseries/reconfig.c | |||
@@ -422,8 +422,8 @@ static int do_update_property(char *buf, size_t bufsize) | |||
422 | { | 422 | { |
423 | struct device_node *np; | 423 | struct device_node *np; |
424 | unsigned char *value; | 424 | unsigned char *value; |
425 | char *name, *end; | 425 | char *name, *end, *next_prop; |
426 | int length; | 426 | int rc, length; |
427 | struct property *newprop, *oldprop; | 427 | struct property *newprop, *oldprop; |
428 | buf = parse_node(buf, bufsize, &np); | 428 | buf = parse_node(buf, bufsize, &np); |
429 | end = buf + bufsize; | 429 | end = buf + bufsize; |
@@ -431,7 +431,8 @@ static int do_update_property(char *buf, size_t bufsize) | |||
431 | if (!np) | 431 | if (!np) |
432 | return -ENODEV; | 432 | return -ENODEV; |
433 | 433 | ||
434 | if (parse_next_property(buf, end, &name, &length, &value) == NULL) | 434 | next_prop = parse_next_property(buf, end, &name, &length, &value); |
435 | if (!next_prop) | ||
435 | return -EINVAL; | 436 | return -EINVAL; |
436 | 437 | ||
437 | newprop = new_property(name, length, value, NULL); | 438 | newprop = new_property(name, length, value, NULL); |
@@ -442,7 +443,34 @@ static int do_update_property(char *buf, size_t bufsize) | |||
442 | if (!oldprop) | 443 | if (!oldprop) |
443 | return -ENODEV; | 444 | return -ENODEV; |
444 | 445 | ||
445 | return prom_update_property(np, newprop, oldprop); | 446 | rc = prom_update_property(np, newprop, oldprop); |
447 | if (rc) | ||
448 | return rc; | ||
449 | |||
450 | /* For memory under the ibm,dynamic-reconfiguration-memory node | ||
451 | * of the device tree, adding and removing memory is just an update | ||
452 | * to the ibm,dynamic-memory property instead of adding/removing a | ||
453 | * memory node in the device tree. For these cases we still need to | ||
454 | * involve the notifier chain. | ||
455 | */ | ||
456 | if (!strcmp(name, "ibm,dynamic-memory")) { | ||
457 | int action; | ||
458 | |||
459 | next_prop = parse_next_property(next_prop, end, &name, | ||
460 | &length, &value); | ||
461 | if (!next_prop) | ||
462 | return -EINVAL; | ||
463 | |||
464 | if (!strcmp(name, "add")) | ||
465 | action = PSERIES_DRCONF_MEM_ADD; | ||
466 | else | ||
467 | action = PSERIES_DRCONF_MEM_REMOVE; | ||
468 | |||
469 | blocking_notifier_call_chain(&pSeries_reconfig_chain, | ||
470 | action, value); | ||
471 | } | ||
472 | |||
473 | return 0; | ||
446 | } | 474 | } |
447 | 475 | ||
448 | /** | 476 | /** |