[PATCH V6 1/1] nvme: allow passthru cmd error logging
Chaitanya Kulkarni
chaitanyak at nvidia.com
Wed Aug 2 10:14:45 PDT 2023
On 8/2/2023 5:01 AM, Christoph Hellwig wrote:
>> +
>> + if (ctrl->passthru_log_err)
>> + return sysfs_emit(buf, "on\n");
>> +
>> + return sysfs_emit(buf, "off\n");
>
> return sysfs_emit(buf, ctrl->passthru_log_err ? "on" : "off");
okay..
>
>> +}
>> +
>> +static ssize_t nvme_passthru_err_log_store(struct device *dev,
>> + struct device_attribute *attr, const char *buf, size_t count)
>> +{
>> + struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
>> + int passthru_enable, err;
>> +
>> + err = kstrtoint(buf, 10, &passthru_enable);
>> + if (err)
>> + return -EINVAL;
>> +
>> + switch (passthru_enable) {
>> + case true:
>> + case false:
>> + ctrl->passthru_log_err = passthru_enable;
>> + break;
>> + default:
>> + pr_err("invlid value %d for admin error logging [on:1 off:0]\n",
>> + passthru_enable);
>> + break;
>> + }
>> + return count;
>
> This should use kstrtobool.
indeed, forget to change it to bool will add to next version ..
>
> Also I thik the flag feels a bit too sparse. Why not
> something like passthru_err_log_enabled that explains what it does?
sure, I'll send V7 with above changes ..
-ck
More information about the Linux-nvme
mailing list