Commit dd5a5f7951e253b81ac480a63dfd8b826a9ef61e

Authored by Ondrej Zary
Committed by Martin K. Petersen
1 parent b1e850630b

atp870u: Remove chip_ver from struct atp_unit

chip_ver is used for wide chip detection only. Remove it and use a local
variable instead (for 870; 880 and 885 are always wide).

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>

Showing 2 changed files with 14 additions and 26 deletions Side-by-side Diff

drivers/scsi/atp870u.c
... ... @@ -954,7 +954,7 @@
954 954 return j;
955 955 }
956 956  
957   -static void tscam(struct Scsi_Host *host)
  957 +static void tscam(struct Scsi_Host *host, bool wide_chip)
958 958 {
959 959  
960 960 unsigned char i, j, k;
... ... @@ -983,7 +983,7 @@
983 983 m = 1;
984 984 m <<= dev->host_id[0];
985 985 j = 16;
986   - if (dev->chip_ver < 4) {
  986 + if (!wide_chip) {
987 987 m |= 0xff00;
988 988 j = 8;
989 989 }
... ... @@ -1012,7 +1012,7 @@
1012 1012 k = i;
1013 1013 }
1014 1014 atp_writeb_io(dev, 0, 0x15, k);
1015   - if (dev->chip_ver == 4)
  1015 + if (wide_chip)
1016 1016 atp_writeb_io(dev, 0, 0x1b, 0x01);
1017 1017 else
1018 1018 atp_writeb_io(dev, 0, 0x1b, 0x00);
1019 1019  
... ... @@ -1278,25 +1278,11 @@
1278 1278 atpdev->pdev = pdev;
1279 1279 pci_set_drvdata(pdev, atpdev);
1280 1280  
1281   - switch (ent->device) {
1282   - case PCI_DEVICE_ID_ARTOP_AEC7610:
1283   - atpdev->chip_ver = pdev->revision;
1284   - break;
1285   - case PCI_DEVICE_ID_ARTOP_AEC7612UW:
1286   - case PCI_DEVICE_ID_ARTOP_AEC7612SUW:
1287   - case ATP880_DEVID1:
1288   - case ATP880_DEVID2:
1289   - case ATP885_DEVID:
1290   - atpdev->chip_ver = 0x04;
1291   - default:
1292   - break;
1293   - }
1294 1281 base_io = pci_resource_start(pdev, 0);
1295 1282 base_io &= 0xfffffff8;
1296 1283 atpdev->baseport = base_io;
1297 1284  
1298 1285 if ((ent->device == ATP880_DEVID1)||(ent->device == ATP880_DEVID2)) {
1299   - atpdev->chip_ver = pdev->revision;
1300 1286 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x80);//JCC082803
1301 1287  
1302 1288 atpdev->ioport[0] = base_io + 0x40;
... ... @@ -1390,7 +1376,7 @@
1390 1376  
1391 1377 atp_set_host_id(atpdev, 0, host_id);
1392 1378  
1393   - tscam(shpnt);
  1379 + tscam(shpnt, true);
1394 1380 atp_is(atpdev, 0, true, atp_readb_base(atpdev, 0x3f) & 0x40);
1395 1381 atp_writeb_base(atpdev, 0x38, 0xb0);
1396 1382 shpnt->max_id = 16;
... ... @@ -1536,6 +1522,11 @@
1536 1522 shpnt->irq = pdev->irq;
1537 1523  
1538 1524 } else {
  1525 + bool wide_chip =
  1526 + (ent->device == PCI_DEVICE_ID_ARTOP_AEC7610 &&
  1527 + pdev->revision == 4) ||
  1528 + (ent->device == PCI_DEVICE_ID_ARTOP_AEC7612UW) ||
  1529 + (ent->device == PCI_DEVICE_ID_ARTOP_AEC7612SUW);
1539 1530 error = pci_read_config_byte(pdev, 0x49, &host_id);
1540 1531  
1541 1532 printk(KERN_INFO " ACARD AEC-671X PCI Ultra/W SCSI-2/3 Host Adapter: "
... ... @@ -1569,7 +1560,7 @@
1569 1560 }
1570 1561  
1571 1562 spin_lock_irqsave(shpnt->host_lock, flags);
1572   - if (atpdev->chip_ver > 0x07) /* check if atp876 chip then enable terminator */
  1563 + if (pdev->revision > 0x07) /* check if atp876 chip then enable terminator */
1573 1564 atp_writeb_base(atpdev, 0x3e, 0x00);
1574 1565  
1575 1566 k = (atp_readb_base(atpdev, 0x3a) & 0xf3) | 0x10;
1576 1567  
1577 1568  
... ... @@ -1580,15 +1571,13 @@
1580 1571 mdelay(32);
1581 1572 atp_set_host_id(atpdev, 0, host_id);
1582 1573  
1583   - tscam(shpnt);
  1574 +
  1575 + tscam(shpnt, wide_chip);
1584 1576 atp_writeb_base(atpdev, 0x3a, atp_readb_base(atpdev, 0x3a) | 0x10);
1585   - atp_is(atpdev, 0, atpdev->chip_ver == 4, 0);
  1577 + atp_is(atpdev, 0, wide_chip, 0);
1586 1578 atp_writeb_base(atpdev, 0x3a, atp_readb_base(atpdev, 0x3a) & 0xef);
1587 1579 atp_writeb_base(atpdev, 0x3b, atp_readb_base(atpdev, 0x3b) | 0x20);
1588   - if (atpdev->chip_ver == 4)
1589   - shpnt->max_id = 16;
1590   - else
1591   - shpnt->max_id = 8;
  1580 + shpnt->max_id = wide_chip ? 16 : 8;
1592 1581 shpnt->this_id = host_id;
1593 1582 shpnt->unique_id = base_io;
1594 1583 shpnt->io_port = base_io;
drivers/scsi/atp870u.h
... ... @@ -32,7 +32,6 @@
32 32 unsigned char quhd[2];
33 33 unsigned char quend[2];
34 34 unsigned char global_map[2];
35   - unsigned char chip_ver;
36 35 unsigned char scam_on;
37 36 unsigned char host_id[2];
38 37 unsigned int working[2];