Doug, Forgot to comment on this: > +MODULE_PARM_DESC(zbc, "'none' [0]; 'aware' [1]; 'managed' [2] (def=0). Can have 'host_' prefix"); [...] > +static int sdeb_zbc_model_str(const char *cp) > +{ > + int res = -EINVAL; > + > + if (isalpha(cp[0])) { > + if (strstr(cp, "none")) > + res = BLK_ZONED_NONE; > + else if (strstr(cp, "aware")) > + res = BLK_ZONED_HA; > + else if (strstr(cp, "managed")) > + res = BLK_ZONED_HM; > + } else { > + int n, ret; > + > + ret = kstrtoint(cp, 0, &n); > + if (ret) > + return ret; > + if (n >= 0 || n <= 2) > + res = n; > + } > + return res; > +} > + > +static ssize_t zbc_show(struct device_driver *ddp, char *buf) > +{ > + switch (sdeb_zbc_model) { > + case BLK_ZONED_NONE: /* 0 */ > + return scnprintf(buf, PAGE_SIZE, "none\n"); > + case BLK_ZONED_HA: /* 1, not yet supported */ > + return scnprintf(buf, PAGE_SIZE, "host_aware\n"); > + case BLK_ZONED_HM: /* 2 */ > + return scnprintf(buf, PAGE_SIZE, "host_managed\n"); > + default: > + return scnprintf(buf, PAGE_SIZE, "unknown_zbc_model [0x%x]\n", > + (unsigned int)sdeb_zbc_model); > + } > +} static const char *zbc_model[] = { [BLK_ZONED_NONE] = "none", [BLK_ZONED_HA] = "host_aware", [BLK_ZONED_HM] = "host_managed", }; [...] And then in parameter parsing you can do: sdeb_zbc_model = sysfs_match_string(zbc_model, buf); if (sdeb_zbc_model < 0) return -EINVAL; zbc_show() can go away and you can do: pr_info(".... %s\n", zbc_model[sdeb_zbc_model]); -- Martin K. Petersen Oracle Linux Engineering