lkml.org 
[lkml]   [2023]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v9 3/6] iommufd: Add iommufd_access_change_ioas helper
On Thu, Jul 27, 2023 at 11:40:17AM -0300, Jason Gunthorpe wrote:
> On Thu, Jul 27, 2023 at 12:23:08AM -0700, Nicolin Chen wrote:

> > + if (new_ioas) {
> > + rc = iopt_add_access(&new_ioas->iopt, access);
> > + if (rc) {
> > + iommufd_put_object(&new_ioas->obj);
> > + access->ioas = cur_ioas;
> > + return rc;
> > + }
> > + iommufd_ref_to_users(&new_ioas->obj);
>
> Kevin's suggestion to just open code the refcount_inc here

Will replace this iommufd_ref_to_users with a refcount_inc in v10.

> And have a wrapper func that does:
>
> iommufd_access_change_ioas_id(struct iommufd_access *access, u32 id)
> {
> struct iommufd_ioas *ioas = iommufd_get_ioas(ictx, ioas_id);
> int rc;
>
> if (IS_ERR(ioas))
> return PTR_ERR(ioas);
> rc = iommufd_access_change_ioas(access, ioas);
> iommufd_put_object(&ioas->obj);
> return rc;
> }
>
> Does looks cleaner

I see. So we can drop iommufd_put_object(&new_ioas->obj) in
iommufd_access_change_ioas().

> Then we delete iommufd_ref_to_users() as there are no users (once all
> the branches are merged).

Ack.

Nicolin

\
 
 \ /
  Last update: 2023-07-27 20:50    [W:0.028 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site