Messages in this thread | | | Date | Thu, 27 Jul 2023 11:47:32 -0700 | From | Nicolin Chen <> | Subject | Re: [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
| |