From patchwork Fri Jan 29 16:04:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 43934 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7A748B7D1D for ; Sat, 30 Jan 2010 03:04:36 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753529Ab0A2QE3 (ORCPT ); Fri, 29 Jan 2010 11:04:29 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751801Ab0A2QET (ORCPT ); Fri, 29 Jan 2010 11:04:19 -0500 Received: from mail-fx0-f220.google.com ([209.85.220.220]:53041 "EHLO mail-fx0-f220.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752909Ab0A2QEQ (ORCPT ); Fri, 29 Jan 2010 11:04:16 -0500 Received: by mail-fx0-f220.google.com with SMTP id 20so2015120fxm.21 for ; Fri, 29 Jan 2010 08:04:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :in-reply-to:references:subject; bh=D43kiUNp4AYfIpShpKv6ZyVGVe4KLoxn2BCokPcU6W0=; b=TKLvM4XY3tWR0oh3MDysfWhYqYjrlP1WRksA6ejy93jcK/U2DjEfNRMUQQmANnN9Jj b8OG3zOrcPx+aOMwdeJnuF4oPBoijbrBaH+MAnmTEVfhRedTzTpJVuAGqB6ROcr+nlTJ GfijL0OlGdtE26CP84DrXnkvrythC760IVUCM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:in-reply-to:references:subject; b=XQ/QpehrLp8MZyZvm8yG6L4V60lsgA45vWg72sGvFIwW6hOuD+8nwTp/ZvSYD3sa1t fr7FDcLkktLpagkM6AjJjQGAe9ESrF3QMf2i9+l01kIF0EcDHIlNqS0jVPikfTq0u0Rn /r26y3WxkTHWYGtTQGLPzl2OA2LBQGj358WIc= Received: by 10.87.11.34 with SMTP id o34mr2209810fgi.26.1264781055185; Fri, 29 Jan 2010 08:04:15 -0800 (PST) Received: from ?127.0.0.1? (chello089079027028.chello.pl [89.79.27.28]) by mx.google.com with ESMTPS id 13sm548369fxm.13.2010.01.29.08.04.14 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 29 Jan 2010 08:04:14 -0800 (PST) From: Bartlomiej Zolnierkiewicz To: linux-ide@vger.kernel.org Cc: Bartlomiej Zolnierkiewicz , linux-kernel@vger.kernel.org Date: Fri, 29 Jan 2010 17:04:08 +0100 Message-Id: <20100129160408.21495.10059.sendpatchset@localhost> In-Reply-To: <20100129160308.21495.14120.sendpatchset@localhost> References: <20100129160308.21495.14120.sendpatchset@localhost> Subject: [PATCH 09/68] ata_piix: factor out short cable detection code to ich_short_ata40() Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org From: Bartlomiej Zolnierkiewicz Subject: [PATCH] ata_piix: factor out short cable detection code to ich_short_ata40() Fix up ich_pata_cable_detect() documentation while at it. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ata/ata_piix.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: b/drivers/ata/ata_piix.c =================================================================== --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c @@ -611,6 +611,21 @@ static const struct ich_laptop ich_lapto { 0, } }; +static int ich_short_ata40(struct pci_dev *pdev) +{ + const struct ich_laptop *lap = &ich_laptop[0]; + + while (lap->device) { + if (lap->device == pdev->device && + lap->subvendor == pdev->subsystem_vendor && + lap->subdevice == pdev->subsystem_device) + return 1; + lap++; + } + + return 0; +} + /** * ich_pata_cable_detect - Probe host controller cable detect info * @ap: Port for which cable detect info is desired @@ -626,18 +641,11 @@ static int ich_pata_cable_detect(struct { struct pci_dev *pdev = to_pci_dev(ap->host->dev); struct piix_host_priv *hpriv = ap->host->private_data; - const struct ich_laptop *lap = &ich_laptop[0]; u8 mask; - /* Check for specials - Acer Aspire 5602WLMi */ - while (lap->device) { - if (lap->device == pdev->device && - lap->subvendor == pdev->subsystem_vendor && - lap->subdevice == pdev->subsystem_device) - return ATA_CBL_PATA40_SHORT; - - lap++; - } + /* check for specials */ + if (ich_short_ata40(pdev)) + return ATA_CBL_PATA40_SHORT; /* check BIOS cable detect results */ mask = ap->port_no == 0 ? PIIX_80C_PRI : PIIX_80C_SEC;