Re: [RFC 08/19] s390/zcrypt: support for assigning adapters to matrix mdev
From: Cornelia Huck
Date: Fri Nov 17 2017 - 04:50:59 EST
On Thu, 16 Nov 2017 18:53:07 -0500
Tony Krowiak <akrowiak@xxxxxxxxxxxxxxxxxx> wrote:
> On 11/14/2017 08:22 AM, Cornelia Huck wrote:
> > On Fri, 13 Oct 2017 13:38:53 -0400
> > Tony Krowiak <akrowiak@xxxxxxxxxxxxxxxxxx> wrote:
> >> +static ssize_t ap_matrix_adapters_assign(struct device *dev,
> >> + struct device_attribute *attr,
> >> + const char *buf, size_t count)
> >> +{
> >> + int ret;
> >> + unsigned int apid;
> >> + struct mdev_device *mdev = mdev_from_dev(dev);
> >> + struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev);
> >> +
> >> + ret = ap_matrix_parse_id(buf, &apid);
> I'm going to replace this with a call to kstrtouint (buf, 0, &apid). This
> will allow the user to enter the adapter ID string using conventional
> semantics - e.g., 71 or 0x47 - and the function will determine if the
> value is valid.
Using an existing interface sounds good.