From patchwork Thu Nov 21 07:27:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 179916 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3215792ilf; Wed, 20 Nov 2019 23:28:00 -0800 (PST) X-Google-Smtp-Source: APXvYqzMsO9g2LGvrkByLpJ2zHIPeFbVR5NflvcpX+SSeuOLsDMit/ZMjIg3CSoYNRsMP2LtZF7L X-Received: by 2002:a17:907:1114:: with SMTP id qu20mr12201528ejb.42.1574321280814; Wed, 20 Nov 2019 23:28:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574321280; cv=none; d=google.com; s=arc-20160816; b=T1WV1HDHyTPBDxDxlYglxS8ZIKCFRwnoREje73vLBlJbnb0Qra/SbqvDEAtzT2xShS suWyTU/g89euxUuifFfK/BGFrndidu689gzlPDiA1lZa8TFAxD9MZx2zLHZREpj6TSdX Oa46yAQ+PiVvot8GlHHfMfoIP22zbihp9d21Q71QZuatSO3KTBKi8MfEtPfoXmmMPvX/ NNXeCurAQmxNQJsryA1Q6uv1h3ChuJpr2PckoTN1XYBMaHVYFuFh287gomhZ7iqQ1CzS 20OKnDcAtuC9WCUy2aGIR5yhprTKadFlc/vSs7hEEGFEp85SafFKQ08JjGGdHHUWdZcX nZTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pE69mjXGRtzpdlcRpFWBhAVSwz09Tx2CA10ZtUiAstA=; b=rHaUNTJzmE7kwJluqfENCi4rlrfqEwk83RMaLbQ4naSr1qhTVfm4AmShgg/LdK+V4W pE0hOIVtOLlX5Zinlt6k2KSeXUo31zWjk9wRz+Z5yj1XnQ3b6Cal6uXO8AeHe1q4Avcn Y2obSI91kEXiPvmUbkP3nPKOVd29sAu0jzsOiuq/cUjMXbuEKj14Flh06QfnXuzEpE+0 oY98ibtfpzxlnELeANxuzM0ppTc1XrAuPVjJcz5BR5hh0CPGk5U7J6IlXVAgnMrS6sI0 zSncLc1D+QThRtdYq8tHTBQQbIaI4Oclv6Q1tq041jo/pc4gXYSex0MC+lA7Y+uPC5iN 8Utw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="IB/u1Mki"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qw23si1196622ejb.1.2019.11.20.23.28.00; Wed, 20 Nov 2019 23:28:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="IB/u1Mki"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727166AbfKUH1x (ORCPT + 26 others); Thu, 21 Nov 2019 02:27:53 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:50828 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbfKUH1s (ORCPT ); Thu, 21 Nov 2019 02:27:48 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id xAL7RYFr081645; Thu, 21 Nov 2019 01:27:34 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1574321254; bh=pE69mjXGRtzpdlcRpFWBhAVSwz09Tx2CA10ZtUiAstA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=IB/u1MkiR06t8hyB7ae/x/pZ3PFrFA5LRBna9BHimQORrxNZVqwo3h7h6JBj+F/SB Eexs8ceoCxQ0iycEGVCJmyzT5ohJNw0MjylUFZesEoSx95A7D6B6udnQIZ2LXVVv6c Oxk0ynuzDakj1kBf9Vw/dYtjbXLMw4DpK1fcwOHo= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xAL7RY84100906 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 21 Nov 2019 01:27:34 -0600 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Thu, 21 Nov 2019 01:27:31 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Thu, 21 Nov 2019 01:27:31 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id xAL7RNTs079857; Thu, 21 Nov 2019 01:27:29 -0600 From: Peter Ujfalusi To: , , , , CC: , , , Subject: [PATCH 2/3] crypto: atmel-sha - Retire dma_request_slave_channel_compat() Date: Thu, 21 Nov 2019 09:27:22 +0200 Message-ID: <20191121072723.28479-3-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191121072723.28479-1-peter.ujfalusi@ti.com> References: <20191121072723.28479-1-peter.ujfalusi@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver no longer boots in legacy mode, only via DT. This makes the dma_request_slave_channel_compat() redundant. If ever the filter function would be executed it will return false as the dma_slave is not really initialized. Switch to use dma_request_chan() which would allow legacy boot if ever needed again by configuring dma_slave_map for the DMA driver. At the same time skip allocating memory for dma_slave as it is not used anymore. Signed-off-by: Peter Ujfalusi --- drivers/crypto/atmel-sha.c | 39 +++++++------------------------------- 1 file changed, 7 insertions(+), 32 deletions(-) -- Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c index 8ea0e4bcde0d..9d392c5ff06b 100644 --- a/drivers/crypto/atmel-sha.c +++ b/drivers/crypto/atmel-sha.c @@ -2608,32 +2608,16 @@ static int atmel_sha_register_algs(struct atmel_sha_dev *dd) return err; } -static bool atmel_sha_filter(struct dma_chan *chan, void *slave) -{ - struct at_dma_slave *sl = slave; - - if (sl && sl->dma_dev == chan->device->dev) { - chan->private = sl; - return true; - } else { - return false; - } -} - static int atmel_sha_dma_init(struct atmel_sha_dev *dd, struct crypto_platform_data *pdata) { - dma_cap_mask_t mask_in; + dd->dma_lch_in.chan = dma_request_chan(dd->dev, "tx"); + if (IS_ERR(dd->dma_lch_in.chan)) { + int ret = PTR_ERR(dd->dma_lch_in.chan); - /* Try to grab DMA channel */ - dma_cap_zero(mask_in); - dma_cap_set(DMA_SLAVE, mask_in); - - dd->dma_lch_in.chan = dma_request_slave_channel_compat(mask_in, - atmel_sha_filter, &pdata->dma_slave->rxdata, dd->dev, "tx"); - if (!dd->dma_lch_in.chan) { - dev_warn(dd->dev, "no DMA channel available\n"); - return -ENODEV; + if (ret != -EPROBE_DEFER) + dev_warn(dd->dev, "no DMA channel available\n"); + return ret; } dd->dma_lch_in.dma_conf.direction = DMA_MEM_TO_DEV; @@ -2724,12 +2708,6 @@ static struct crypto_platform_data *atmel_sha_of_init(struct platform_device *pd if (!pdata) return ERR_PTR(-ENOMEM); - pdata->dma_slave = devm_kzalloc(&pdev->dev, - sizeof(*(pdata->dma_slave)), - GFP_KERNEL); - if (!pdata->dma_slave) - return ERR_PTR(-ENOMEM); - return pdata; } #else /* CONFIG_OF */ @@ -2823,10 +2801,7 @@ static int atmel_sha_probe(struct platform_device *pdev) goto iclk_unprepare; } } - if (!pdata->dma_slave) { - err = -ENXIO; - goto iclk_unprepare; - } + err = atmel_sha_dma_init(sha_dd, pdata); if (err) goto err_sha_dma;