On Wed, Feb 21, 2018 at 2:06 PM, Dave Jiang <[email protected]> wrote: > Adding all option to allow ndctl to update all DIMMs at once. > > Signed-off-by: Dave Jiang <[email protected]> > --- > ndctl/update.c | 25 ++++++++++++++++--------- > 1 file changed, 16 insertions(+), 9 deletions(-) > > diff --git a/ndctl/update.c b/ndctl/update.c > index fc26acf..1b771ff 100644 > --- a/ndctl/update.c > +++ b/ndctl/update.c > @@ -77,6 +77,7 @@ struct update_context { > struct ndctl_dimm *dimm; > struct fw_info dimm_fw; > struct ndctl_cmd *start; > + bool all; > }; > > /* > @@ -471,16 +472,23 @@ static int get_ndctl_dimm(struct update_context *uctx, > void *ctx) > { > struct ndctl_dimm *dimm; > struct ndctl_bus *bus; > + int rc = -ENODEV; > > ndctl_bus_foreach(ctx, bus) > ndctl_dimm_foreach(bus, dimm) { > - if (!util_dimm_filter(dimm, uctx->dimm_id)) > + if (!uctx->all && > + !util_dimm_filter(dimm, uctx->dimm_id)) > continue; > uctx->dimm = dimm; > - return 0; > + rc = update_firmware(uctx); > + if (rc < 0) { > + error("Update firmware for dimm %s failed\n", > + ndctl_dimm_get_devname(dimm)); > + continue; > + }
No need to special case "all" support, it's handled explicitly as a supported dimm-id string in util_dimm_filter(). In fact, all the util_<object>_filter() helpers support "all" as a special case. _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
