Re: [PATCH v4 2/2] misc: open-dice: Add driver to expose DICE data to userspace

From: David Brazdil
Date: Wed Dec 15 2021 - 10:45:51 EST


On Wed, Dec 15, 2021 at 04:19:35PM +0100, Greg Kroah-Hartman wrote:
> On Wed, Dec 15, 2021 at 03:04:10PM +0000, David Brazdil wrote:
> > + drvdata = devm_kmalloc(dev, sizeof(*drvdata), GFP_KERNEL);
> > + if (!drvdata)
> > + return -ENOMEM;
> > +
> > + *drvdata = (struct open_dice_drvdata){
> > + .lock = __SPIN_LOCK_UNLOCKED(drvdata->lock),
> > + .rmem = rmem,
> > + .misc = (struct miscdevice){
> > + .parent = dev,
> > + .name = drvdata->name,
> > + .minor = MISC_DYNAMIC_MINOR,
> > + .fops = &open_dice_fops,
> > + .mode = 0600,
> > + },
> > + };
>
> That is a lovely abuse of an implicit memcpy(), took me a while to
> realize what it was doing here...
>
> Anyway, this all looks great to me, I'll wait for the DT maintainers to
> review the dt change before being able to take this through my tree.
> Thanks for the cleanups based on the review, the driver is now almost
> 1/3 smaller than your first version with more functionality!

Thanks, and thank your for your help!

David