From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752421AbbJNJgd (ORCPT ); Wed, 14 Oct 2015 05:36:33 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:58078 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751257AbbJNJg3 (ORCPT ); Wed, 14 Oct 2015 05:36:29 -0400 From: Arnd Bergmann To: Ley Foon Tan Cc: Bjorn Helgaas , Russell King , Marc Zyngier , Dinh Nguyen , linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Lorenzo Pieralisi Subject: Re: [PATCH v9 3/6] pci:host: Add Altera PCIe host controller driver Date: Wed, 14 Oct 2015 11:36:04 +0200 Message-ID: <5210459.PtmhWaT6RM@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: References: <1444790492-4051-1-git-send-email-lftan@altera.com> <5088538.zEUtS0EC0S@wuerfel> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:Ip8bOVulcbI7+6qeKT9sbCKgCB3GmnyHqkX+uuOINfhzK77YZIp 4IrHpJVnlRXFChuZVJy0++znNvPJelPOA8xaqEJippvW95MHIs4HiCKVB13ZaeqkMmgkWpR 9p8aUBYb/b0UiCf1E/uiTLaOvBPzGI2H8ElbJQRulZZU1rxeNoIDv1FyfQxZWYuYrTuzfpK GJUsTC2aszXBihYNndkzQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:NLBRcLgPeeY=:PnV/Vrxr7gkwtM6QdWumRQ RfwPrmt20meVNJB55pemV1Yg2Cxj+qx1lpSl0EeW42gCXyMrDUzvi/8KJhPGLzeY/UmlYGkZf yCx0ZIZ7B8bn7kcwedEgXwQwMUPTHwNi9EgQT+Tt+y61RjJ63OLAHOW6lb1Z7LgRHCT/1GWmg qJ8NhtaOuVraUIJMfI7dcXdRCXtP9HC3b4wGE6e6W9bcQy7psIP/KJwHHNEsiOwg1VU/HjBkV gPtO63fsDOK4+h9eRi0C/1ZwRZkByxYMIEuk86mOt6boil+QZG5xRpVnAOIRyJzBswtYE9dLi j8FHpb6BK9t4iyb1M2JWV50FmnMCADfO66Bggj96P7U4kjI/q2zrdfaZNdKqmVee08jE9XosC zVJb0tLNOu/VFZvT0uordOgQp9AMBvx7RuLcYgbWq/PSoJ6iPjZBrK63ugs7YawEJc0V4PCt2 yHmv2R85LV0LhDWGptdOBb4vLVKqf2NfYoqIEcG87JyZKkYIByuOMyptsSIIhv7k54C9ivj5y k9AwJqL0wwB8ZVXZ8ji4XhBg2rOgUhO3FMJb0lJsXxo+WzrPbV1Onor/KTXJG6u0k90s1EPGt lMhoPgNpmIY3seMkQgZUuaMGq67pp3JlRtCJs2kXHXmD0TwsAhrhhxXL8ZECZXFf9MoE1qNOi i4ihKlOUzcf520m5RSm/EddV6c8a0YtI6OWtVnTIVUfJUF54m8vU4duv3mpFz8IWiE2wLvnQu i/HMdM3EYyHbIi8H Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 14 October 2015 17:28:45 Ley Foon Tan wrote: > On Wed, Oct 14, 2015 at 5:09 PM, Arnd Bergmann wrote: > > On Wednesday 14 October 2015 16:32:25 Ley Foon Tan wrote: > >> On Wed, Oct 14, 2015 at 4:20 PM, Arnd Bergmann wrote: > >> > On Wednesday 14 October 2015 10:41:29 Ley Foon Tan wrote: > >> >> +static int altera_pcie_remove(struct platform_device *pdev) > >> >> +{ > >> >> + struct altera_pcie *pcie = platform_get_drvdata(pdev); > >> >> + > >> >> + altera_pcie_free_irq_domain(pcie); > >> >> + platform_set_drvdata(pdev, NULL); > >> >> + return 0; > >> >> +} > >> > > >> > I just noticed this. Does it actually work to unload the module > >> > and tear down all the pci_dev structures in a safe way? > >> Good catch. It only can be compiled as builtin-moduley now, so we can > >> remove this _remove callback function. > > > > I think we should change both: make it possible to load the > > driver dynamically, and remove the altera_pcie_remove function. > This driver depends on the pci fixups to work correctly. But, fixups > callback functions in this driver are not being call if the driver is > loadable module. Ah, I see. We should find a better way to deal with this, as we are getting an increasing number of host driver specific fixups. Bjorn, do you have any idea here? Could we perhaps have a helper function that lets us register fixups dynamically? > The linker script keeps all pci fixup callbacks in pci fixup regions > during kernel compile time. So, it needs to be builtin module. Do you > know any way we can update those fixup regions? The only method I'm aware of at the moment is move the fixups to drivers/pci/quirks.c and enclose them in an #ifdef if you want them to not appear in kernels that don't support your SoC. > > You can prevent the module from being unloaded if you also remove > > the module_platform_driver() directive and add a module_init() > > without a matching module_exit(). > > > > Please also add a '.suppress_bind_attrs = true,' flag in the driver > > struct to prevent manual unbinding. > I think we don't need these if it only can work as builtin module. No, this is orthogonal, you need it either way, as built-in drivers can still be unbound by writing to sysfs. Try writing the device name to /sys/bus/platform/drivers/altera-pcie/unbind and watch it blow up ;-) Arnd