Commit 9b5a18e1 authored by Sergei Shtylylov's avatar Sergei Shtylylov Committed by Bartlomiej Zolnierkiewicz

sgiioc4: fix messages

Fix several issues with the log messages printed by ide_dma_sgiioc4() and
sgiioc4_ide_setup_pci_device():

- IOC4 registers are memory-mapped but the "BM-DMA at" format corresponds to
  I/O  mapped registers;

- "%p" format specifiers and type casts used to print non-pointer values;

- using KERN_INFO log level for the error message;

- 'hwif->name' printed as drive's name.

While at it, also:

- return more fitting -EBUSY if request_mem_region() fails;

- make the error message style consistent;

- fix indentation, put the printk() facility and message on the same line;

- use comparisions with NULL instead of ! operator..
Signed-off-by: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: jeremy@sgi.com
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent aa95f0e7
...@@ -339,23 +339,20 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d) ...@@ -339,23 +339,20 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d)
if (dma_base == 0) if (dma_base == 0)
return -1; return -1;
printk(KERN_INFO "%s: BM-DMA at 0x%04lx-0x%04lx\n", hwif->name, printk(KERN_INFO " %s: MMIO-DMA\n", hwif->name);
dma_base, dma_base + num_ports - 1);
if (!request_mem_region(dma_base, num_ports, hwif->name)) { if (request_mem_region(dma_base, num_ports, hwif->name) == NULL) {
printk(KERN_ERR printk(KERN_ERR "%s(%s) -- ERROR: addresses 0x%08lx to 0x%08lx "
"%s(%s) -- ERROR, Addresses 0x%p to 0x%p " "already in use\n", __func__, hwif->name,
"ALREADY in use\n", dma_base, dma_base + num_ports - 1);
__func__, hwif->name, (void *) dma_base,
(void *) dma_base + num_ports - 1);
return -1; return -1;
} }
virt_dma_base = ioremap(dma_base, num_ports); virt_dma_base = ioremap(dma_base, num_ports);
if (virt_dma_base == NULL) { if (virt_dma_base == NULL) {
printk(KERN_ERR printk(KERN_ERR "%s(%s) -- ERROR: unable to map addresses "
"%s(%s) -- ERROR, Unable to map addresses 0x%lx to 0x%lx\n", "0x%lx to 0x%lx\n", __func__, hwif->name,
__func__, hwif->name, dma_base, dma_base + num_ports - 1); dma_base, dma_base + num_ports - 1);
goto dma_remap_failure; goto dma_remap_failure;
} }
hwif->dma_base = (unsigned long) virt_dma_base; hwif->dma_base = (unsigned long) virt_dma_base;
...@@ -378,11 +375,9 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d) ...@@ -378,11 +375,9 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d)
pci_free_consistent(dev, IOC4_PRD_ENTRIES * IOC4_PRD_BYTES, pci_free_consistent(dev, IOC4_PRD_ENTRIES * IOC4_PRD_BYTES,
hwif->dmatable_cpu, hwif->dmatable_dma); hwif->dmatable_cpu, hwif->dmatable_dma);
printk(KERN_INFO printk(KERN_ERR "%s(%s) -- ERROR: Unable to allocate DMA maps\n",
"%s() -- Error! Unable to allocate DMA Maps for drive %s\n",
__func__, hwif->name); __func__, hwif->name);
printk(KERN_INFO printk(KERN_INFO "%s: changing from DMA to PIO mode", hwif->name);
"Changing from DMA to PIO mode for Drive %s\n", hwif->name);
dma_pci_alloc_failure: dma_pci_alloc_failure:
iounmap(virt_dma_base); iounmap(virt_dma_base);
...@@ -618,14 +613,12 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) ...@@ -618,14 +613,12 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
irqport = (unsigned long) virt_base + IOC4_INTR_OFFSET; irqport = (unsigned long) virt_base + IOC4_INTR_OFFSET;
cmd_phys_base = bar0 + IOC4_CMD_OFFSET; cmd_phys_base = bar0 + IOC4_CMD_OFFSET;
if (!request_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE, if (request_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE,
DRV_NAME)) { DRV_NAME) == NULL) {
printk(KERN_ERR printk(KERN_ERR "%s %s -- ERROR: addresses 0x%08lx to 0x%08lx "
"%s %s: -- ERROR, Addresses " "already in use\n", DRV_NAME, pci_name(dev),
"0x%p to 0x%p ALREADY in use\n", cmd_phys_base, cmd_phys_base + IOC4_CMD_CTL_BLK_SIZE);
DRV_NAME, pci_name(dev), (void *)cmd_phys_base, return -EBUSY;
(void *) cmd_phys_base + IOC4_CMD_CTL_BLK_SIZE);
return -ENOMEM;
} }
/* Initialize the IO registers */ /* Initialize the IO registers */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment