* [PATCH 11/15] ide: PCI BMDMA initialization fixes
@ 2007-10-01 21:38 Bartlomiej Zolnierkiewicz
2007-10-03 13:13 ` Sergei Shtylyov
0 siblings, 1 reply; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-10-01 21:38 UTC (permalink / raw)
To: linux-ide
* Set hwif->dma_base only if allocation of extra ports succeeds.
* Allocate hwif->dmatable_cpu before reserving I/O ports.
While at it:
* Move setting of hwif->dma_{base,master} from ide_{mapped_mmio,iomio}_dma()
to ide_setup_dma().
* Rename 'dma_base' argument to 'base' in ide_setup_dma().
* Remove stale ide_setup_dma() comment.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-dma.c | 30 ++++++++++--------------------
1 file changed, 10 insertions(+), 20 deletions(-)
Index: b/drivers/ide/ide-dma.c
===================================================================
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -956,12 +956,6 @@ static int ide_mapped_mmio_dma(ide_hwif_
{
printk(KERN_INFO " %s: MMIO-DMA ", hwif->name);
- hwif->dma_base = base;
-
- if(hwif->mate)
- hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base;
- else
- hwif->dma_master = base;
return 0;
}
@@ -975,8 +969,6 @@ static int ide_iomio_dma(ide_hwif_t *hwi
return 1;
}
- hwif->dma_base = base;
-
if (hwif->cds->extra) {
hwif->extra_base = base + (hwif->channel ? 8 : 16);
@@ -991,10 +983,6 @@ static int ide_iomio_dma(ide_hwif_t *hwi
}
}
- if(hwif->mate)
- hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base:base;
- else
- hwif->dma_master = base;
return 0;
}
@@ -1006,18 +994,20 @@ static int ide_dma_iobase(ide_hwif_t *hw
return ide_iomio_dma(hwif, base, ports);
}
-/*
- * This can be called for a dynamically installed interface. Don't __init it
- */
-void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_ports)
+void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports)
{
- if (ide_dma_iobase(hwif, dma_base, num_ports))
+ if (ide_allocate_dma_engine(hwif))
return;
- if (ide_allocate_dma_engine(hwif)) {
- ide_release_dma(hwif);
+ if (ide_dma_iobase(hwif, base, num_ports))
return;
- }
+
+ hwif->dma_base = base;
+
+ if (hwif->mate)
+ hwif->dma_master = hwif->channel ? hwif->mate->dma_base : base;
+ else
+ hwif->dma_master = base;
if (!(hwif->dma_command))
hwif->dma_command = hwif->dma_base;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 11/15] ide: PCI BMDMA initialization fixes
2007-10-01 21:38 [PATCH 11/15] ide: PCI BMDMA initialization fixes Bartlomiej Zolnierkiewicz
@ 2007-10-03 13:13 ` Sergei Shtylyov
2007-10-03 21:59 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2007-10-03 13:13 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide
Hello.
Bartlomiej Zolnierkiewicz wrote:
> * Set hwif->dma_base only if allocation of extra ports succeeds.
> * Allocate hwif->dmatable_cpu before reserving I/O ports.
Looks like a bit of teardown code was missed with that change...
> While at it:
> * Move setting of hwif->dma_{base,master} from ide_{mapped_mmio,iomio}_dma()
> to ide_setup_dma().
> * Rename 'dma_base' argument to 'base' in ide_setup_dma().
I'm not sure what that achieves...
> * Remove stale ide_setup_dma() comment.
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> @@ -1006,18 +994,20 @@ static int ide_dma_iobase(ide_hwif_t *hw
> return ide_iomio_dma(hwif, base, ports);
> }
>
> -/*
> - * This can be called for a dynamically installed interface. Don't __init it
> - */
> -void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_ports)
> +void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports)
> {
> - if (ide_dma_iobase(hwif, dma_base, num_ports))
> + if (ide_allocate_dma_engine(hwif))
> return;
>
> - if (ide_allocate_dma_engine(hwif)) {
> - ide_release_dma(hwif);
> + if (ide_dma_iobase(hwif, base, num_ports))
Why no ide_release_dma_engine() call here?
MBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 11/15] ide: PCI BMDMA initialization fixes
2007-10-03 13:13 ` Sergei Shtylyov
@ 2007-10-03 21:59 ` Bartlomiej Zolnierkiewicz
2007-10-24 17:37 ` Sergei Shtylyov
0 siblings, 1 reply; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-10-03 21:59 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: linux-ide
On Wednesday 03 October 2007, Sergei Shtylyov wrote:
> Hello.
>
> Bartlomiej Zolnierkiewicz wrote:
>
> > * Set hwif->dma_base only if allocation of extra ports succeeds.
>
> > * Allocate hwif->dmatable_cpu before reserving I/O ports.
>
> Looks like a bit of teardown code was missed with that change...
Thanks for catching this!
Actually it turns out that the whole change was based on a thinko. :)
> > While at it:
>
> > * Move setting of hwif->dma_{base,master} from ide_{mapped_mmio,iomio}_dma()
> > to ide_setup_dma().
>
> > * Rename 'dma_base' argument to 'base' in ide_setup_dma().
>
> I'm not sure what that achieves...
Makes the code obey 80-columns limit and increases its readability :)
Revised patch follows...
[PATCH] ide: PCI BMDMA initialization fixes (take 2)
* Set hwif->dma_base only if allocation of extra ports succeeds.
While at it:
* Move setting of hwif->dma_{base,master} from ide_{mapped_mmio,iomio}_dma()
to ide_setup_dma().
* Rename 'dma_base' argument to 'base' in ide_setup_dma() (to make the code
obey 80-columns limit and increase its readability).
* Remove stale ide_setup_dma() comment.
v2:
* Change to allocate hwif->dmatable_cpu before reserving I/O ports missed
teardown code (spotted by Sergei). On the second thought this change is
actually unnecessary so revert it in v2.
* Make ide_release_dma_engine() void and remove needless comment.
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide-dma.c | 32 ++++++++++----------------------
1 file changed, 10 insertions(+), 22 deletions(-)
Index: b/drivers/ide/ide-dma.c
===================================================================
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -901,10 +901,7 @@ void ide_dma_timeout (ide_drive_t *drive
EXPORT_SYMBOL(ide_dma_timeout);
-/*
- * Needed for allowing full modular support of ide-driver
- */
-static int ide_release_dma_engine(ide_hwif_t *hwif)
+static void ide_release_dma_engine(ide_hwif_t *hwif)
{
if (hwif->dmatable_cpu) {
pci_free_consistent(hwif->pci_dev,
@@ -913,7 +910,6 @@ static int ide_release_dma_engine(ide_hw
hwif->dmatable_dma);
hwif->dmatable_cpu = NULL;
}
- return 1;
}
static int ide_release_iomio_dma(ide_hwif_t *hwif)
@@ -956,12 +952,6 @@ static int ide_mapped_mmio_dma(ide_hwif_
{
printk(KERN_INFO " %s: MMIO-DMA ", hwif->name);
- hwif->dma_base = base;
-
- if(hwif->mate)
- hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base;
- else
- hwif->dma_master = base;
return 0;
}
@@ -975,8 +965,6 @@ static int ide_iomio_dma(ide_hwif_t *hwi
return 1;
}
- hwif->dma_base = base;
-
if (hwif->cds->extra) {
hwif->extra_base = base + (hwif->channel ? 8 : 16);
@@ -991,10 +979,6 @@ static int ide_iomio_dma(ide_hwif_t *hwi
}
}
- if(hwif->mate)
- hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base:base;
- else
- hwif->dma_master = base;
return 0;
}
@@ -1006,12 +990,9 @@ static int ide_dma_iobase(ide_hwif_t *hw
return ide_iomio_dma(hwif, base, ports);
}
-/*
- * This can be called for a dynamically installed interface. Don't __init it
- */
-void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_ports)
+void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports)
{
- if (ide_dma_iobase(hwif, dma_base, num_ports))
+ if (ide_dma_iobase(hwif, base, num_ports))
return;
if (ide_allocate_dma_engine(hwif)) {
@@ -1019,6 +1000,13 @@ void ide_setup_dma (ide_hwif_t *hwif, un
return;
}
+ hwif->dma_base = base;
+
+ if (hwif->mate)
+ hwif->dma_master = hwif->channel ? hwif->mate->dma_base : base;
+ else
+ hwif->dma_master = base;
+
if (!(hwif->dma_command))
hwif->dma_command = hwif->dma_base;
if (!(hwif->dma_vendor1))
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 11/15] ide: PCI BMDMA initialization fixes
2007-10-03 21:59 ` Bartlomiej Zolnierkiewicz
@ 2007-10-24 17:37 ` Sergei Shtylyov
0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2007-10-24 17:37 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide
Hello.
Bartlomiej Zolnierkiewicz wrote:
> [PATCH] ide: PCI BMDMA initialization fixes (take 2)
> * Set hwif->dma_base only if allocation of extra ports succeeds.
> While at it:
> * Move setting of hwif->dma_{base,master} from ide_{mapped_mmio,iomio}_dma()
> to ide_setup_dma().
> * Rename 'dma_base' argument to 'base' in ide_setup_dma() (to make the code
> obey 80-columns limit and increase its readability).
> * Remove stale ide_setup_dma() comment.
> v2:
> * Change to allocate hwif->dmatable_cpu before reserving I/O ports missed
> teardown code (spotted by Sergei). On the second thought this change is
> actually unnecessary so revert it in v2.
> * Make ide_release_dma_engine() void and remove needless comment.
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
MBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-10-24 17:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-01 21:38 [PATCH 11/15] ide: PCI BMDMA initialization fixes Bartlomiej Zolnierkiewicz
2007-10-03 13:13 ` Sergei Shtylyov
2007-10-03 21:59 ` Bartlomiej Zolnierkiewicz
2007-10-24 17:37 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).