From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: Zhangfei Gao <zhangfei.gao@linaro.org> Cc: Arnd Bergmann <arnd@arndb.de>, Herbert Xu <herbert@gondor.apana.org.au>, jonathan.cameron@huawei.com, dave.jiang@intel.com, grant.likely@arm.com, jean-philippe <jean-philippe@linaro.org>, Jerome Glisse <jglisse@redhat.com>, ilias.apalodimas@linaro.org, francois.ozog@linaro.org, kenneth-lee-2012@foxmail.com, Wangzhou <wangzhou1@hisilicon.com>, "haojian . zhuang" <haojian.zhuang@linaro.org>, guodong.xu@linaro.org, linux-accelerators@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, iommu@lists.linux-foundation.org, Kenneth Lee <liguozhu@hisilicon.com>, Zaibo Xu <xuzaibo@huawei.com> Subject: Re: [PATCH v11 2/4] uacce: add uacce driver Date: Sat, 11 Jan 2020 20:40:06 +0100 [thread overview] Message-ID: <20200111194006.GD435222@kroah.com> (raw) In-Reply-To: <1578710919-12141-3-git-send-email-zhangfei.gao@linaro.org> On Sat, Jan 11, 2020 at 10:48:37AM +0800, Zhangfei Gao wrote: > +static int uacce_fops_open(struct inode *inode, struct file *filep) > +{ > + struct uacce_mm *uacce_mm = NULL; > + struct uacce_device *uacce; > + struct uacce_queue *q; > + int ret = 0; > + > + uacce = xa_load(&uacce_xa, iminor(inode)); > + if (!uacce) > + return -ENODEV; > + > + if (!try_module_get(uacce->parent->driver->owner)) > + return -ENODEV; Why are you trying to grab the module reference of the parent device? Why is that needed and what is that going to help with here? This shouldn't be needed as the module reference of the owner of the fileops for this module is incremented, and the "parent" module depends on this module, so how could it be unloaded without this code being unloaded? Yes, if you build this code into the kernel and the "parent" driver is a module, then you will not have a reference, but when you remove that parent driver the device will be removed as it has to be unregistered before that parent driver can be removed from the system, right? Or what am I missing here? > +static void uacce_release(struct device *dev) > +{ > + struct uacce_device *uacce = to_uacce_device(dev); > + > + kfree(uacce); > + uacce = NULL; That line didn't do anything :) thanks, greg k-h
WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: Zhangfei Gao <zhangfei.gao@linaro.org> Cc: jean-philippe <jean-philippe@linaro.org>, dave.jiang@intel.com, Herbert Xu <herbert@gondor.apana.org.au>, Arnd Bergmann <arnd@arndb.de>, francois.ozog@linaro.org, linux-accelerators@lists.ozlabs.org, ilias.apalodimas@linaro.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Jerome Glisse <jglisse@redhat.com>, grant.likely@arm.com, "haojian . zhuang" <haojian.zhuang@linaro.org>, linux-crypto@vger.kernel.org, Kenneth Lee <liguozhu@hisilicon.com>, guodong.xu@linaro.org, kenneth-lee-2012@foxmail.com Subject: Re: [PATCH v11 2/4] uacce: add uacce driver Date: Sat, 11 Jan 2020 20:40:06 +0100 [thread overview] Message-ID: <20200111194006.GD435222@kroah.com> (raw) In-Reply-To: <1578710919-12141-3-git-send-email-zhangfei.gao@linaro.org> On Sat, Jan 11, 2020 at 10:48:37AM +0800, Zhangfei Gao wrote: > +static int uacce_fops_open(struct inode *inode, struct file *filep) > +{ > + struct uacce_mm *uacce_mm = NULL; > + struct uacce_device *uacce; > + struct uacce_queue *q; > + int ret = 0; > + > + uacce = xa_load(&uacce_xa, iminor(inode)); > + if (!uacce) > + return -ENODEV; > + > + if (!try_module_get(uacce->parent->driver->owner)) > + return -ENODEV; Why are you trying to grab the module reference of the parent device? Why is that needed and what is that going to help with here? This shouldn't be needed as the module reference of the owner of the fileops for this module is incremented, and the "parent" module depends on this module, so how could it be unloaded without this code being unloaded? Yes, if you build this code into the kernel and the "parent" driver is a module, then you will not have a reference, but when you remove that parent driver the device will be removed as it has to be unregistered before that parent driver can be removed from the system, right? Or what am I missing here? > +static void uacce_release(struct device *dev) > +{ > + struct uacce_device *uacce = to_uacce_device(dev); > + > + kfree(uacce); > + uacce = NULL; That line didn't do anything :) thanks, greg k-h _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2020-01-11 20:02 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-11 2:48 [PATCH v11 0/4] Add uacce module for Accelerator Zhangfei Gao 2020-01-11 2:48 ` Zhangfei Gao 2020-01-11 2:48 ` [PATCH v11 1/4] uacce: Add documents for uacce Zhangfei Gao 2020-01-11 2:48 ` Zhangfei Gao 2020-01-11 2:48 ` [PATCH v11 2/4] uacce: add uacce driver Zhangfei Gao 2020-01-11 2:48 ` Zhangfei Gao 2020-01-11 19:40 ` Greg Kroah-Hartman [this message] 2020-01-11 19:40 ` Greg Kroah-Hartman 2020-01-13 3:34 ` zhangfei 2020-01-13 3:34 ` zhangfei 2020-01-14 14:59 ` Greg Kroah-Hartman 2020-01-14 14:59 ` Greg Kroah-Hartman 2020-01-15 11:18 ` zhangfei 2020-01-15 11:18 ` zhangfei 2020-01-15 12:02 ` Greg Kroah-Hartman 2020-01-15 12:02 ` Greg Kroah-Hartman 2020-01-15 14:11 ` zhangfei 2020-01-15 14:11 ` zhangfei 2020-01-15 16:43 ` Dave Jiang 2020-01-15 16:43 ` Dave Jiang 2020-01-16 2:11 ` zhangfei 2020-01-16 2:11 ` zhangfei 2020-01-11 2:48 ` [PATCH v11 3/4] crypto: hisilicon - Remove module_param uacce_mode Zhangfei Gao 2020-01-11 2:48 ` Zhangfei Gao 2020-01-11 2:48 ` [PATCH v11 4/4] crypto: hisilicon - register zip engine to uacce Zhangfei Gao 2020-01-11 2:48 ` Zhangfei Gao
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200111194006.GD435222@kroah.com \ --to=gregkh@linuxfoundation.org \ --cc=arnd@arndb.de \ --cc=dave.jiang@intel.com \ --cc=francois.ozog@linaro.org \ --cc=grant.likely@arm.com \ --cc=guodong.xu@linaro.org \ --cc=haojian.zhuang@linaro.org \ --cc=herbert@gondor.apana.org.au \ --cc=ilias.apalodimas@linaro.org \ --cc=iommu@lists.linux-foundation.org \ --cc=jean-philippe@linaro.org \ --cc=jglisse@redhat.com \ --cc=jonathan.cameron@huawei.com \ --cc=kenneth-lee-2012@foxmail.com \ --cc=liguozhu@hisilicon.com \ --cc=linux-accelerators@lists.ozlabs.org \ --cc=linux-crypto@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=wangzhou1@hisilicon.com \ --cc=xuzaibo@huawei.com \ --cc=zhangfei.gao@linaro.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.