From patchwork Thu Nov 21 10:16:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 179924 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3375194ilf; Thu, 21 Nov 2019 02:16:26 -0800 (PST) X-Google-Smtp-Source: APXvYqxq+yke54p9XgBbG7rPcWlXtIHJrgQLW7udCE1UvkXh0usLhWJWrQ9pHe5M+tM2TWUZB0yS X-Received: by 2002:a2e:9e45:: with SMTP id g5mr6097550ljk.58.1574331385925; Thu, 21 Nov 2019 02:16:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574331385; cv=none; d=google.com; s=arc-20160816; b=bBS8T+j68NyilelE5YYwahDUQH6WtB7GfRHaRsvnlaxLSW0eLMAOls1wk6n4FrMQHk jw82+Ocm4LRmX2WQ+TyhpEbQm9VoVoUD63uIRUU0ghn/LmlMkzamUFJey/ty+mXljlNB 7LaOetfWlMj2H4fs17GIF+nH5+TeIUdBgbKFvcBpAyLAAEYuypduZv8Gvh0XKtz+1Ywf s96cS0mIKWBmT4mKTkK77oFrI5td63SZa+llD2pdfPJgC026opV+gc2oUGCMXdZBti7M 0ddHY4FUrtfpjlBXx6xEcDUZbTrGLkCSc5Js7rmmPOe8dPP11vlQg4pQQpaiZ6yijEAk Z0Ig== 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=EllGZOhlv7thGKHYS1wJEXfKYFyWH6EaI7pQzHonnBo/8+sWl1Zbw7jvYfM9IpsMWC oKvVJ4QGB6nzGZZieRvsmNf5aZWqHzsdPa1oLhTfMx8AdV8LpXD3/Ox4vu6Gg55i0fsa jM02gmbeU+6Q7bfSiyJl5ei6VUJZWjiskmio5G6mr6EkUc1KdPP5Eo68k2Nw+CW5PiIc 9oJKwv2U0ypxEZBmIi38G0cTyv8NmmJ+WrJZfAN0Hk35Lj+6ybSlHUislFjqx6TdpXzP 2k1HpXuoaknJ6B7/WGO/lbQvgEOxGrlI1w1RY6B8HECp41OuTH2z7NJFSjBayV5Os5d/ 95hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=dC8bPDfi; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 f21si1267910ede.253.2019.11.21.02.16.25; Thu, 21 Nov 2019 02:16:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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=dC8bPDfi; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 S1727107AbfKUKQY (ORCPT + 3 others); Thu, 21 Nov 2019 05:16:24 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:39820 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfKUKQY (ORCPT ); Thu, 21 Nov 2019 05:16:24 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id xALAGBHU088328; Thu, 21 Nov 2019 04:16:11 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1574331371; bh=pE69mjXGRtzpdlcRpFWBhAVSwz09Tx2CA10ZtUiAstA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=dC8bPDfivf29O7SsbE4rlzJ8f8NmeIoZyHFEAwo4HGczorlkOqgL/9WNfv2mI5sd/ iMxiOJUXALnn47ag+moCGsqcWOiY6qcmLoAzd3CmqXNb5TxuQb36vaSWoLyy8yu2nb 0zZCDo2+JFkCkpGzwD4SKkKKRX8XDVKISWA8MqN4= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xALAGB99010833 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 21 Nov 2019 04:16:11 -0600 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE103.ent.ti.com (10.64.6.24) 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 04:16:11 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE115.ent.ti.com (10.64.6.36) 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 04:16:11 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id xALAG3b6105173; Thu, 21 Nov 2019 04:16:09 -0600 From: Peter Ujfalusi To: , , , , CC: , , , Subject: [PATCH v2 2/3] crypto: atmel-sha - Retire dma_request_slave_channel_compat() Date: Thu, 21 Nov 2019 12:16:01 +0200 Message-ID: <20191121101602.21941-3-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191121101602.21941-1-peter.ujfalusi@ti.com> References: <20191121101602.21941-1-peter.ujfalusi@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@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;