From patchwork Mon Oct 29 15:23:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 195037 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 247632C008F for ; Tue, 30 Oct 2012 02:27:06 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 782324A021; Mon, 29 Oct 2012 16:26:20 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r+gn++gPGtxj; Mon, 29 Oct 2012 16:26:20 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0F8B64A039; Mon, 29 Oct 2012 16:24:57 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0B3DE4A021 for ; Mon, 29 Oct 2012 16:24:55 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id N+8IQgv4bNCt for ; Mon, 29 Oct 2012 16:24:39 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-gg0-f202.google.com (mail-gg0-f202.google.com [209.85.161.202]) by theia.denx.de (Postfix) with ESMTPS id 6BE244A040 for ; Mon, 29 Oct 2012 16:24:23 +0100 (CET) Received: by mail-gg0-f202.google.com with SMTP id i4so646491ggm.3 for ; Mon, 29 Oct 2012 08:24:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=xBiSgweMinOJo2tOF1ay0iri2EftChzs+lJw1Dk+rzg=; b=EiT0gp8bRVBCHxkqzmDTUF14N3O3H8drfkIrKwXd8dhNnAebrbY9skgkHH36qPVe2N hmsNTdgG+j7hK3oZPwb/kBCMWE0MXAF1gtPwxQzqg6WCpAuNiFqg0JOXLG1xZQbRa32x O7ZYZYyFrfzMAlGHQlw/aApr1zc+yINkQYmaFO/PCWH7ZCwCTa+9t8UqxKO1WtO2lBSP Oj5YmY5NCfFhdV6ws9wja+BatfaAjaw92Xo54TFQZK7ZJGBbYmk5OBMxMFbw/7pmb8ze /s0H3sT7D1ABE8jYLrge+CXqLRna5wjS+oCB6l+3DfJ3W0Yeb472J/iUGvvFBPRAR+Iz H+IQ== Received: by 10.236.81.107 with SMTP id l71mr22249462yhe.18.1351524260799; Mon, 29 Oct 2012 08:24:20 -0700 (PDT) Received: from wpzn4.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id b7si713704yhj.1.2012.10.29.08.24.20 (version=TLSv1/SSLv3 cipher=AES128-SHA); Mon, 29 Oct 2012 08:24:20 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by wpzn4.hot.corp.google.com (Postfix) with ESMTP id ADDD61E0049; Mon, 29 Oct 2012 08:24:20 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 65ED9160E86; Mon, 29 Oct 2012 08:24:20 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Mon, 29 Oct 2012 08:23:55 -0700 Message-Id: <1351524245-19584-13-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1351524245-19584-1-git-send-email-sjg@chromium.org> References: <1351524245-19584-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQnpYSRMES6V2eR9ELyVVQATDkAM3DAC8coY4/cbg/+6cPFCD+Tob/tNcTmP6kv4jKX8j9v6ceUgpyBtlQIUtCiFv4shUsVmXX9gfn7VIKF1s/45iu14pRkcDtP6iA8PuEhReXkmUX47KbQHET6Bb6fAa6hUhPWuJ9e24KCP2qZA3wjejWftwSbDGehq3z0n0DtEekaP Cc: Tom Rini , Taylor Hutt , Rob Herring Subject: [U-Boot] [PATCH v3 12/22] ahci: Use sizeof(fis) instead of hardcoding '20' X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Taylor Hutt This cleanup replaces the hardcoded use of '20', which represents the number of bytes in the FIS, with sizeof(fis). Signed-off-by: Taylor Hutt Signed-off-by: Simon Glass --- drivers/block/ahci.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c index c16e8ba..10fae88 100644 --- a/drivers/block/ahci.c +++ b/drivers/block/ahci.c @@ -383,14 +383,14 @@ static void ahci_set_feature(u8 port) u8 fis[20]; /* set feature */ - memset(fis, 0, 20); + memset(fis, 0, sizeof(fis)); fis[0] = 0x27; fis[1] = 1 << 7; fis[2] = ATA_CMD_SETF; fis[3] = SETFEATURES_XFER; fis[12] = __ilog2(probe_ent->udma_mask + 1) + 0x40 - 0x01; - memcpy((unsigned char *)pp->cmd_tbl, fis, 20); + memcpy((unsigned char *)pp->cmd_tbl, fis, sizeof(fis)); ahci_fill_cmd_slot(pp, cmd_fis_len); writel(1, port_mmio + PORT_CMD_ISSUE); readl(port_mmio + PORT_CMD_ISSUE); @@ -559,7 +559,7 @@ static int ata_scsiop_inquiry(ccb *pccb) if (pccb->datalen <= 35) return 0; - memset(fis, 0, 20); + memset(fis, 0, sizeof(fis)); /* Construct the FIS */ fis[0] = 0x27; /* Host to device FIS. */ fis[1] = 1 << 7; /* Command FIS. */ @@ -570,7 +570,7 @@ static int ata_scsiop_inquiry(ccb *pccb) if (!(tmpid = malloc(sizeof(hd_driveid_t)))) return -ENOMEM; - if (ahci_device_data_io(port, (u8 *) &fis, 20, tmpid, + if (ahci_device_data_io(port, (u8 *) &fis, sizeof(fis), tmpid, sizeof(hd_driveid_t), 0)) { debug("scsi_ahci: SCSI inquiry command failure.\n"); return -EIO; @@ -620,7 +620,7 @@ static int ata_scsiop_read_write(ccb *pccb, u8 is_write) is_write ? "write" : "read", (unsigned)lba, blocks); /* Preset the FIS */ - memset(fis, 0, 20); + memset(fis, 0, sizeof(fis)); fis[0] = 0x27; /* Host to device FIS. */ fis[1] = 1 << 7; /* Command FIS. */ /* Command byte (read/write). */