From patchwork Sat Sep 21 19:55:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 276904 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 924BA2C01B3 for ; Sun, 22 Sep 2013 05:55:49 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751044Ab3IUTzq (ORCPT ); Sat, 21 Sep 2013 15:55:46 -0400 Received: from caramon.arm.linux.org.uk ([78.32.30.218]:39743 "EHLO caramon.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750799Ab3IUTzp (ORCPT ); Sat, 21 Sep 2013 15:55:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=caramon; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=zAuxDQ72VJVct7sMVSFmMoFCybKRdE7zr4GIK7Aw6Tg=; b=H7vbKWRqsMrm9TdK5I4NID7NqeWXYSvWopl2rp+3JZjMPQIhbrCrbr/jwzjmjyrLkeIKCYHas8AjuUIOgT/sTtdG6HMQTkRMulhbJVQ52nQ3FkqLDSLeq8NuydXdphubCyZXvJAcLoASggDWcu6MOYv8JhOczPkLFZ3jtwmGPuk=; Received: from n2100.arm.linux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:37984) by caramon.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1VNTHC-0003WU-5F; Sat, 21 Sep 2013 20:55:34 +0100 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1VNTHA-0006jS-Ht; Sat, 21 Sep 2013 20:55:32 +0100 Date: Sat, 21 Sep 2013 20:55:31 +0100 From: Russell King - ARM Linux To: Ben Hutchings Cc: devel@driverdev.osuosl.org, netdev Subject: Re: [PATCH 18/51] DMA-API: staging: et131x: replace dma_set_mask()+dma_set_coherent_mask() with new helper Message-ID: <20130921195531.GO12758@n2100.arm.linux.org.uk> References: <20130919212235.GD12758@n2100.arm.linux.org.uk> <1379691728.1681.15.camel@bwh-desktop.uk.level5networks.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1379691728.1681.15.camel@bwh-desktop.uk.level5networks.com> User-Agent: Mutt/1.5.19 (2009-01-05) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Sep 20, 2013 at 04:42:08PM +0100, Ben Hutchings wrote: > On Thu, 2013-09-19 at 22:43 +0100, Russell King wrote: > > + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || > > + dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { > > Surely we want && here. Good catch, exactly right. Thanks for the review, here's the replacement patch: 8<==== From: Russell King Subject: [PATCH] DMA-API: staging: et131x: replace dma_set_mask()+dma_set_coherent_mask() with new helper Replace the following sequence: dma_set_mask(dev, mask); dma_set_coherent_mask(dev, mask); with a call to the new helper dma_set_mask_and_coherent(). Signed-off-by: Russell King Acked-by: Mark Einon --- drivers/staging/et131x/et131x.c | 17 ++--------------- 1 files changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index f73e58f..61da7ee 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -4797,21 +4797,8 @@ static int et131x_pci_setup(struct pci_dev *pdev, pci_set_master(pdev); /* Check the DMA addressing support of this device */ - if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) { - rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); - if (rc < 0) { - dev_err(&pdev->dev, - "Unable to obtain 64 bit DMA for consistent allocations\n"); - goto err_release_res; - } - } else if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { - rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); - if (rc < 0) { - dev_err(&pdev->dev, - "Unable to obtain 32 bit DMA for consistent allocations\n"); - goto err_release_res; - } - } else { + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) && + dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { dev_err(&pdev->dev, "No usable DMA addressing method\n"); rc = -EIO; goto err_release_res;