Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

atp870u: Introduce atp870_init()

Move 870-specific init code to a separate function atp870_init()

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Ondrej Zary and committed by
Martin K. Petersen
4190230e ecc6ff95

+53 -49
+53 -49
drivers/scsi/atp870u.c
··· 1249 1249 atp_writeb_io(atp, c, 0x11, 0x20); 1250 1250 } 1251 1251 1252 + static void atp870_init(struct Scsi_Host *shpnt) 1253 + { 1254 + struct atp_unit *atpdev = shost_priv(shpnt); 1255 + struct pci_dev *pdev = atpdev->pdev; 1256 + unsigned char k, host_id; 1257 + u8 scam_on; 1258 + bool wide_chip = 1259 + (pdev->device == PCI_DEVICE_ID_ARTOP_AEC7610 && 1260 + pdev->revision == 4) || 1261 + (pdev->device == PCI_DEVICE_ID_ARTOP_AEC7612UW) || 1262 + (pdev->device == PCI_DEVICE_ID_ARTOP_AEC7612SUW); 1263 + 1264 + pci_read_config_byte(pdev, 0x49, &host_id); 1265 + 1266 + dev_info(&pdev->dev, "ACARD AEC-671X PCI Ultra/W SCSI-2/3 Host Adapter: IO:%lx, IRQ:%d.\n", 1267 + shpnt->io_port, shpnt->irq); 1268 + 1269 + atpdev->ioport[0] = shpnt->io_port; 1270 + atpdev->pciport[0] = shpnt->io_port + 0x20; 1271 + host_id &= 0x07; 1272 + atpdev->host_id[0] = host_id; 1273 + scam_on = atp_readb_pci(atpdev, 0, 2); 1274 + atpdev->global_map[0] = atp_readb_base(atpdev, 0x2d); 1275 + atpdev->ultra_map[0] = atp_readw_base(atpdev, 0x2e); 1276 + 1277 + if (atpdev->ultra_map[0] == 0) { 1278 + scam_on = 0x00; 1279 + atpdev->global_map[0] = 0x20; 1280 + atpdev->ultra_map[0] = 0xffff; 1281 + } 1282 + 1283 + if (pdev->revision > 0x07) /* check if atp876 chip */ 1284 + atp_writeb_base(atpdev, 0x3e, 0x00); /* enable terminator */ 1285 + 1286 + k = (atp_readb_base(atpdev, 0x3a) & 0xf3) | 0x10; 1287 + atp_writeb_base(atpdev, 0x3a, k); 1288 + atp_writeb_base(atpdev, 0x3a, k & 0xdf); 1289 + mdelay(32); 1290 + atp_writeb_base(atpdev, 0x3a, k); 1291 + mdelay(32); 1292 + atp_set_host_id(atpdev, 0, host_id); 1293 + 1294 + tscam(shpnt, wide_chip, scam_on); 1295 + atp_writeb_base(atpdev, 0x3a, atp_readb_base(atpdev, 0x3a) | 0x10); 1296 + atp_is(atpdev, 0, wide_chip, 0); 1297 + atp_writeb_base(atpdev, 0x3a, atp_readb_base(atpdev, 0x3a) & 0xef); 1298 + atp_writeb_base(atpdev, 0x3b, atp_readb_base(atpdev, 0x3b) | 0x20); 1299 + shpnt->max_id = wide_chip ? 16 : 8; 1300 + shpnt->this_id = host_id; 1301 + } 1302 + 1252 1303 static void atp880_init(struct Scsi_Host *shpnt) 1253 1304 { 1254 1305 struct atp_unit *atpdev = shost_priv(shpnt); ··· 1496 1445 /* return non-zero on detection */ 1497 1446 static int atp870u_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 1498 1447 { 1499 - unsigned char k; 1500 - unsigned int error; 1501 - unsigned char host_id; 1502 1448 struct Scsi_Host *shpnt = NULL; 1503 1449 struct atp_unit *atpdev; 1504 1450 int err; ··· 1548 1500 atp880_init(shpnt); 1549 1501 else if (is885(atpdev)) 1550 1502 atp885_init(shpnt); 1551 - else { 1552 - u8 scam_on; 1553 - bool wide_chip = 1554 - (ent->device == PCI_DEVICE_ID_ARTOP_AEC7610 && 1555 - pdev->revision == 4) || 1556 - (ent->device == PCI_DEVICE_ID_ARTOP_AEC7612UW) || 1557 - (ent->device == PCI_DEVICE_ID_ARTOP_AEC7612SUW); 1558 - error = pci_read_config_byte(pdev, 0x49, &host_id); 1503 + else 1504 + atp870_init(shpnt); 1559 1505 1560 - printk(KERN_INFO " ACARD AEC-671X PCI Ultra/W SCSI-2/3 Host Adapter: " 1561 - "IO:%lx, IRQ:%d.\n", shpnt->io_port, shpnt->irq); 1562 - 1563 - atpdev->ioport[0] = shpnt->io_port; 1564 - atpdev->pciport[0] = shpnt->io_port + 0x20; 1565 - host_id &= 0x07; 1566 - atpdev->host_id[0] = host_id; 1567 - scam_on = atp_readb_pci(atpdev, 0, 2); 1568 - atpdev->global_map[0] = atp_readb_base(atpdev, 0x2d); 1569 - atpdev->ultra_map[0] = atp_readw_base(atpdev, 0x2e); 1570 - 1571 - if (atpdev->ultra_map[0] == 0) { 1572 - scam_on = 0x00; 1573 - atpdev->global_map[0] = 0x20; 1574 - atpdev->ultra_map[0] = 0xffff; 1575 - } 1576 - 1577 - if (pdev->revision > 0x07) /* check if atp876 chip then enable terminator */ 1578 - atp_writeb_base(atpdev, 0x3e, 0x00); 1579 - 1580 - k = (atp_readb_base(atpdev, 0x3a) & 0xf3) | 0x10; 1581 - atp_writeb_base(atpdev, 0x3a, k); 1582 - atp_writeb_base(atpdev, 0x3a, k & 0xdf); 1583 - mdelay(32); 1584 - atp_writeb_base(atpdev, 0x3a, k); 1585 - mdelay(32); 1586 - atp_set_host_id(atpdev, 0, host_id); 1587 - 1588 - 1589 - tscam(shpnt, wide_chip, scam_on); 1590 - atp_writeb_base(atpdev, 0x3a, atp_readb_base(atpdev, 0x3a) | 0x10); 1591 - atp_is(atpdev, 0, wide_chip, 0); 1592 - atp_writeb_base(atpdev, 0x3a, atp_readb_base(atpdev, 0x3a) & 0xef); 1593 - atp_writeb_base(atpdev, 0x3b, atp_readb_base(atpdev, 0x3b) | 0x20); 1594 - shpnt->max_id = wide_chip ? 16 : 8; 1595 - shpnt->this_id = host_id; 1596 - 1597 - } 1598 1506 err = request_irq(shpnt->irq, atp870u_intr_handle, IRQF_SHARED, "atp870u", shpnt); 1599 1507 if (err) { 1600 1508 dev_err(&pdev->dev, "Unable to allocate IRQ %d.\n", shpnt->irq);