From patchwork Sun Jul 26 20:24:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 6867131 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D9D1FC05AC for ; Sun, 26 Jul 2015 20:57:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED72620654 for ; Sun, 26 Jul 2015 20:57:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 05E6C206DC for ; Sun, 26 Jul 2015 20:57:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755485AbbGZU5V (ORCPT ); Sun, 26 Jul 2015 16:57:21 -0400 Received: from ns.gsystem.sk ([62.176.172.50]:56682 "EHLO gsystem.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755475AbbGZU5U (ORCPT ); Sun, 26 Jul 2015 16:57:20 -0400 Received: from stip-static-68.213-81-217.telecom.sk ([213.81.217.68] helo=gsql.ggedos.sk) by gsystem.sk with esmtpsa (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1ZJSU0-0003IN-N9 for linux-scsi@vger.kernel.org; Sun, 26 Jul 2015 22:25:16 +0200 From: Ondrej Zary To: linux-scsi@vger.kernel.org Subject: [PATCH 43/52] atp870u: Remove chip_ver from struct atp_unit Date: Sun, 26 Jul 2015 22:24:50 +0200 Message-Id: <1437942299-26674-44-git-send-email-linux@rainbow-software.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1437942299-26674-1-git-send-email-linux@rainbow-software.org> References: <1437942299-26674-1-git-send-email-linux@rainbow-software.org> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/scsi/atp870u.c | 39 ++++++++++++++------------------------- drivers/scsi/atp870u.h | 1 - 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index 128613e..f92eb00 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c @@ -954,7 +954,7 @@ static unsigned char fun_scam(struct atp_unit *dev, unsigned short int *val) return j; } -static void tscam(struct Scsi_Host *host) +static void tscam(struct Scsi_Host *host, bool wide_chip) { unsigned char i, j, k; @@ -983,7 +983,7 @@ static void tscam(struct Scsi_Host *host) m = 1; m <<= dev->host_id[0]; j = 16; - if (dev->chip_ver < 4) { + if (!wide_chip) { m |= 0xff00; j = 8; } @@ -1012,7 +1012,7 @@ static void tscam(struct Scsi_Host *host) k = i; } atp_writeb_io(dev, 0, 0x15, k); - if (dev->chip_ver == 4) + if (wide_chip) atp_writeb_io(dev, 0, 0x1b, 0x01); else atp_writeb_io(dev, 0, 0x1b, 0x00); @@ -1278,25 +1278,11 @@ static int atp870u_probe(struct pci_dev *pdev, const struct pci_device_id *ent) atpdev->pdev = pdev; pci_set_drvdata(pdev, atpdev); - switch (ent->device) { - case PCI_DEVICE_ID_ARTOP_AEC7610: - atpdev->chip_ver = pdev->revision; - break; - case PCI_DEVICE_ID_ARTOP_AEC7612UW: - case PCI_DEVICE_ID_ARTOP_AEC7612SUW: - case ATP880_DEVID1: - case ATP880_DEVID2: - case ATP885_DEVID: - atpdev->chip_ver = 0x04; - default: - break; - } base_io = pci_resource_start(pdev, 0); base_io &= 0xfffffff8; atpdev->baseport = base_io; if ((ent->device == ATP880_DEVID1)||(ent->device == ATP880_DEVID2)) { - atpdev->chip_ver = pdev->revision; pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x80);//JCC082803 atpdev->ioport[0] = base_io + 0x40; @@ -1390,7 +1376,7 @@ flash_ok_880: atp_set_host_id(atpdev, 0, host_id); - tscam(shpnt); + tscam(shpnt, true); atp_is(atpdev, 0, true, atp_readb_base(atpdev, 0x3f) & 0x40); atp_writeb_base(atpdev, 0x38, 0xb0); shpnt->max_id = 16; @@ -1536,6 +1522,11 @@ flash_ok_885: shpnt->irq = pdev->irq; } else { + bool wide_chip = + (ent->device == PCI_DEVICE_ID_ARTOP_AEC7610 && + pdev->revision == 4) || + (ent->device == PCI_DEVICE_ID_ARTOP_AEC7612UW) || + (ent->device == PCI_DEVICE_ID_ARTOP_AEC7612SUW); error = pci_read_config_byte(pdev, 0x49, &host_id); printk(KERN_INFO " ACARD AEC-671X PCI Ultra/W SCSI-2/3 Host Adapter: " @@ -1569,7 +1560,7 @@ flash_ok_885: } spin_lock_irqsave(shpnt->host_lock, flags); - if (atpdev->chip_ver > 0x07) /* check if atp876 chip then enable terminator */ + if (pdev->revision > 0x07) /* check if atp876 chip then enable terminator */ atp_writeb_base(atpdev, 0x3e, 0x00); k = (atp_readb_base(atpdev, 0x3a) & 0xf3) | 0x10; @@ -1580,15 +1571,13 @@ flash_ok_885: mdelay(32); atp_set_host_id(atpdev, 0, host_id); - tscam(shpnt); + + tscam(shpnt, wide_chip); atp_writeb_base(atpdev, 0x3a, atp_readb_base(atpdev, 0x3a) | 0x10); - atp_is(atpdev, 0, atpdev->chip_ver == 4, 0); + atp_is(atpdev, 0, wide_chip, 0); atp_writeb_base(atpdev, 0x3a, atp_readb_base(atpdev, 0x3a) & 0xef); atp_writeb_base(atpdev, 0x3b, atp_readb_base(atpdev, 0x3b) | 0x20); - if (atpdev->chip_ver == 4) - shpnt->max_id = 16; - else - shpnt->max_id = 8; + shpnt->max_id = wide_chip ? 16 : 8; shpnt->this_id = host_id; shpnt->unique_id = base_io; shpnt->io_port = base_io; diff --git a/drivers/scsi/atp870u.h b/drivers/scsi/atp870u.h index c3c6c13..8c47c53 100644 --- a/drivers/scsi/atp870u.h +++ b/drivers/scsi/atp870u.h @@ -32,7 +32,6 @@ struct atp_unit unsigned char quhd[2]; unsigned char quend[2]; unsigned char global_map[2]; - unsigned char chip_ver; unsigned char scam_on; unsigned char host_id[2]; unsigned int working[2];