2022-04-06 05:47:33

by Bart Van Assche

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] rpmb: add Replay Protected Memory Block (RPMB) subsystem

On 4/5/22 02:37, Alex Bennée wrote:
> +int rpmb_get_write_count(struct rpmb_dev *rdev, int len, u8 *request, int rlen, u8 *resp)
> +{
> + int err;
> +
> + if (!rdev)
> + return -EINVAL;
> +
> + mutex_lock(&rdev->lock);
> + err = -EOPNOTSUPP;
> + if (rdev->ops && rdev->ops->get_write_count)
> + err = rdev->ops->get_write_count(rdev->dev.parent, rdev->target,
> + len, request, rlen, resp);
> + mutex_unlock(&rdev->lock);
> +
> + return err;
> +}

The names rpmb_get_write_count() and get_write_count() look confusing to
me since these functions query the write counter. How about adding "er"
at the end of both function names?

Are there any plans to add an implementation of struct rpmb_ops for UFS
devices?

Thanks,

Bart.


2022-04-06 16:04:55

by Alex Bennée

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] rpmb: add Replay Protected Memory Block (RPMB) subsystem


Bart Van Assche <[email protected]> writes:

> On 4/5/22 02:37, Alex Bennée wrote:
>> +int rpmb_get_write_count(struct rpmb_dev *rdev, int len, u8 *request, int rlen, u8 *resp)
>> +{
>> + int err;
>> +
>> + if (!rdev)
>> + return -EINVAL;
>> +
>> + mutex_lock(&rdev->lock);
>> + err = -EOPNOTSUPP;
>> + if (rdev->ops && rdev->ops->get_write_count)
>> + err = rdev->ops->get_write_count(rdev->dev.parent, rdev->target,
>> + len, request, rlen, resp);
>> + mutex_unlock(&rdev->lock);
>> +
>> + return err;
>> +}
>
> The names rpmb_get_write_count() and get_write_count() look confusing
> to me since these functions query the write counter. How about adding
> "er" at the end of both function names?
>
> Are there any plans to add an implementation of struct rpmb_ops for
> UFS devices?

Not by me but I agree it would be a useful exercise to see if a unified
API makes sense.

--
Alex Bennée