From: Frederic Barrat <fbarrat@linux.ibm.com> To: "Alastair D'Silva" <alastair@au1.ibm.com> Cc: "Alastair D'Silva" <alastair@d-silva.org>, Andrew Donnellan <andrew.donnellan@au1.ibm.com>, Arnd Bergmann <arnd@arndb.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH 5/7] ocxl: Create a clear delineation between ocxl backend & frontend Date: Thu, 14 Mar 2019 17:27:06 +0100 [thread overview] Message-ID: <e7ea8286-afb4-bf93-d2fa-190f4b4e3ea5@linux.ibm.com> (raw) In-Reply-To: <20190313041524.14644-6-alastair@au1.ibm.com> > diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c > index 865b3d176431..424bb0b40afb 100644 > --- a/drivers/misc/ocxl/file.c > +++ b/drivers/misc/ocxl/file.c > -int ocxl_register_afu(struct ocxl_afu *afu) > +int ocxl_file_register_afu(struct ocxl_afu *afu) > { > int minor; > + int rc; > + struct ocxl_file_info *info; > + struct ocxl_fn *fn = afu->fn; > + struct pci_dev *pci_dev = to_pci_dev(fn->dev.parent); > + > + info = kzalloc(sizeof(*info), GFP_KERNEL); > + if (info == NULL) > + return -ENOMEM; > > - minor = allocate_afu_minor(afu); > - if (minor < 0) > + info->afu = afu; > + > + minor = allocate_minor(info); > + if (minor < 0) { > + kfree(info); > return minor; > - afu->dev.devt = MKDEV(MAJOR(ocxl_dev), minor); > - afu->dev.class = ocxl_class; > - return device_register(&afu->dev); > + } > + > + info->dev.parent = &fn->dev; > + info->dev.devt = MKDEV(MAJOR(ocxl_dev), minor); > + info->dev.class = ocxl_class; > + > + ocxl_afu_set_private(afu, info, ocxl_file_release); We no longer define a 'release' method for the AFU device. We need one, which should in turn free the info struct when the device ref count hits 0. That should explain the following error seen when unloading the driver: "Device 'xyz' does not have a release() function, it is broken and must be fixed. See Documentation/kobject.txt" Fred
WARNING: multiple messages have this Message-ID (diff)
From: Frederic Barrat <fbarrat@linux.ibm.com> To: "Alastair D'Silva" <alastair@au1.ibm.com> Cc: Arnd Bergmann <arnd@arndb.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Andrew Donnellan <andrew.donnellan@au1.ibm.com>, Alastair D'Silva <alastair@d-silva.org>, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH 5/7] ocxl: Create a clear delineation between ocxl backend & frontend Date: Thu, 14 Mar 2019 17:27:06 +0100 [thread overview] Message-ID: <e7ea8286-afb4-bf93-d2fa-190f4b4e3ea5@linux.ibm.com> (raw) In-Reply-To: <20190313041524.14644-6-alastair@au1.ibm.com> > diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c > index 865b3d176431..424bb0b40afb 100644 > --- a/drivers/misc/ocxl/file.c > +++ b/drivers/misc/ocxl/file.c > -int ocxl_register_afu(struct ocxl_afu *afu) > +int ocxl_file_register_afu(struct ocxl_afu *afu) > { > int minor; > + int rc; > + struct ocxl_file_info *info; > + struct ocxl_fn *fn = afu->fn; > + struct pci_dev *pci_dev = to_pci_dev(fn->dev.parent); > + > + info = kzalloc(sizeof(*info), GFP_KERNEL); > + if (info == NULL) > + return -ENOMEM; > > - minor = allocate_afu_minor(afu); > - if (minor < 0) > + info->afu = afu; > + > + minor = allocate_minor(info); > + if (minor < 0) { > + kfree(info); > return minor; > - afu->dev.devt = MKDEV(MAJOR(ocxl_dev), minor); > - afu->dev.class = ocxl_class; > - return device_register(&afu->dev); > + } > + > + info->dev.parent = &fn->dev; > + info->dev.devt = MKDEV(MAJOR(ocxl_dev), minor); > + info->dev.class = ocxl_class; > + > + ocxl_afu_set_private(afu, info, ocxl_file_release); We no longer define a 'release' method for the AFU device. We need one, which should in turn free the info struct when the device ref count hits 0. That should explain the following error seen when unloading the driver: "Device 'xyz' does not have a release() function, it is broken and must be fixed. See Documentation/kobject.txt" Fred
next prev parent reply other threads:[~2019-03-14 16:27 UTC|newest] Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-03-13 4:15 [PATCH 0/7] Refactor OCXL driver to allow external drivers to use it Alastair D'Silva 2019-03-13 4:15 ` Alastair D'Silva 2019-03-13 4:15 ` [PATCH 1/7] ocxl: Provide global MMIO accessors for external drivers Alastair D'Silva 2019-03-13 4:15 ` Alastair D'Silva 2019-03-13 18:06 ` Frederic Barrat 2019-03-13 18:06 ` Frederic Barrat 2019-03-15 4:11 ` Andrew Donnellan 2019-03-15 4:11 ` Andrew Donnellan 2019-03-13 4:15 ` [PATCH 2/7] ocxl: Allow external drivers to use OpenCAPI contexts Alastair D'Silva 2019-03-13 4:15 ` Alastair D'Silva 2019-03-13 18:20 ` Frederic Barrat 2019-03-13 18:20 ` Frederic Barrat 2019-03-13 4:15 ` [PATCH 3/7] ocxl: Split pci.c Alastair D'Silva 2019-03-13 4:15 ` Alastair D'Silva 2019-03-14 16:48 ` Frederic Barrat 2019-03-13 4:15 ` [PATCH 4/7] ocxl: Don't pass pci_dev around Alastair D'Silva 2019-03-13 4:15 ` Alastair D'Silva 2019-03-14 17:00 ` Frederic Barrat 2019-03-14 17:00 ` Frederic Barrat 2019-03-15 3:32 ` Andrew Donnellan 2019-03-15 3:32 ` Andrew Donnellan 2019-03-13 4:15 ` [PATCH 5/7] ocxl: Create a clear delineation between ocxl backend & frontend Alastair D'Silva 2019-03-13 4:15 ` Alastair D'Silva 2019-03-14 16:27 ` Frederic Barrat [this message] 2019-03-14 16:27 ` Frederic Barrat 2019-03-13 4:15 ` [PATCH 6/7] ocxl: afu_irq only deals with IRQ IDs, not offsets Alastair D'Silva 2019-03-13 4:15 ` Alastair D'Silva 2019-03-15 13:56 ` Greg Kurz 2019-03-20 0:28 ` Alastair D'Silva 2019-03-13 4:15 ` [PATCH 7/7] ocxl: move event_fd handling to frontend Alastair D'Silva 2019-03-13 4:15 ` Alastair D'Silva 2019-03-20 5:08 ` [PATCH v2 0/7] Refactor OCXL driver to allow external drivers to use it Alastair D'Silva 2019-03-20 5:08 ` Alastair D'Silva 2019-03-20 5:08 ` [PATCH v2 1/7] ocxl: Split pci.c Alastair D'Silva 2019-03-20 5:08 ` Alastair D'Silva 2019-03-20 5:08 ` [PATCH v2 2/7] ocxl: Don't pass pci_dev around Alastair D'Silva 2019-03-20 5:08 ` Alastair D'Silva 2019-03-20 5:08 ` [PATCH v2 3/7] ocxl: Create a clear delineation between ocxl backend & frontend Alastair D'Silva 2019-03-20 5:08 ` Alastair D'Silva 2019-03-22 17:38 ` Frederic Barrat 2019-03-22 17:38 ` Frederic Barrat 2019-03-20 5:08 ` [PATCH v2 4/7] ocxl: Allow external drivers to use OpenCAPI contexts Alastair D'Silva 2019-03-20 5:08 ` Alastair D'Silva 2019-03-20 5:08 ` [PATCH v2 5/7] ocxl: afu_irq only deals with IRQ IDs, not offsets Alastair D'Silva 2019-03-20 5:08 ` Alastair D'Silva 2019-03-20 5:08 ` [PATCH v2 6/7] ocxl: move event_fd handling to frontend Alastair D'Silva 2019-03-20 5:08 ` Alastair D'Silva 2019-03-20 5:08 ` [PATCH v2 7/7] ocxl: Provide global MMIO accessors for external drivers Alastair D'Silva 2019-03-20 5:08 ` Alastair D'Silva
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=e7ea8286-afb4-bf93-d2fa-190f4b4e3ea5@linux.ibm.com \ --to=fbarrat@linux.ibm.com \ --cc=alastair@au1.ibm.com \ --cc=alastair@d-silva.org \ --cc=andrew.donnellan@au1.ibm.com \ --cc=arnd@arndb.de \ --cc=gregkh@linuxfoundation.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.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.