Re: [net-next PATCH v3 1/1] atm: remove deprecated use of pci api
From: chas williams - CONTRACTOR Date: Fri, 16 Jan 2015 08:57:21 -0500 > Signed-off-by: Chas Williams - CONTRACTOR Applied, thanks Chas. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [net-next PATCH v3 1/1] atm: remove deprecated use of pci api
On 16/01/2015 15:52, chas williams - CONTRACTOR wrote: On Fri, 16 Jan 2015 15:10:25 +0100 Quentin Lambert wrote: -u32 dma_addr = pci_map_single((struct pci_dev*)fore200e->bus_dev, virt_addr, size, direction); +u32 dma_addr = dma_map_single(&((struct pci_dev *) fore200e->bus_dev)->dev, virt_addr, size, direction); DPRINTK(3, "PCI DVMA mapping: virt_addr = 0x%p, size = %d, direction = %d, --> dma_addr = 0x%08x\n", virt_addr, size, direction, dma_addr); [] I am going try to make similar changes in some other part of the kernel and I was wondering if you could explain how you decided it wasn't necessary to check for "((struct pci_dev *) fore200e->bus_dev" nullity for instance. This gets set up in fore200e_pca_detect() which is pretty early in the intialization process. We don't get as far as using any of the "DVMA" stubs unless pci_enable_device() succeeds, meaning pci_dev is good, and fore200e->bus_dev is assigned to pci_dev (around line 2724). fore200e->bus_dev is never cleared back to NULL, but obviously you shouldn't be using any of the DMA routines after disabling the pci device. Hopefully the driver shuts down in an orderly fashion such that all DMA is over by the time the driver disables the pci device. Thank you -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [net-next PATCH v3 1/1] atm: remove deprecated use of pci api
On Fri, 16 Jan 2015 15:10:25 +0100 Quentin Lambert wrote: > > -u32 dma_addr = pci_map_single((struct pci_dev*)fore200e->bus_dev, > > virt_addr, size, direction); > > +u32 dma_addr = dma_map_single(&((struct pci_dev *) > > fore200e->bus_dev)->dev, virt_addr, size, direction); > > > > DPRINTK(3, "PCI DVMA mapping: virt_addr = 0x%p, size = %d, direction > > = %d, --> dma_addr = 0x%08x\n", > > virt_addr, size, direction, dma_addr); > > > [] > > I am going try to make similar changes in some other part of the kernel and > I was wondering if you could explain how you decided it wasn't necessary to > check for "((struct pci_dev *) fore200e->bus_dev" nullity for instance. This gets set up in fore200e_pca_detect() which is pretty early in the intialization process. We don't get as far as using any of the "DVMA" stubs unless pci_enable_device() succeeds, meaning pci_dev is good, and fore200e->bus_dev is assigned to pci_dev (around line 2724). fore200e->bus_dev is never cleared back to NULL, but obviously you shouldn't be using any of the DMA routines after disabling the pci device. Hopefully the driver shuts down in an orderly fashion such that all DMA is over by the time the driver disables the pci device. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [net-next PATCH v3 1/1] atm: remove deprecated use of pci api
On 16/01/2015 14:57, chas williams - CONTRACTOR wrote: Signed-off-by: Chas Williams - CONTRACTOR --- drivers/atm/eni.c | 33 +++-- drivers/atm/fore200e.c | 22 + drivers/atm/he.c| 125 +--- drivers/atm/he.h| 4 +- drivers/atm/idt77252.c | 107 ++--- drivers/atm/iphase.c| 54 +++-- drivers/atm/lanai.c | 14 ++ drivers/atm/nicstar.c | 60 +++ drivers/atm/solos-pci.c | 26 +- drivers/atm/zatm.c | 17 --- 10 files changed, 243 insertions(+), 219 deletions(-) [] diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index d5d9eaf..75dde90 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c @@ -425,7 +425,7 @@ static void fore200e_pca_write(u32 val, volatile u32 __iomem *addr) static u32 fore200e_pca_dma_map(struct fore200e* fore200e, void* virt_addr, int size, int direction) { -u32 dma_addr = pci_map_single((struct pci_dev*)fore200e->bus_dev, virt_addr, size, direction); +u32 dma_addr = dma_map_single(&((struct pci_dev *) fore200e->bus_dev)->dev, virt_addr, size, direction); DPRINTK(3, "PCI DVMA mapping: virt_addr = 0x%p, size = %d, direction = %d, --> dma_addr = 0x%08x\n", virt_addr, size, direction, dma_addr); [] I am going try to make similar changes in some other part of the kernel and I was wondering if you could explain how you decided it wasn't necessary to check for "((struct pci_dev *) fore200e->bus_dev" nullity for instance. Thanks, Quentin -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/