From patchwork Thu Apr 9 11:46:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Lambert X-Patchwork-Id: 459709 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 0E2AE140157 for ; Thu, 9 Apr 2015 21:47:51 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=HwG9Bi7m; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755169AbbDILre (ORCPT ); Thu, 9 Apr 2015 07:47:34 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:37808 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754998AbbDILrc (ORCPT ); Thu, 9 Apr 2015 07:47:32 -0400 Received: by wiaa2 with SMTP id a2so94849854wia.0; Thu, 09 Apr 2015 04:47:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MuS5KI8bdZXsWvc1JKTBfRusTDGAA+ZHXmMlutcJdyc=; b=HwG9Bi7mxo95KwxXjmXM0drH0PisI/ZolC+HhfZqEzXW40N62cZ5mBo1sxcKcGFrzh zjtQdg1o5eenE6C8ssR3RWzSM6sw0oSGPyMWxdKI7n5ssP4q9wx9Bla2QLbeArkf3ubu R8L8F0WXL1UmxADm+g2rXE5/gkA5YfWN0Y8RRTqBFXr9k/EG1ElwivgpccdnC77xMtU5 brm9MACXsBAVj9K4ydCCsKE6LttDsB9cR3A+vylXHKjgNlMnaKtVfEEW3rnsse/uIfiL yhbxL5oaLX/CZnqaRvMC6QfkVDytLAwyDuOogJw9/StoPq5FwPtzp6hcpWZBjUCOp2Qu P4IA== X-Received: by 10.180.82.135 with SMTP id i7mr5522478wiy.85.1428580050632; Thu, 09 Apr 2015 04:47:30 -0700 (PDT) Received: from sloth.lip6.fr (hp-quentin.rsr.lip6.fr. [132.227.76.76]) by mx.google.com with ESMTPSA id z12sm3157652wjq.12.2015.04.09.04.47.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Apr 2015 04:47:29 -0700 (PDT) From: Quentin Lambert To: "David S. Miller" , linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Cc: Quentin Lambert Subject: [PATCH 1/2] ide: remove deprecated use of pci api Date: Thu, 9 Apr 2015 13:46:27 +0200 Message-Id: <1428579988-10167-2-git-send-email-lambert.quentin@gmail.com> X-Mailer: git-send-email 2.3.2 In-Reply-To: <1428579988-10167-1-git-send-email-lambert.quentin@gmail.com> References: <1428579988-10167-1-git-send-email-lambert.quentin@gmail.com> Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Replace occurences of the pci api by appropriate call to the dma api. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr) @deprecated@ idexpression id; position p; @@ ( pci_dma_supported@p ( id, ...) | pci_alloc_consistent@p ( id, ...) ) @bad1@ idexpression id; position deprecated.p; @@ ...when != &id->dev when != pci_get_drvdata ( id ) when != pci_enable_device ( id ) ( pci_dma_supported@p ( id, ...) | pci_alloc_consistent@p ( id, ...) ) @depends on !bad1@ idexpression id; expression direction; position deprecated.p; @@ ( - pci_dma_supported@p ( id, + dma_supported ( &id->dev, ... + , GFP_ATOMIC ) | - pci_alloc_consistent@p ( id, + dma_alloc_coherent ( &id->dev, ... + , GFP_ATOMIC ) ) Signed-off-by: Quentin Lambert --- drivers/ide/cs5520.c | 2 +- drivers/ide/pmac.c | 5 ++--- drivers/ide/setup-pci.c | 2 +- drivers/ide/sgiioc4.c | 4 ++-- 4 files changed, 6 insertions(+), 7 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 --- a/drivers/ide/cs5520.c +++ b/drivers/ide/cs5520.c @@ -123,7 +123,7 @@ static int cs5520_init_one(struct pci_de return -ENODEV; } pci_set_master(dev); - if (pci_set_dma_mask(dev, DMA_BIT_MASK(32))) { + if (dma_set_mask(&dev->dev, DMA_BIT_MASK(32))) { printk(KERN_WARNING "%s: No suitable DMA available.\n", d->name); return -ENODEV; --- a/drivers/ide/pmac.c +++ b/drivers/ide/pmac.c @@ -1689,10 +1689,9 @@ static int pmac_ide_init_dma(ide_hwif_t * The +2 is +1 for the stop command and +1 to allow for * aligning the start address to a multiple of 16 bytes. */ - pmif->dma_table_cpu = pci_alloc_consistent( - dev, + pmif->dma_table_cpu = dma_alloc_coherent(&dev->dev, (MAX_DCMDS + 2) * sizeof(struct dbdma_cmd), - &hwif->dmatable_dma); + &hwif->dmatable_dma, GFP_ATOMIC); if (pmif->dma_table_cpu == NULL) { printk(KERN_ERR "%s: unable to allocate DMA command list\n", hwif->name); --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -209,7 +209,7 @@ static int ide_pci_enable(struct pci_dev * a DMA mask field to the struct ide_port_info if we need it * (or let lower level driver set the DMA mask) */ - ret = pci_set_dma_mask(dev, DMA_BIT_MASK(32)); + ret = dma_set_mask(&dev->dev, DMA_BIT_MASK(32)); if (ret < 0) { printk(KERN_ERR "%s %s: can't set DMA mask\n", d->name, pci_name(dev)); --- a/drivers/ide/sgiioc4.c +++ b/drivers/ide/sgiioc4.c @@ -334,8 +334,8 @@ static int ide_dma_sgiioc4(ide_hwif_t *h if (ide_allocate_dma_engine(hwif)) goto dma_pci_alloc_failure; - pad = pci_alloc_consistent(dev, IOC4_IDE_CACHELINE_SIZE, - (dma_addr_t *)&hwif->extra_base); + pad = dma_alloc_coherent(&dev->dev, IOC4_IDE_CACHELINE_SIZE, + (dma_addr_t *)&hwif->extra_base, GFP_ATOMIC); if (pad) { ide_set_hwifdata(hwif, pad); return 0;