From patchwork Thu Jan 23 14:03:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 11348169 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BC8CD139A for ; Thu, 23 Jan 2020 14:03:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 915E32467B for ; Thu, 23 Jan 2020 14:03:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="TcP3lEOL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728057AbgAWODI (ORCPT ); Thu, 23 Jan 2020 09:03:08 -0500 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:22605 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726232AbgAWODI (ORCPT ); Thu, 23 Jan 2020 09:03:08 -0500 Received-SPF: Pass (esa5.microchip.iphmx.com: domain of Tudor.Ambarus@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa5.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="Tudor.Ambarus@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa5.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa5.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa5.microchip.iphmx.com; spf=Pass smtp.mailfrom=Tudor.Ambarus@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: wJFLhp0KtSYkzVWYxNCfEkJwW1O5jVtN8S1EzBBUOAFbUkp009wRfMDqfQitgWf//gOnWCVMWj wjm3fzC5ncIdu1oH6mpdmTsjrUyRhY7xGm91C0tF2WEMS/BNfpVwvF87jtmPF3LHWuihaShJqq AJpAj3J+Qkvhw/2J5pAdijAnrkCEWS0azkZgIg2lC7CL+hLu8wqvpjImBS/solKpX+FKsLa2HA 1pKJsMrYnaN6oEH7pKpOBojbpshM4c4fyzio1vnmoRSMAH339VCELb3cGe1zfese0OIwEnmO3C 40I= X-IronPort-AV: E=Sophos;i="5.70,354,1574146800"; d="scan'208";a="62879867" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Jan 2020 07:03:07 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 23 Jan 2020 07:03:06 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 23 Jan 2020 07:03:06 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fu+gjaGMnnW+0/HAXJBntc36dYhyjuSR7r0WjNfQxH1WjADJIEbC6chlqimZEp7ooGLW36eJyaqZscIXzNs9qpwpQKsRB7lv9ed4suk7FqVLP9ALDbks4lAAyteR0tfB8ygQ9jw6cJ0oZTFS5QONkRZ5xqFMSxU9aWYFx6Sr8kYliiubj1uaqM1fXeydXPhqDPNdZu99fC/2N30xLqMzFhNiq4UlW2VFnh4KUS9Qm7C0QxwALwvgMaDd2AADh71KnN4Aie0Hz/GMo9fTLF89WHgUw3NmfBSJgaopC2viDD1KH+4sHO8WAqQfEYlPhg2UaIjQ1w3p8P/rtpSoeCD4/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NkT8JJetRMdDwVGPcWOgCt77LA+s0kNgmTWF9ltJLnA=; b=iDsceVSWLExJAMVUXMKCfNDqQBlTFqZYsu8MHKZzyquu30bmEf1Kkbmy9kQ2H5DTDRPPuTxTD3ii2FHlDnDHozz5Tp/e/pSBghlVkvC5dk433JdRv5R3Cjnjai53BMA/SEppoeaqg9qE/FR5olRsg8ZZrAnTDEXXroVQUlQZVLgO9Wih1sQGvvT73pv2pMBKVP45ih5qNbJJon5ERBsXC6yN7Wm8KOAPDFBJPj/WAqzcwkqnfwLz8NIkglJYfTZ1/JHlywhPMH+S2qcpnLMbLQsGaJdZY3DvZ+Y/eUq545eTSGRoPb8maggVpWAaWGjF+UhPqjvDJW1MCBF2RapTcw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NkT8JJetRMdDwVGPcWOgCt77LA+s0kNgmTWF9ltJLnA=; b=TcP3lEOLVmXM6syYVt/hyj5GAJ/xFQiJvczFjn0Qn3X3BtOuwFvR/g+OfDfesl6M5HRFoGvvhN8pknus5VYyNROV5MWJQbpe3uyb2EyeA2CdtVAn6HGtsk0n+Nj5YhjjDnQX78QnyHnq8BljKnBwsNA2RGwLsyajA9kU62RYByU= Received: from MN2PR11MB4448.namprd11.prod.outlook.com (52.135.39.157) by MN2PR11MB3582.namprd11.prod.outlook.com (20.178.251.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Thu, 23 Jan 2020 14:03:03 +0000 Received: from MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb]) by MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb%5]) with mapi id 15.20.2644.027; Thu, 23 Jan 2020 14:03:02 +0000 From: To: , , CC: , , Subject: [PATCH 01/10] dmaengine: at_hdmac: Substitute kzalloc with kmalloc Thread-Topic: [PATCH 01/10] dmaengine: at_hdmac: Substitute kzalloc with kmalloc Thread-Index: AQHV0fXTyMvfeqBPZU6BecAiUKnxHg== Date: Thu, 23 Jan 2020 14:03:02 +0000 Message-ID: <20200123140237.125799-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 94ab9cfb-6b7d-41f1-10f3-08d7a00cf661 x-ms-traffictypediagnostic: MN2PR11MB3582: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-forefront-prvs: 029174C036 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(396003)(366004)(39860400002)(136003)(189003)(199004)(2616005)(6486002)(316002)(26005)(36756003)(4326008)(81156014)(186003)(54906003)(110136005)(81166006)(6512007)(5660300002)(478600001)(8676002)(66946007)(64756008)(66476007)(76116006)(91956017)(66446008)(66556008)(1076003)(2906002)(4744005)(6506007)(107886003)(8936002)(71200400001)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB3582;H:MN2PR11MB4448.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 493Yewy6wuki3Kwx+Hebux81J9J16fpFYgOrLIaJTXJA95Es6O9vsTdjZnf0Zg1tkmVPcJcDMB/mCdnsSLNEqVkarV9nlRmBy6q5+kX6VDMrMLM4rFsW52Uq1+qdUZUswWJuNsJUwfxUtc44/zq1tx/naOzyEcSCXlDT69DBDsFLklq3UHiRYvyTCSaO+wBiPosljsAOF48O8/3iWJXYd/65VypdWOzdkBx+HBU1wvlPfNBZnVfoqIpfsk9vEjou0Bi1lRlMovWS/yo9El7Au6HI7bN78FC13Wm+Oek3iA5j3mFJbC1u/mcBGbRpDKvi/YqA+NBIf5GM89joqQPgVIu/tiOlJH66S9lMrt7W5X/tRHGzBik6ugHkoyT7P9wQA7BpUCnd+3eFbbY/X/dcbZKhaptDBA6ZhcoWnss/5Ql+Gg8y1pu4/c5jVSY3G4Cp MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 94ab9cfb-6b7d-41f1-10f3-08d7a00cf661 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jan 2020 14:03:02.6844 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: aOOtcxQtjBuLj50G+/0mquFw/38o5HXpTOOTbr+V2ogBIFb/5ytdpyL2BtI8kUintODW9Yxdhk0rwbLTWc/XpDO/tYzoecCBZTwXRWLdm1M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3582 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org From: Tudor Ambarus All members of the structure are initialized below in the function, there is no need to use kzalloc. Signed-off-by: Tudor Ambarus Acked-by: Ludovic Desroches --- drivers/dma/at_hdmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 672c73b4a2d4..cad6dcd9cfb5 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1671,7 +1671,7 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec, dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); - atslave = kzalloc(sizeof(*atslave), GFP_KERNEL); + atslave = kmalloc(sizeof(*atslave), GFP_KERNEL); if (!atslave) return NULL; From patchwork Thu Jan 23 14:03:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 11348173 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED3AA13A4 for ; Thu, 23 Jan 2020 14:03:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C117D2467B for ; Thu, 23 Jan 2020 14:03:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="mW1q7kuC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729043AbgAWODK (ORCPT ); Thu, 23 Jan 2020 09:03:10 -0500 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:22605 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727235AbgAWODJ (ORCPT ); Thu, 23 Jan 2020 09:03:09 -0500 Received-SPF: Pass (esa5.microchip.iphmx.com: domain of Tudor.Ambarus@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa5.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="Tudor.Ambarus@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa5.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa5.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa5.microchip.iphmx.com; spf=Pass smtp.mailfrom=Tudor.Ambarus@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: KHa/lZWbE0neflBDJwen8BlHOVWBXbaF/pASxTvW0x5yW0IIK7O9/FDFusnAnypZAngSBvBOfj QZjxu5lwnf2oUoWwYfNFYFkT7IupzqrWIRxB9OHA4upeNS9xO6sEStF2/Ff8Yt6b+mJ7d8euC1 k1YhO0Wu+7bwZeK3dmOp9ACvQGjWTDF19CdftBlWEc+fqUKK584TiXcpm17JSU+QLOAV1ByVSw q2JBJ/HzfVtw6w46/knunnlsoDbR7n0Mk5+9sE4jcbgv/d5x8mG/kBXq1M2VVtV0gBuVa+0bO4 B9k= X-IronPort-AV: E=Sophos;i="5.70,354,1574146800"; d="scan'208";a="62879868" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Jan 2020 07:03:07 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 23 Jan 2020 07:03:06 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 23 Jan 2020 07:03:06 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VnVuRcllFaTIFVW/D+jWIDilW4OsyfJZ/i1mnKTFKB2n1mYSjj2vNWbK4DGzpU6130TyKISANUVhVN6dSeJBSo770Pf77CN3uufOhY+oimZWu3hiSVBivjajIsgTppGsT+IXLRmSkZOix9807dt2hchU8paUVVLlUw6hOn5/PVCntOQJbklArF7IUAvZaFzIpD12wH437ijkJZEQqOnQ4PYndWaYMDwKeNEMect9jfOot2hOmuMe8UZ188dHF0oVPPrQztdrEMn4GIyshsTdTC0UCXimWcBkStj0f1PGqFoa1HpTY2/YpbLRi5uMkZnO8w94VqxcI8MmbVfotfeeyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P11396+/3esw2Nfwf9KjTA7joaB01p8Gu/BbAl1qD2s=; b=ZnIqBXXQtwPlzwGGiMVtA8anrBYjMip7V5tI6q068jNzRfV5Pl9rN4VAcqfASu5/CEU4C0QLgBenKZzKgTJUS5sxtD/n8UChtfMMQ49qvlxBDTzdB/Dzz7bHPPPOg09QaqVgKKxwj9j54iXvv1kDq5kJCoIMcGBBgf2qG0vTGGiBtwpx8KDLsD/uLA6X+3/knKhphwurP2/f5IglrGS6lo8aQqT3hAt/H5vcrd1z37Dm0UDMVjt8aEhtzDkZ0XvYtI5pNrH3HWfE6ffOoSpz/CLXATnSd8LswLXJsefMmpQRMIWwjS6B2trLdiMEpj/mDWkjlEZLry7Ub7RSK2Qk7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P11396+/3esw2Nfwf9KjTA7joaB01p8Gu/BbAl1qD2s=; b=mW1q7kuCBLVa4CwDAZga2qYLy+Hvg8xPt/N6w/YlGpEj4bHdNd/0JTUempGoGHGvROmU/GEOA0jKTM8PvEU0OnC8QIrtdebVfDeh50I7o7PXcqUnG/GjUMh8nLWbq05EhxLMW/j1Ve6klnkvUAx7FicKHOSqNvSVx4PKKatVO2U= Received: from MN2PR11MB4448.namprd11.prod.outlook.com (52.135.39.157) by MN2PR11MB3582.namprd11.prod.outlook.com (20.178.251.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Thu, 23 Jan 2020 14:03:04 +0000 Received: from MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb]) by MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb%5]) with mapi id 15.20.2644.027; Thu, 23 Jan 2020 14:03:04 +0000 From: To: , , CC: , , Subject: [PATCH 02/10] dmaengine: at_hdmac: Drop locking in at_hdmac_alloc_chan_resources() Thread-Topic: [PATCH 02/10] dmaengine: at_hdmac: Drop locking in at_hdmac_alloc_chan_resources() Thread-Index: AQHV0fXUgX6234GlxUCdz13FB0kPlg== Date: Thu, 23 Jan 2020 14:03:04 +0000 Message-ID: <20200123140237.125799-2-tudor.ambarus@microchip.com> References: <20200123140237.125799-1-tudor.ambarus@microchip.com> In-Reply-To: <20200123140237.125799-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 27f5d24f-7386-4296-26d7-08d7a00cf74b x-ms-traffictypediagnostic: MN2PR11MB3582: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4502; x-forefront-prvs: 029174C036 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(396003)(366004)(39860400002)(136003)(189003)(199004)(2616005)(6486002)(316002)(26005)(36756003)(4326008)(81156014)(186003)(54906003)(110136005)(81166006)(6512007)(5660300002)(478600001)(8676002)(66946007)(64756008)(66476007)(76116006)(91956017)(66446008)(66556008)(1076003)(2906002)(6506007)(107886003)(8936002)(71200400001)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB3582;H:MN2PR11MB4448.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: yGQPCMGeoXz+/ZvNfmRZhmSLYis/DGk4Hx2y9m+N/jcUf6FBy48GlX7QlzH1L0ehIfDYoLb4C/rgTlXeC6BKSbyymJ5vwiauzXCWdkZVW0jWy9ugeAhiyWYMxg20ZU21zHVHLxn2zRmY/E+o5PUQAtlVrDLGw8wsT/vTsZW2Gg4wtRxVuxeBMyOK8+vGm8dFjgqaWHDFD+0WjN8SdLY9fVlDN3NBVCYNKMr00G+ouk1Y8mCaTdWp3Jhdk2H1ujWHUByX3Mr0140I2EB9kfEv9c9M1ugy3KTwN2N6VEFCu2dpKCE9Bg3d1tWw2VdhN4Y5U4kV+6w+hrYW1tokLKuPmN/bbdOMIFKHttHUlGfwgNqI7UO4N6nbmUStv9S0CdA9FiqHDXzMtaIPyEwZcIzxFupiOM/GO/X5drrhGoqZGkIB7PTqpgHSJpMSu6vqGEof MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 27f5d24f-7386-4296-26d7-08d7a00cf74b X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jan 2020 14:03:04.3724 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: jXb7tGC+507enSK/VYDJBM6NZ6ywSKWVHbSwaf11UcoxwDv3eC7Mm+ksHYkmzRSg+U/7Z+98a+Kxbda87uswJAicDgifCS4mlY4FKDd8M6A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3582 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org From: Tudor Ambarus There is no need for locking in device_alloc_chan_resources(), the DMA core takes care of it by using a dma_list_mutex around the DMA devices. Signed-off-by: Tudor Ambarus --- drivers/dma/at_hdmac.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index cad6dcd9cfb5..301bae45cf8d 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1542,10 +1542,8 @@ static int atc_alloc_chan_resources(struct dma_chan *chan) struct at_dma *atdma = to_at_dma(chan->device); struct at_desc *desc; struct at_dma_slave *atslave; - unsigned long flags; int i; u32 cfg; - LIST_HEAD(tmp_list); dev_vdbg(chan2dev(chan), "alloc_chan_resources\n"); @@ -1583,14 +1581,11 @@ static int atc_alloc_chan_resources(struct dma_chan *chan) "Only %d initial descriptors\n", i); break; } - list_add_tail(&desc->desc_node, &tmp_list); + list_add_tail(&desc->desc_node, &atchan->free_list); } - spin_lock_irqsave(&atchan->lock, flags); atchan->descs_allocated = i; - list_splice(&tmp_list, &atchan->free_list); dma_cookie_init(chan); - spin_unlock_irqrestore(&atchan->lock, flags); /* channel parameters */ channel_writel(atchan, CFG, cfg); From patchwork Thu Jan 23 14:03:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 11348171 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DC79213A4 for ; Thu, 23 Jan 2020 14:03:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4DCE21835 for ; Thu, 23 Jan 2020 14:03:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="S45CRwbW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729074AbgAWODK (ORCPT ); Thu, 23 Jan 2020 09:03:10 -0500 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:22605 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726232AbgAWODJ (ORCPT ); Thu, 23 Jan 2020 09:03:09 -0500 Received-SPF: Pass (esa5.microchip.iphmx.com: domain of Tudor.Ambarus@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa5.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="Tudor.Ambarus@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa5.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa5.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa5.microchip.iphmx.com; spf=Pass smtp.mailfrom=Tudor.Ambarus@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: MVlLb011WR/QnrsRxQyrxH6AjLH+RzS7Opy2xPIMJRZCOLSX/71JVAXbeBEFARep6lgjDOL0x/ UnUKFnp8DTFWPQg25Bq5VtbePJKKB6hlRNVz14FwwDknD3wy9oJFAn8Qph+Cptt1LHXZUbACLF jSXaH3Obz5VIoxFr/o9K9eTQECk5pl5LmnW+5osSHTX9JQIzE2Sk00aiGiQXwzxRu6bymJVyFc 2sozyBocxMyC/6jELUToAkEaCJWaploqeYUkKNWgcc+TnLqF6yQbdvYNoOC+JFKCwjWqg0NraV /BU= X-IronPort-AV: E=Sophos;i="5.70,354,1574146800"; d="scan'208";a="62879870" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Jan 2020 07:03:08 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 23 Jan 2020 07:03:07 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 23 Jan 2020 07:03:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n0MY3m1pkTG4sUO7rGl+WPtBxpHpbzR4GhRO75mOimHUN8ELkhyz8g3b5jfTN66msIZ13cKREOsvFkVEUAIXrHoxpiNlbJr+AN9lmYtxiUwNjmvWbRfMLkVoirhgUws5a8E2uUqckj7SpQiC/X/crB7MrMfVtQyMUX6cawffz5rLpbb5yLh2V2jyiVVX5l7cFUnZw/SxwBlS+PWh81rsjaqJREoddjVl9lueP2NjWoWeKyAT8FB6YCULOkupLLRQrw29n+ou1Til7I7dcR67ReKFWrRrtzSu+KQJB1qsA72Ujk3VE7tRwlBdTy1xdmy2ca3jx8A4ADNID2SuQtw0Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pYDvGJfouxDU0Z58xGfTrYTQ+HZSeWJge9En2L7cxOo=; b=j9Eflh+Qk7tx3qP4Bke7Dewyn83iKD4YVLJeu/tR/3DElu5HXVzuiNobykTXuNygNo/GbJ4J1DNBsFhu+N4/VgihWAf7zdrFumyDr4AgcMUMEKIRwvYYos+fMXkutMqeYQ49elV0MZn+PagbTrp0UBcdUDObdQ+AW7AsJmSwppyjMU63o8eXdu3Vid6SDieRdJDJQYT7+wmqXf1cIabu3ROuayYeSEx40WI7qxnfCXED103xQwf7MN2rE9mm8QQeLHOxw1LCZsNQctkCw9HaSH6pCX63FB+/RN/qeCw0f406ik+vak51UbMnRrdA+wzkf/JdMtFTmg85x2D+wVgbnQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pYDvGJfouxDU0Z58xGfTrYTQ+HZSeWJge9En2L7cxOo=; b=S45CRwbWUCiHH6o9QefwUWsrBsPuIA4E/ki/567SR+TZLNDCwn+92u8qNjnKnoDsTx+97uY3WUyLOb7tZWeDnFG041Hjw7J3IVqX0gJhD1r8WGeVP0q6Yk3K8AyFoHEKa81Q72ZC4M/HlLmlxyCJiP+ZSCQHBYiG2i8dZsGq7x0= Received: from MN2PR11MB4448.namprd11.prod.outlook.com (52.135.39.157) by MN2PR11MB3582.namprd11.prod.outlook.com (20.178.251.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Thu, 23 Jan 2020 14:03:06 +0000 Received: from MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb]) by MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb%5]) with mapi id 15.20.2644.027; Thu, 23 Jan 2020 14:03:06 +0000 From: To: , , CC: , , Subject: [PATCH 03/10] dmaengine: at_hdmac: Return err in case the chan is not free at alloc res time Thread-Topic: [PATCH 03/10] dmaengine: at_hdmac: Return err in case the chan is not free at alloc res time Thread-Index: AQHV0fXVjTs4Wc6BRE650oM1XaQZzg== Date: Thu, 23 Jan 2020 14:03:06 +0000 Message-ID: <20200123140237.125799-3-tudor.ambarus@microchip.com> References: <20200123140237.125799-1-tudor.ambarus@microchip.com> In-Reply-To: <20200123140237.125799-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2bbcb102-18b2-41cf-6a23-08d7a00cf855 x-ms-traffictypediagnostic: MN2PR11MB3582: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-forefront-prvs: 029174C036 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(396003)(366004)(39860400002)(136003)(189003)(199004)(2616005)(6486002)(316002)(26005)(36756003)(4326008)(81156014)(186003)(54906003)(110136005)(81166006)(6512007)(5660300002)(478600001)(8676002)(66946007)(64756008)(66476007)(76116006)(91956017)(66446008)(66556008)(1076003)(2906002)(6506007)(107886003)(8936002)(71200400001)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB3582;H:MN2PR11MB4448.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: qEVR3Qs9Wf8L8kgoXTZ6kUn/1o+2ZCDHoA+vhHTVa1/i+KE6pRv4N+payYFB7u7onq8PY767epHg2fiUmlKIJgc4IxiCtmZPlT4ITLYFWhlUemgXo215Q/yqWmy6pVUc6TBIzS4df0gcfP2v1k0WOzhiVtUWJ3if7oRjqfSrcbGXe9tEZ4Nqqthn1ryGck2sehVPk9++nIScer0xVNXZ9hyc5MFJl5R05OUm0gP4HnL1br68WN5G3I7Urw+cWMJBJyUuNbUDdVzBOeJwKdRmX/5Kc4JU+KTSa/cQu45Yfe84RXjFiFJremEgvsccSwM7oFcZvy+agG1Xf8xeaVBbZhTa7jZDeMPZcWhEvDk+jv2mKkhTdtRwuadXxtssQuNmaHbcS/up9fL6pLuwEqaZkKDO9EGKdoCzrHP8u9NxgkW2jA3lNo3SsyXQ2TRhAJWJ MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 2bbcb102-18b2-41cf-6a23-08d7a00cf855 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jan 2020 14:03:06.1454 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: AOcG1JZheLYRtZCH7P2qATA4/HQQIxkTUJKopgsogksonSzuG6RnEk1Gr8aUBOwANQ4kwNsti6tUuX2+LSdNLJL5WqO9Y4nzNixPQdA9gR0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3582 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org From: Tudor Ambarus Having a list of descriptors allocated for the channel at device_alloc_chan_resources() time is a sign for bad free usage. Return err and add a debug message in case the channel is not free from a previous use. atchan->descs_allocated becomes useless, get rid of it. More, drop the error message in atc_desc_get() because now it would introduce an extra if statement. The callers of atc_desc_get() already print error messages in case the callee fails, no one is hurt. Signed-off-by: Tudor Ambarus --- drivers/dma/at_hdmac.c | 31 ++++++++----------------------- drivers/dma/at_hdmac_regs.h | 2 -- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 301bae45cf8d..e17b75075904 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -146,17 +146,8 @@ static struct at_desc *atc_desc_get(struct at_dma_chan *atchan) "scanned %u descriptors on freelist\n", i); /* no more descriptor available in initial pool: create one more */ - if (!ret) { + if (!ret) ret = atc_alloc_descriptor(&atchan->chan_common, GFP_ATOMIC); - if (ret) { - spin_lock_irqsave(&atchan->lock, flags); - atchan->descs_allocated++; - spin_unlock_irqrestore(&atchan->lock, flags); - } else { - dev_err(chan2dev(&atchan->chan_common), - "not enough descriptors available\n"); - } - } return ret; } @@ -1553,6 +1544,11 @@ static int atc_alloc_chan_resources(struct dma_chan *chan) return -EIO; } + if (!list_empty(&atchan->free_list)) { + dev_dbg(chan2dev(chan), "can't allocate channel resources (channel not freed from a previous use)\n"); + return -EIO; + } + cfg = ATC_DEFAULT_CFG; atslave = chan->private; @@ -1568,11 +1564,6 @@ static int atc_alloc_chan_resources(struct dma_chan *chan) cfg = atslave->cfg; } - /* have we already been set up? - * reconfigure channel but no need to reallocate descriptors */ - if (!list_empty(&atchan->free_list)) - return atchan->descs_allocated; - /* Allocate initial pool of descriptors */ for (i = 0; i < init_nr_desc_per_channel; i++) { desc = atc_alloc_descriptor(chan, GFP_KERNEL); @@ -1584,17 +1575,15 @@ static int atc_alloc_chan_resources(struct dma_chan *chan) list_add_tail(&desc->desc_node, &atchan->free_list); } - atchan->descs_allocated = i; dma_cookie_init(chan); /* channel parameters */ channel_writel(atchan, CFG, cfg); dev_dbg(chan2dev(chan), - "alloc_chan_resources: allocated %d descriptors\n", - atchan->descs_allocated); + "alloc_chan_resources: allocated %d descriptors\n", i); - return atchan->descs_allocated; + return i; } /** @@ -1608,9 +1597,6 @@ static void atc_free_chan_resources(struct dma_chan *chan) struct at_desc *desc, *_desc; LIST_HEAD(list); - dev_dbg(chan2dev(chan), "free_chan_resources: (descs allocated=%u)\n", - atchan->descs_allocated); - /* ASSERT: channel is idle */ BUG_ON(!list_empty(&atchan->active_list)); BUG_ON(!list_empty(&atchan->queue)); @@ -1623,7 +1609,6 @@ static void atc_free_chan_resources(struct dma_chan *chan) dma_pool_free(atdma->dma_desc_pool, desc, desc->txd.phys); } list_splice_init(&atchan->free_list, &list); - atchan->descs_allocated = 0; atchan->status = 0; /* diff --git a/drivers/dma/at_hdmac_regs.h b/drivers/dma/at_hdmac_regs.h index fe8a5853ec49..397692e937b3 100644 --- a/drivers/dma/at_hdmac_regs.h +++ b/drivers/dma/at_hdmac_regs.h @@ -243,7 +243,6 @@ enum atc_status { * @active_list: list of descriptors dmaengine is being running on * @queue: list of descriptors ready to be submitted to engine * @free_list: list of descriptors usable by the channel - * @descs_allocated: records the actual size of the descriptor pool */ struct at_dma_chan { struct dma_chan chan_common; @@ -264,7 +263,6 @@ struct at_dma_chan { struct list_head active_list; struct list_head queue; struct list_head free_list; - unsigned int descs_allocated; }; #define channel_readl(atchan, name) \ From patchwork Thu Jan 23 14:03:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 11348175 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ECB86139A for ; Thu, 23 Jan 2020 14:03:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BF46C24684 for ; Thu, 23 Jan 2020 14:03:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="ulvWkw0s" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729108AbgAWODR (ORCPT ); Thu, 23 Jan 2020 09:03:17 -0500 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:22605 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729012AbgAWODK (ORCPT ); Thu, 23 Jan 2020 09:03:10 -0500 Received-SPF: Pass (esa5.microchip.iphmx.com: domain of Tudor.Ambarus@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa5.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="Tudor.Ambarus@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa5.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa5.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa5.microchip.iphmx.com; spf=Pass smtp.mailfrom=Tudor.Ambarus@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: 4iKMywHmHHbx6m7LLuIdWaMa1FKOsrGa9P+rkf44JPhLIHs7iwVM8cOiRxGeduxciK4zJenFoi TaZJVArsv+9q270GYhnNILsYlpeLMK6zOIlQppw+1ZE3H0eZME1CS24wZlD8LpPMChKzdR0F84 rhwj6DUrYAjBKH9u8SLw6hEviaTrk1vc9t/qv9gUWhDv7psWTA2ruLjg3MpGaiurdWE4u1phbl IzXrHogyR5CK0rGVhsTwiGXj1qo+hN0F35lJkApa2qbxExSsTgywzmQiYuoUlGnFlQJ6Vs9hSh ff0= X-IronPort-AV: E=Sophos;i="5.70,354,1574146800"; d="scan'208";a="62879880" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Jan 2020 07:03:10 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 23 Jan 2020 07:03:09 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 23 Jan 2020 07:03:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Stp2Oug6ljge/6USkvAR+A174WsoCFTU4Mo/fj2/hIk3LoGVxZ0zf1aIloPwT8oNCC6pnU8JYu08bxHrzpO8LDUMJgS+tH+n+6A9nzcX7JPMNiM+eDECrxs+jH/U0LfTFqjCGZSQGzgRvtjB48EL8mtxg06IndMSh1yJ96xthtQrEJ3gqlhdOEm8ahcUX+SLQULSkghTQZlbWoGs/q9M2wJy6zueGqMpH6TCaRjz1jqSSx1Gw4JYhBV1xTwKFoUyS5l3DGMNOxU7EH61ngQQcbnyNyxEMzPLm4yLdeaOBxxIwyvXZJ4T7nwyskNqjwNsL3JnMoOtHjy598dGthxe9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ga74aBoQfPJJJ2JhbZYrZ6NygndUxd1tEGrY8jJXQew=; b=dE915sdHFgSKaV/B3HGxfCaXwAtBh5TrotFQkU5G0FW2NpZ67iIJdHxVt30HzUsbZE9+lVid8r5RN76m7+g4HCtIDj2m0/hxe1R5695YgBIj+Skidd7/QQ6CwyrRGq2QsUeFm/fYmdos9x7JWB7DKHtzyjCffIkxBkJUTHqFCOI20BhvNAZ8Hh30VSyCFj3b2mHZOzX59cHUF/QNd2EZi2bmMl1hok9St+BAgrlaNCQi94kvsOy/xse93y61GG/Lm4fL+0Y66IPicNzt6qLOkWCxc6EcCu5/P5xfhT/9zoYSeZZqREEjwKxJTEHOWEpY/ZLcW+X1ykQqyydP7IuYAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ga74aBoQfPJJJ2JhbZYrZ6NygndUxd1tEGrY8jJXQew=; b=ulvWkw0sEQjORMCPlD4CDhGR7ar0sTCEizwM6Qg2+guN6NHplwUpQW+JT+ssYLyHXRPZx6CqIzLL1ld3vdG+jLg4tl2WPgLRT4For5V+QhOiMDpXqy6plewSw02UD8ePHho3kMiJpzyfOO3LSwELaFADynq3aNH/gWsRIZVKgAQ= Received: from MN2PR11MB4448.namprd11.prod.outlook.com (52.135.39.157) by MN2PR11MB3582.namprd11.prod.outlook.com (20.178.251.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Thu, 23 Jan 2020 14:03:08 +0000 Received: from MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb]) by MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb%5]) with mapi id 15.20.2644.027; Thu, 23 Jan 2020 14:03:08 +0000 From: To: , , CC: , , Subject: [PATCH 04/10] dmaengine: at_hdmac: Drop description for a not defined parameter Thread-Topic: [PATCH 04/10] dmaengine: at_hdmac: Drop description for a not defined parameter Thread-Index: AQHV0fXWPjB4PfrBgUGm0ZHrnuo/yA== Date: Thu, 23 Jan 2020 14:03:07 +0000 Message-ID: <20200123140237.125799-4-tudor.ambarus@microchip.com> References: <20200123140237.125799-1-tudor.ambarus@microchip.com> In-Reply-To: <20200123140237.125799-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 68a2879e-036e-490b-2138-08d7a00cf972 x-ms-traffictypediagnostic: MN2PR11MB3582: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 029174C036 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(396003)(366004)(39860400002)(136003)(189003)(199004)(2616005)(6486002)(316002)(26005)(36756003)(4326008)(81156014)(186003)(54906003)(110136005)(81166006)(6512007)(5660300002)(478600001)(8676002)(66946007)(64756008)(66476007)(76116006)(91956017)(66446008)(66556008)(1076003)(2906002)(4744005)(6506007)(107886003)(8936002)(71200400001)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB3582;H:MN2PR11MB4448.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ihhl7H3FXZ7gYPrgbJ83CpwtZKvnSp4oPLrHzLWDSF8YAIzP35FxZGc1yAb+coFfRoKA/Z2GsbO0/WZglpqsrjxQSYeAuk62xML/5j7L3wnIfBZE4wHt4upRcMUjeU1DkvPXxLcJzAJ5LL8sV4MrhseAbVyRrvZnJTR6kWtpAPjCNCytJLA5HI37QjVnVzf6iGB+lWTKy+Z+59BUXOb4JtMHnJsTIaa3QYxstQ3Drfhf3cxK3Qs6Rru429Vm79bCxbCAsuIeWzigqCbo/MW07ZuqBclBP/IvOwxxHZZIqdTQ/qG/3+PYmgAji9xsVXCYEnGR3baQ9nTNmNwzk5c85cUDgGwcWqMDJETKWGFZWOvlcZq5a0pZZuZR8uJKJwFR1+87YRHKUxBd7bJhxZYP4b+aqBYa8pZXjUuH9SohY4PbL0h8hfx1Bi58TKmm4R2a MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 68a2879e-036e-490b-2138-08d7a00cf972 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jan 2020 14:03:07.9613 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: DMYFCvSO6Q3nBC/6aAs+IXMBs0yqRLj6VdHHcbN6lYYx1oxYcHjHB/60DU+FcEWCgIToFLS21CFHwIC1aBn7ulsq2woLeBU9W++Y9tvRNpo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3582 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org From: Tudor Ambarus Probably a leftover, drop it. Signed-off-by: Tudor Ambarus --- drivers/dma/at_hdmac.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index e17b75075904..44d998bc894b 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1523,7 +1523,6 @@ static void atc_issue_pending(struct dma_chan *chan) /** * atc_alloc_chan_resources - allocate resources for DMA channel * @chan: allocate descriptor resources for this channel - * @client: current client requesting the channel be ready for requests * * return - the number of allocated descriptors */ From patchwork Thu Jan 23 14:03:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 11348177 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 64B3613A4 for ; Thu, 23 Jan 2020 14:03:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 387B821835 for ; Thu, 23 Jan 2020 14:03:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="HVyMTIGb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727307AbgAWODX (ORCPT ); Thu, 23 Jan 2020 09:03:23 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:5788 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729186AbgAWODW (ORCPT ); Thu, 23 Jan 2020 09:03:22 -0500 Received-SPF: Pass (esa2.microchip.iphmx.com: domain of Tudor.Ambarus@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="Tudor.Ambarus@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa2.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa2.microchip.iphmx.com; spf=Pass smtp.mailfrom=Tudor.Ambarus@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: 9j5hEO8eZ6hegDfNsTyRb5MgWQ85ZgMsX2okKLyjkxlapSKVYB4xQDvUhxgExtoWOq9vpY/Ppt i3UzyKtGdYZCjCcjYezGS03M0LWN606jluqK2EnyAtBKgeqJe3NKSXZkAizutpVCrgZ9XA9Fno Vcgcs6w645oVInYqupW7r/AD161zccO5YC/01vEg4CRnm9BYIEP8NwH3RfsGmjuFw4qOWVf+RR Tui4VurjN2BDzzelJOX+cAVvbKWC6mbWJQXe7r071W/r3mmpRdlkP5GR2/5RkIh6El5RqHnar+ vZU= X-IronPort-AV: E=Sophos;i="5.70,354,1574146800"; d="scan'208";a="63527841" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Jan 2020 07:03:21 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 23 Jan 2020 07:03:10 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 23 Jan 2020 07:03:11 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=moLiCqvTQPgVBi83y2bCFfVBVL7N9Heb9N7eQaLQo6VF7uPcGbizurvpu6xWU3mv0hc0jUCwYnrTOIcoH07Puw5tzOoiWRtnCvSJadZ7DpAhe6CdGuQDSoIPSCWnR5M1ydXCd7hcNNMIu0AS6NvWS7YNLCG8HzdDGjykEODkOdLTN1fObF88y971sMf9ovgvHJt/E0VOJRiPrfCyoEkWk5uMqmOWM8jARdvvuBn7iDecMLN67MaB1xtmemeI6w41E4TtTy/z+5Lm57x2dayTMktwj8m5SghSYbl1MoxHKUUvVJ3rWgZjTunyf1AGhNst/VlLey7CMYvkj+y9KtM5yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xH9EbT/FPyK7w4KJ1mOp0JOUUtYPDR0qGvxVTMYivp4=; b=mVf0iN6SIMA/3Yxd37r2xCsIARdxnUJgHKsMgdFDrJfr/T7UBwroEVXj2RKh6Pk6S7DoJLK3bcXn2mJMzXC7DJqjYZxnG2jT3ezFgvpWwEBOvJdj0QTTyQCKx59xIJlb8Tlx8f6AfBDW7NMYa7riqCTyshAq1c9KIbwuUsuI2+Eu3iZGl+Pu+64b5vb9KQSBvi29hYEsgkeGMZrya0fIx60vpwMnZoojdZgkfIBQGzhPBTsEXrqLIoJ1D6GVFZezk5OnP/E2qLvwABA9P2xT+Fho+voYouXIEA3l/u04H2mnf1+yKRsaUpn0Q64Upf7a9feM2cEe/F3RURBRdOyDRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xH9EbT/FPyK7w4KJ1mOp0JOUUtYPDR0qGvxVTMYivp4=; b=HVyMTIGbhf9xVpZOd5ShaJz7JuP9/1N7Lvm6X2ScHKV93FnuLv1Uk/w5fLg+3VT/Tih1iWePDnQUC1VDkJf93JZnQhd3IS5+yqeJwZmNLdVRwDTBRbRVPrNJakT5uBydpP4Z7oVRix4cBEZLpmJzWpKrq501eahrKsyIQLH4DJ8= Received: from MN2PR11MB4448.namprd11.prod.outlook.com (52.135.39.157) by MN2PR11MB4190.namprd11.prod.outlook.com (20.179.151.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Thu, 23 Jan 2020 14:03:09 +0000 Received: from MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb]) by MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb%5]) with mapi id 15.20.2644.027; Thu, 23 Jan 2020 14:03:09 +0000 From: To: , , CC: , , Subject: [PATCH 05/10] dmaengine: at_hdmac: Switch atomic allocations to GFP_NOWAIT Thread-Topic: [PATCH 05/10] dmaengine: at_hdmac: Switch atomic allocations to GFP_NOWAIT Thread-Index: AQHV0fXXs9r8bOU5kkSU4QX5BgPxKw== Date: Thu, 23 Jan 2020 14:03:09 +0000 Message-ID: <20200123140237.125799-5-tudor.ambarus@microchip.com> References: <20200123140237.125799-1-tudor.ambarus@microchip.com> In-Reply-To: <20200123140237.125799-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 12b16a5c-0d3b-4174-a4a0-08d7a00cfa4e x-ms-traffictypediagnostic: MN2PR11MB4190: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1303; x-forefront-prvs: 029174C036 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(376002)(136003)(346002)(396003)(366004)(199004)(189003)(1076003)(76116006)(91956017)(66446008)(64756008)(66476007)(66946007)(66556008)(6506007)(86362001)(107886003)(2906002)(71200400001)(8936002)(4326008)(26005)(54906003)(36756003)(316002)(2616005)(6486002)(110136005)(81156014)(5660300002)(8676002)(6512007)(186003)(478600001)(81166006);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB4190;H:MN2PR11MB4448.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: rCq6MOCIuE/D00QcDaXfJzSU1MGCbEmmrUq+46izB74OstI3LfSxKKCIR4l6jlH6aqdOZpNs25tDrKPJdC00SGudEIMAw6tVPJ6abh8piVe4FJPdzMI9wmtiVZiTqkQ3tPUi7nnasZmUuTsfLeVnTHH2QPv5L2i4HHGgv5PTLUeDAH/iPNSmXNPSCx82uUoJWQf589CAjisFm+SN/qWSGi+JJ+VFSYb6O5D5j1zalJ1EwhUCdLM/gD14E/+yKEIWXQ2dbQHWXpB3X30wP78mPhXWO2Cls5EKeiU36M27+f5y/UekJxzybE490SZYageWsCiNSHMy7sGPPEel7ZZVAEoRmIxmK6wPYjehc9qDfSu2GPShZLm6YRzFcEecnY8ICNCxVecy4uvqice6by9Q7ubyDcmYmIThgmmz5jL8s971i4otPbpD4Dr8C8gq0c1V MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 12b16a5c-0d3b-4174-a4a0-08d7a00cfa4e X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jan 2020 14:03:09.4814 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: iUTDd8l7Bgrr0uNhG5ywGxw64PjmomMIiGXsqzrSuQO0g3QWqGkmpNg5BMiYnOmLUhme/EymRVBtxcdTtHFUAfh9tkbKCE5P0gkr4njnzuc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4190 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org From: Tudor Ambarus Avoids sleeping without depleting the emergency pool. The rationale being that in most cases a dma device is either offloading an operation that will automatically fallback to software when the descriptor allocation fails, or we can simply poll and wait for the dma device to release some in use descriptors. Signed-off-by: Tudor Ambarus --- drivers/dma/at_hdmac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 44d998bc894b..8e8e04bd1b28 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -147,7 +147,7 @@ static struct at_desc *atc_desc_get(struct at_dma_chan *atchan) /* no more descriptor available in initial pool: create one more */ if (!ret) - ret = atc_alloc_descriptor(&atchan->chan_common, GFP_ATOMIC); + ret = atc_alloc_descriptor(&atchan->chan_common, GFP_NOWAIT); return ret; } @@ -931,7 +931,7 @@ atc_prep_dma_memset(struct dma_chan *chan, dma_addr_t dest, int value, return NULL; } - vaddr = dma_pool_alloc(atdma->memset_pool, GFP_ATOMIC, &paddr); + vaddr = dma_pool_alloc(atdma->memset_pool, GFP_NOWAIT, &paddr); if (!vaddr) { dev_err(chan2dev(chan), "%s: couldn't allocate buffer\n", __func__); @@ -989,7 +989,7 @@ atc_prep_dma_memset_sg(struct dma_chan *chan, return NULL; } - vaddr = dma_pool_alloc(atdma->memset_pool, GFP_ATOMIC, &paddr); + vaddr = dma_pool_alloc(atdma->memset_pool, GFP_NOWAIT, &paddr); if (!vaddr) { dev_err(chan2dev(chan), "%s: couldn't allocate buffer\n", __func__); From patchwork Thu Jan 23 14:03:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 11348179 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98EB814B4 for ; Thu, 23 Jan 2020 14:03:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6DAA321835 for ; Thu, 23 Jan 2020 14:03:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="XkNDs5k7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729203AbgAWODY (ORCPT ); Thu, 23 Jan 2020 09:03:24 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:5788 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729012AbgAWODX (ORCPT ); Thu, 23 Jan 2020 09:03:23 -0500 Received-SPF: Pass (esa2.microchip.iphmx.com: domain of Tudor.Ambarus@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="Tudor.Ambarus@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa2.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa2.microchip.iphmx.com; spf=Pass smtp.mailfrom=Tudor.Ambarus@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: 1+r07DdaUh+XQv8hlJbv0xXZY96lWW7nM1Eilhy4SoIHuZ33tiFyFGSWUX3nEMwiZIzZpp5VG4 o/MNY0Xpuvvyvkr20RrW7NTkZeFeEBBK4Q+wqkN5kvKdqL6Txb8+81EToc6QyMAu3kerIOK4UB 4SaiP4JPDR88d6h9bRQaeRqDuI8URpLIx1XnWdoJYI7x5jNjrsajqP9ii/xhtq6xKc7CJ2t+6q t16UQ1UouEF7TCAgpOJjrGe/tkx/SxZjpjBMJ64/nN2xskiI0EiZijNN02T1EZDtRrbvkk5l/F YFY= X-IronPort-AV: E=Sophos;i="5.70,354,1574146800"; d="scan'208";a="63527842" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Jan 2020 07:03:21 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 23 Jan 2020 07:03:13 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 23 Jan 2020 07:03:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AWF/MsXrZaBR1Vr4ka6C9BHu9h3WwoHa5w3ey8V9NOin43dgBjGfoSIo2wpFfBfH9vUGwy9o6Gs3efRwhLkhAdFv9sK+uRdlAzqSRA+6li3s6vCMw0CQ5qq3dwsrq2N+gJgEcY6HmcY2izV8S+uCexzXU2QTLuV5nxudxNy/in0gS+aMENBiYE1jq3KGYkqS3FzWAZ4BXO/ZH9NYa+5vNiwstzSZSbCF/h1YgkN86e2qd4HfEC5vv/K9VFRc9Vqzbf27VTALIF70mMNVftxfKKa9fIhOtuOQnzZ0FqWzBPA21RVTkYpSR3PRiSdasUwITVNKYdQdwqNq8Do4QPefzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QdCT3Sa8zh6QvGLW4YC8E3cNO8031UJEzEhP1u7g2LM=; b=mzXPTyy10QmBbTL0RPqUi4fyZ6CJ10ZDNYpEKIGdSDl9BdTcVVtloSgWOoCE9RUm2x4zh4PWflfE2FgdTtYNL+9MX4LQWywbtxpTMcraHolAcZdjQxIV+zEoBxS09l1+oHqvIvpm1OhsJ/2KFq36+OaCcx1GrcW1cEOlUR2VnFXrwpNddE9k0BM5SWvgUHgKYjRzgOYAUCFlLifBdOC8UfefmWdiqB23wtJtqoN+h/nh0ruH0XIZLh9FSM0YuE+GOgG37dCQ2yvXuT6d/9rtF+fP7GNGy1LvCKW7kEjcvQ12FvSqvYdxC1kfdCz6VeDUaohQNa4S4pr4OPNUf3WZIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QdCT3Sa8zh6QvGLW4YC8E3cNO8031UJEzEhP1u7g2LM=; b=XkNDs5k74hWlHpzagqObp7knuuCdhxy1O0jK4OXIyeZYn0GH7Sd7I6L2nl+Y06/JwZDUcfDmM1JG/8cOrUTdH8291WNyrYzQtH4cdF+f37LInN9DZu3sFZp00LYXRsoIXIyZfCkAZk8WrfghEMbgaBug6j4t7xq0hoBSmJzGrFk= Received: from MN2PR11MB4448.namprd11.prod.outlook.com (52.135.39.157) by MN2PR11MB4190.namprd11.prod.outlook.com (20.179.151.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Thu, 23 Jan 2020 14:03:11 +0000 Received: from MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb]) by MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb%5]) with mapi id 15.20.2644.027; Thu, 23 Jan 2020 14:03:11 +0000 From: To: , , CC: , , Subject: [PATCH 06/10] dmaengine: at_hdmac: Fix deadlocks Thread-Topic: [PATCH 06/10] dmaengine: at_hdmac: Fix deadlocks Thread-Index: AQHV0fXYj/5vVpZ6cU+eOuaVKc1MfA== Date: Thu, 23 Jan 2020 14:03:11 +0000 Message-ID: <20200123140237.125799-6-tudor.ambarus@microchip.com> References: <20200123140237.125799-1-tudor.ambarus@microchip.com> In-Reply-To: <20200123140237.125799-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 221aabc6-2667-4a95-87db-08d7a00cfb60 x-ms-traffictypediagnostic: MN2PR11MB4190: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4502; x-forefront-prvs: 029174C036 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(376002)(136003)(346002)(396003)(366004)(199004)(189003)(1076003)(76116006)(91956017)(66446008)(64756008)(66476007)(66946007)(66556008)(6506007)(86362001)(107886003)(2906002)(71200400001)(8936002)(4326008)(26005)(54906003)(36756003)(316002)(2616005)(6486002)(110136005)(81156014)(5660300002)(8676002)(6512007)(186003)(478600001)(81166006);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB4190;H:MN2PR11MB4448.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: DZypPEbolAIOzBQA35VpOpOwTqosrHbMmMzxWQ83gAJ2QdN+ZJ17LvQrBco894NM7AQf6WAysBTPYi5ojy/YSkBVFqHc861fZgX9LWVtoGTWh143JWMA5LUM0odHa6qjSdzVKSWL0HP9f9fnCtvr+jTLf5isw8DLlYzOBVqkHjlrFlmXt811kQ5Sf7SfhNkbdfL7d2MgSYWqU7FoSjPyZIt9HZ9QrYk8ONEsL2fln44qhNIUdQOlFWGCTvSeQigfmkwrv4kXmSky9HB6LFtHM4z4ghc76574179rgb/rEuYrRuDyT+7BAJbuHlkOnAempZMrmDmeIWmpmcyPiPL2t0sD+x14Tr7b2x8/JIYQ1HcjuNKORYLH9SbdGGLNOm7RKv0TjWUBKYP866ozfmrZ+HHLm7659mwnkV+FbOjmBUd9brzefgDtEj2AHcm4GVz8 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 221aabc6-2667-4a95-87db-08d7a00cfb60 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jan 2020 14:03:11.1964 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: V+oelASSJP+O22YGr1inOgQWIq8TlKZmPEwIkrFGR2dnQ1IEgrbxLW7RlEtQLYCwCHNU4IdfHiyR+32JPkdthK1eU43Nt3lZDt3luZeBK+U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4190 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org From: Tudor Ambarus Fix the following deadlocks: 1/ atc_handle_cyclic() and atc_chain_complete() called dmaengine_desc_get_callback_invoke() while wrongly holding the atchan->lock. Clients can set the callback to dmaengine_terminate_sync() which will end up trying to get the same lock, thus a deadlock occurred. 2/ dma_run_dependencies() was called with the atchan->lock held, but the method calls device_issue_pending() which tries to get the same lock, and so a deadlock occurred. The driver must not hold the lock when invoking the callback or when running dependencies. Releasing the spinlock within a called function before calling the callback is not a nice thing to do -> called functions become non-atomic when called within an atomic region. Thus the lock is now taken in the child routines whereever is needed. Signed-off-by: Tudor Ambarus --- drivers/dma/at_hdmac.c | 74 ++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 8e8e04bd1b28..73a20780744b 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -426,17 +426,19 @@ static int atc_get_bytes_left(struct dma_chan *chan, dma_cookie_t cookie) * atc_chain_complete - finish work for one transaction chain * @atchan: channel we work on * @desc: descriptor at the head of the chain we want do complete - * - * Called with atchan->lock held and bh disabled */ + */ static void atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc) { struct dma_async_tx_descriptor *txd = &desc->txd; struct at_dma *atdma = to_at_dma(atchan->chan_common.device); + unsigned long flags; dev_vdbg(chan2dev(&atchan->chan_common), "descriptor %u complete\n", txd->cookie); + spin_lock_irqsave(&atchan->lock, flags); + /* mark the descriptor as complete for non cyclic cases only */ if (!atc_chan_is_cyclic(atchan)) dma_cookie_complete(txd); @@ -453,16 +455,13 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc) /* move myself to free_list */ list_move(&desc->desc_node, &atchan->free_list); + spin_unlock_irqrestore(&atchan->lock, flags); + dma_descriptor_unmap(txd); /* for cyclic transfers, * no need to replay callback function while stopping */ - if (!atc_chan_is_cyclic(atchan)) { - /* - * The API requires that no submissions are done from a - * callback, so we don't need to drop the lock here - */ + if (!atc_chan_is_cyclic(atchan)) dmaengine_desc_get_callback_invoke(txd, NULL); - } dma_run_dependencies(txd); } @@ -480,9 +479,12 @@ static void atc_complete_all(struct at_dma_chan *atchan) { struct at_desc *desc, *_desc; LIST_HEAD(list); + unsigned long flags; dev_vdbg(chan2dev(&atchan->chan_common), "complete all\n"); + spin_lock_irqsave(&atchan->lock, flags); + /* * Submit queued descriptors ASAP, i.e. before we go through * the completed ones. @@ -494,6 +496,8 @@ static void atc_complete_all(struct at_dma_chan *atchan) /* empty queue list by moving descriptors (if any) to active_list */ list_splice_init(&atchan->queue, &atchan->active_list); + spin_unlock_irqrestore(&atchan->lock, flags); + list_for_each_entry_safe(desc, _desc, &list, desc_node) atc_chain_complete(atchan, desc); } @@ -501,38 +505,44 @@ static void atc_complete_all(struct at_dma_chan *atchan) /** * atc_advance_work - at the end of a transaction, move forward * @atchan: channel where the transaction ended - * - * Called with atchan->lock held and bh disabled */ static void atc_advance_work(struct at_dma_chan *atchan) { + unsigned long flags; + int ret; + dev_vdbg(chan2dev(&atchan->chan_common), "advance_work\n"); - if (atc_chan_is_enabled(atchan)) + spin_lock_irqsave(&atchan->lock, flags); + ret = atc_chan_is_enabled(atchan); + spin_unlock_irqrestore(&atchan->lock, flags); + if (ret) return; if (list_empty(&atchan->active_list) || - list_is_singular(&atchan->active_list)) { - atc_complete_all(atchan); - } else { - atc_chain_complete(atchan, atc_first_active(atchan)); - /* advance work */ - atc_dostart(atchan, atc_first_active(atchan)); - } + list_is_singular(&atchan->active_list)) + return atc_complete_all(atchan); + + atc_chain_complete(atchan, atc_first_active(atchan)); + + /* advance work */ + spin_lock_irqsave(&atchan->lock, flags); + atc_dostart(atchan, atc_first_active(atchan)); + spin_unlock_irqrestore(&atchan->lock, flags); } /** * atc_handle_error - handle errors reported by DMA controller * @atchan: channel where error occurs - * - * Called with atchan->lock held and bh disabled */ static void atc_handle_error(struct at_dma_chan *atchan) { struct at_desc *bad_desc; struct at_desc *child; + unsigned long flags; + spin_lock_irqsave(&atchan->lock, flags); /* * The descriptor currently at the head of the active list is * broked. Since we don't have any way to report errors, we'll @@ -564,6 +574,8 @@ static void atc_handle_error(struct at_dma_chan *atchan) list_for_each_entry(child, &bad_desc->tx_list, desc_node) atc_dump_lli(atchan, &child->lli); + spin_unlock_irqrestore(&atchan->lock, flags); + /* Pretend the descriptor completed successfully */ atc_chain_complete(atchan, bad_desc); } @@ -571,8 +583,6 @@ static void atc_handle_error(struct at_dma_chan *atchan) /** * atc_handle_cyclic - at the end of a period, run callback function * @atchan: channel used for cyclic operations - * - * Called with atchan->lock held and bh disabled */ static void atc_handle_cyclic(struct at_dma_chan *atchan) { @@ -591,17 +601,14 @@ static void atc_handle_cyclic(struct at_dma_chan *atchan) static void atc_tasklet(unsigned long data) { struct at_dma_chan *atchan = (struct at_dma_chan *)data; - unsigned long flags; - spin_lock_irqsave(&atchan->lock, flags); if (test_and_clear_bit(ATC_IS_ERROR, &atchan->status)) - atc_handle_error(atchan); - else if (atc_chan_is_cyclic(atchan)) - atc_handle_cyclic(atchan); - else - atc_advance_work(atchan); + return atc_handle_error(atchan); - spin_unlock_irqrestore(&atchan->lock, flags); + if (atc_chan_is_cyclic(atchan)) + return atc_handle_cyclic(atchan); + + atc_advance_work(atchan); } static irqreturn_t at_dma_interrupt(int irq, void *dev_id) @@ -1437,6 +1444,8 @@ static int atc_terminate_all(struct dma_chan *chan) list_splice_init(&atchan->queue, &list); list_splice_init(&atchan->active_list, &list); + spin_unlock_irqrestore(&atchan->lock, flags); + /* Flush all pending and queued descriptors */ list_for_each_entry_safe(desc, _desc, &list, desc_node) atc_chain_complete(atchan, desc); @@ -1445,8 +1454,6 @@ static int atc_terminate_all(struct dma_chan *chan) /* if channel dedicated to cyclic operations, free it */ clear_bit(ATC_IS_CYCLIC, &atchan->status); - spin_unlock_irqrestore(&atchan->lock, flags); - return 0; } @@ -1507,7 +1514,6 @@ atc_tx_status(struct dma_chan *chan, static void atc_issue_pending(struct dma_chan *chan) { struct at_dma_chan *atchan = to_at_dma_chan(chan); - unsigned long flags; dev_vdbg(chan2dev(chan), "issue_pending\n"); @@ -1515,9 +1521,7 @@ static void atc_issue_pending(struct dma_chan *chan) if (atc_chan_is_cyclic(atchan)) return; - spin_lock_irqsave(&atchan->lock, flags); atc_advance_work(atchan); - spin_unlock_irqrestore(&atchan->lock, flags); } /** From patchwork Thu Jan 23 14:03:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 11348187 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65426139A for ; Thu, 23 Jan 2020 14:03:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 392EC2467B for ; Thu, 23 Jan 2020 14:03:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="bPwfCk+V" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729138AbgAWODU (ORCPT ); Thu, 23 Jan 2020 09:03:20 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:59663 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726232AbgAWODR (ORCPT ); Thu, 23 Jan 2020 09:03:17 -0500 Received-SPF: Pass (esa6.microchip.iphmx.com: domain of Tudor.Ambarus@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa6.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="Tudor.Ambarus@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa6.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa6.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa6.microchip.iphmx.com; spf=Pass smtp.mailfrom=Tudor.Ambarus@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: J+UCl9oqSXh5h+b1AqlEGWYJjur7WYRFlz2R8DJnh5/NE5hpi345CBA3+U+8X4j2Zbscyyv+vk RPt5NsxMN3JyYeORpr3tbj2umbrq/0qDOnW5RAuD06tfn9doOsK8zaNJ1B2Xj9nY/Ssvi88BiY 1FcNrPoRP8KwEVKyppbbX41+QYSDHJy+kA6nNj2vYbXneFn/lgcitqgEsQTlqQo2LGavAu8ioE wsHemhz3gOGuO2xjbtfWPUzY4Rnd/TDZWoESX8k9G8ZWnj7hz7VO7iJ6hWW+r6VnG5+zYmeeuf Itw= X-IronPort-AV: E=Sophos;i="5.70,354,1574146800"; d="scan'208";a="61795150" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Jan 2020 07:03:16 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 23 Jan 2020 07:03:14 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 23 Jan 2020 07:03:14 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dw21m/CkNl4dDtFUjnbVGd5VljIlSvd2ZkJrKhSv8LarPdaJikqbe/YH/XxHCM4GhmRBuPEurgC9zCs4yxVXZPnuEyJqLzCggxoqbaE7eQ74fQHfV+vNCuNztsRBDa8WDab+SuZgkl2NZQxtlcnQRd7HVV1/OZwsLPDXoXfIUPYdpcjh2OKnDWfGT0Li7y96r9mqumT3PpWP8QQxyQszLCutFM1/mqmatUutQQuQX5pTV8ruIZuk0saCicSvo3Yesnm7GYa6QHAns8um7j5gp+frDk+DJyMdNgzMayESUBhuDCYDDyOakCoUzV70UMh8I5Vqkqrk1qCtwd8jh6XDIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jvJaVMeAjvnduoZnVGPo0vCM73snETi768FFqnDBLb4=; b=JYJkNIv60pNkQFRjlDNegG7gqpGnBN/Wu3vm5i7TmCRYDAHlVXs5sQcFk95mM33J2vCrt/xAi/xfy2tAIE7LCKdXghn581QbHFQTNxG66y4CLsLZp1T0GiGjgUospHT6sg0ixWZFRmOOQGOawY81+vJBfSZ4ChqyOL0DybK4y+dgtGDLIjCEjjmO07ZnTpKuWdC8iyOlCSL4tcLeO1cEKrL/P9K7yRo9kfxNspjE5v1Ya5bN4iiMB6EAYMQYpDPMNI0flQcpFscvIQyKqjCuO8wNVB1ToVRBRn6tAj9Zt+4BsJaGQ6UELe7q3TMjnbcSojhOxP1in7/9d2vvA7T4Ng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jvJaVMeAjvnduoZnVGPo0vCM73snETi768FFqnDBLb4=; b=bPwfCk+VLLErIfeF+tMWyckYNG+AKdXkGe9/kLQtIm6Fnz1qv3SGSAV5VPtGZeR8oBvKgnDbM0YypOXFEQmZ6MUp3qhctIo2zUYnXujEQSvSkuIb2FFjRw1j20tnx9+LK5uP4m+5F+jRyqmcqhMBj0iWG/8dAavWZjSF7DJWcyQ= Received: from MN2PR11MB4448.namprd11.prod.outlook.com (52.135.39.157) by MN2PR11MB3582.namprd11.prod.outlook.com (20.178.251.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Thu, 23 Jan 2020 14:03:12 +0000 Received: from MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb]) by MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb%5]) with mapi id 15.20.2644.027; Thu, 23 Jan 2020 14:03:12 +0000 From: To: , , CC: , , Subject: [PATCH 07/10] dmaengine: at_xdmac: Drop always true check Thread-Topic: [PATCH 07/10] dmaengine: at_xdmac: Drop always true check Thread-Index: AQHV0fXZBZaAhMQN4EGCBG7fYIqIiQ== Date: Thu, 23 Jan 2020 14:03:12 +0000 Message-ID: <20200123140237.125799-7-tudor.ambarus@microchip.com> References: <20200123140237.125799-1-tudor.ambarus@microchip.com> In-Reply-To: <20200123140237.125799-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9103a7d8-17b3-4b3f-895c-08d7a00cfc39 x-ms-traffictypediagnostic: MN2PR11MB3582: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 029174C036 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(396003)(366004)(39860400002)(136003)(189003)(199004)(2616005)(6486002)(316002)(26005)(36756003)(4326008)(81156014)(186003)(54906003)(110136005)(81166006)(6512007)(5660300002)(478600001)(8676002)(66946007)(64756008)(66476007)(76116006)(91956017)(66446008)(66556008)(1076003)(2906002)(4744005)(6506007)(107886003)(8936002)(71200400001)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB3582;H:MN2PR11MB4448.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: YQJCu0j2QHQn5m1YQOH2HvtI1tWfxYk8RKe3uHM+C46Mynt3ManzdXW2fwbcE9ir12ybRv7s6mjWH8MZfdojlV7zQnt51iBko+Ki89NT1JWoRZPcN4bLFOyTS7o5Pai3SJAy2pyn1+pGVYoePftGUuQdPnzoMcqpmXYPiJX9zvOBpWanw/bwKOWAGLDIxpPhgIyj/F3XsFiLHLHuS2QQNQQSgC8sTMI8aMw3z2ipTj4O5ROQtGm/h7bKbBCxd+a/UWdmwNgAr7fBkRTfoDkfD4DSFnYhESR0d8W5Nt1x1MuH9kLLC7ZiZon8GF/9OUWtA3B60UtEpWlIOr34AfpMJMbz003i+XSTxYsmuAHqyL1mYt6YxFE8/4VAqcmclE4SeOM9M12cVAl3Zigr26G+Tsgcl4Xdry1leajqDbXM057ok7kogI7onvUyKZG3fbwf MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 9103a7d8-17b3-4b3f-895c-08d7a00cfc39 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jan 2020 14:03:12.6856 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: F4waPFdTJ3QHf44ZeBEzncLiBbiJ9IE+1f779T9shBt2LG/wEyrgQh6RsMAx6mwJP2QjzVkbsjKxSW2TQte0mfsW0190MLOTuldE0KZIl54= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3582 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org From: Tudor Ambarus The code in cause is already in the else case of 'if (at_xdmac_chan_is_cyclic(atchan))', drop the redundant check. Signed-off-by: Tudor Ambarus --- drivers/dma/at_xdmac.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index f71c9f77d405..3d6e84def7a6 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -1656,11 +1656,9 @@ static void at_xdmac_tasklet(unsigned long data) at_xdmac_remove_xfer(atchan, desc); spin_unlock(&atchan->lock); - if (!at_xdmac_chan_is_cyclic(atchan)) { - dma_cookie_complete(txd); - if (txd->flags & DMA_PREP_INTERRUPT) - dmaengine_desc_get_callback_invoke(txd, NULL); - } + dma_cookie_complete(txd); + if (txd->flags & DMA_PREP_INTERRUPT) + dmaengine_desc_get_callback_invoke(txd, NULL); dma_run_dependencies(txd); From patchwork Thu Jan 23 14:03:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 11348183 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A0FCF14B4 for ; Thu, 23 Jan 2020 14:03:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7F76B2467B for ; Thu, 23 Jan 2020 14:03:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="K2hyK9oR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729160AbgAWODV (ORCPT ); Thu, 23 Jan 2020 09:03:21 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:43284 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729012AbgAWODV (ORCPT ); Thu, 23 Jan 2020 09:03:21 -0500 Received-SPF: Pass (esa1.microchip.iphmx.com: domain of Tudor.Ambarus@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa1.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="Tudor.Ambarus@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa1.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa1.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa1.microchip.iphmx.com; spf=Pass smtp.mailfrom=Tudor.Ambarus@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: eVFpOUDn0nTfUWgpsYNbPwNLOqDGwOYXwD49py+WaGWaaFg9ovtl6MTND34A1laS3ZTaO9pWFK tgDxG1/G/mS/ldGxeNmskV539ELkBPe0zF+GINlc7jVwavtsqH8K3Ki+qu6hlDGCkqGp0xrlkc lRZW80wvRicLlLyZuyca0jnQgO76KfnoKxmeuktnwl1T6pNpztONZC0pI8hZcJN9+26w+WxPKC XjST2mBLWcf25C4uUv5NCTNJFu20dSJLOUADA9YuKQQ0HB+SkPElf/x2nV7yss2fkcquXdr8K1 GGA= X-IronPort-AV: E=Sophos;i="5.70,354,1574146800"; d="scan'208";a="65735579" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Jan 2020 07:03:19 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 23 Jan 2020 07:03:16 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 23 Jan 2020 07:03:16 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EQT6bvxm06gAAB6hEbCCa4c9oDPbhrvxN0mWnjOT46SaMdf7XutmK96Lph1knUqPuH+Q6wW5UuLImqkrS0MGyU1BaM40ayvMsp2DFoRp+VuH1jP8/uAPpV6yN347Eb3YcMBHTiY+nLN7ExEMOIuRLS+bVp4L3llwFe/Y0lsu8+G7NqKSriMhkxBe2rDhxwSiKPyBa2F1BpS8gI7QiEOgCHMSQzBEypQ+LaTER0FrCrFgC/BgB/uUwtsXKjtb4CZLnYFu0DDBNM7bR3nETMwY6RC5spOXDs6nXRGkGluwZjm5AyODzqDHLUWAUIf+WM3z8fhhAyiXJvpMrr8RlXUCyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H8WJ40JAHNtvXacElpVMs4YRQfvkF3MRNJBTvWkM2N8=; b=UQpJQBd0UVZu3LWTirdfV/rwpwvzxoGidI0YuGi1zGYucpDTo5cRhppPc2oEaQY+tn9xgbX1+oo7bURt8Y1CL08wOxvwaAQJJGK/DbW1TwQl/rNSdb8AOBaIzbGdT21qJbyAMCQJTzgUmJ/ccFV0c+5w8RPtHJI201LaRLH2cREADz7fH8g5f4S+A8QqGYyQSrRghC1MFC0pzZILHsFfCVOPhZR4ZAkbpViI41N5zBwz7+Ug/+YrxW5qiXNPTXMu/6ubzHO10mxUedltGhNhgdMSQtWIXjdKz7qH74UrJ236GU3Fqrn45ZCV62A1Q/FESZfxht9Yq6j68F5/TGMDJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H8WJ40JAHNtvXacElpVMs4YRQfvkF3MRNJBTvWkM2N8=; b=K2hyK9oRey+l/anRvpdhb8Hgab8ICTzV9oexvNCW6N+XT7CW+gJKX6uStxoIYVpfHcfDOkHNXEtNqcP5Xn4KVs9Nn3FDQ0bl56+m7NeGCE4ClX2hXDlE2X11omvYwyiWeGfnYSK77ZYT3OTDEyGQYb33ehfbBkoaKkjtMu1Fo+U= Received: from MN2PR11MB4448.namprd11.prod.outlook.com (52.135.39.157) by MN2PR11MB3582.namprd11.prod.outlook.com (20.178.251.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Thu, 23 Jan 2020 14:03:14 +0000 Received: from MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb]) by MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb%5]) with mapi id 15.20.2644.027; Thu, 23 Jan 2020 14:03:14 +0000 From: To: , , CC: , , Subject: [PATCH 08/10] dmaengine: at_xdmac: Drop locking in at_xdmac_alloc_chan_resources() Thread-Topic: [PATCH 08/10] dmaengine: at_xdmac: Drop locking in at_xdmac_alloc_chan_resources() Thread-Index: AQHV0fXaZQjnejE0TEqc5jyVns2qLw== Date: Thu, 23 Jan 2020 14:03:14 +0000 Message-ID: <20200123140237.125799-8-tudor.ambarus@microchip.com> References: <20200123140237.125799-1-tudor.ambarus@microchip.com> In-Reply-To: <20200123140237.125799-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: cc2f02dc-eb3b-451c-6129-08d7a00cfd36 x-ms-traffictypediagnostic: MN2PR11MB3582: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 029174C036 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(396003)(366004)(39860400002)(136003)(189003)(199004)(2616005)(6486002)(316002)(26005)(36756003)(4326008)(81156014)(186003)(54906003)(110136005)(81166006)(6512007)(5660300002)(478600001)(8676002)(66946007)(64756008)(66476007)(76116006)(91956017)(66446008)(66556008)(1076003)(2906002)(6506007)(107886003)(8936002)(71200400001)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB3582;H:MN2PR11MB4448.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: a8hyQjmdffQa3XJKJwR1xh0D9rh5fXcKQl+z7Is56whoEJrT2yIRowH6IKMzECv+heUHJrs/LiHsIsdyf4hB3RmdVJHwyHgnP//AManWpC80pprEmicM1AjrkCEc3ozKoomH7zi7jPRIzdLwy56QOu/oUnmkC4ZqKTz963r4Tse3wVqA7tf8HdSKOGiC/CHckTrMWkiszHGK1sDJLESepGOrutSjUusO1Vb7OYTnLtOTNNNyb8FsA4H+dNqpU236haaeZEl9OaMpgb0qufn7kxgoHL0vIq3WfunDEXCU5h+laNeV9JLuEbZLCkULSdhbpkFojhgv4dQki+TWkxATrJtkb4f/Tp/FknuryKOSnmMA0UvW/aHmJq3OrogQ/3kADwNF/9xxETiKf3hxv46pdsZMpPZ4HxKRZlCNhdTp6k6VWn/IhUzfmKkFUkFpfAni MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: cc2f02dc-eb3b-451c-6129-08d7a00cfd36 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jan 2020 14:03:14.2476 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: YQKB7eLXAX2Sg+A5rRHJhTF2jQeD1VEPPJAFpCPuPBwPQPGVJ2Sw+S2NjBZ8+wjcZp0rxV2EDj9Hs9sZ30hv2Cts0Z8KhzqXm7ZMH4DUErQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3582 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org From: Tudor Ambarus There is no need for locking in device_alloc_chan_resources(), the DMA core takes care of it by using a dma_list_mutex around the DMA devices. Signed-off-by: Tudor Ambarus --- drivers/dma/at_xdmac.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index 3d6e84def7a6..8fb01bc90ba7 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -1820,22 +1820,17 @@ static int at_xdmac_alloc_chan_resources(struct dma_chan *chan) struct at_xdmac_chan *atchan = to_at_xdmac_chan(chan); struct at_xdmac_desc *desc; int i; - unsigned long flags; - - spin_lock_irqsave(&atchan->lock, flags); if (at_xdmac_chan_is_enabled(atchan)) { dev_err(chan2dev(chan), "can't allocate channel resources (channel enabled)\n"); - i = -EIO; - goto spin_unlock; + return -EIO; } if (!list_empty(&atchan->free_descs_list)) { dev_err(chan2dev(chan), "can't allocate channel resources (channel not free from a previous use)\n"); - i = -EIO; - goto spin_unlock; + return -EIO; } for (i = 0; i < init_nr_desc_per_channel; i++) { @@ -1852,8 +1847,6 @@ static int at_xdmac_alloc_chan_resources(struct dma_chan *chan) dev_dbg(chan2dev(chan), "%s: allocated %d descriptors\n", __func__, i); -spin_unlock: - spin_unlock_irqrestore(&atchan->lock, flags); return i; } From patchwork Thu Jan 23 14:03:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 11348185 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F319A139A for ; Thu, 23 Jan 2020 14:03:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C77DD24685 for ; Thu, 23 Jan 2020 14:03:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="pCEAdAsR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729191AbgAWODg (ORCPT ); Thu, 23 Jan 2020 09:03:36 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:43284 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729154AbgAWODV (ORCPT ); Thu, 23 Jan 2020 09:03:21 -0500 Received-SPF: Pass (esa1.microchip.iphmx.com: domain of Tudor.Ambarus@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa1.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="Tudor.Ambarus@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa1.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa1.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa1.microchip.iphmx.com; spf=Pass smtp.mailfrom=Tudor.Ambarus@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: kYl86JlcVOZmI8m8fpkmiwWhvT2sT+G4Z3nIyZKdNnVXU+Q6ToAjybnC+t2Iekzt4sZbYrq5L/ RoP/WW4QLMjG0pQiHoxrekLPDYO55rN68pwhBDWH0/h03or+4zbmS7chi+v0nYDrQCfalfRoaL /GWKgyv+gNRRJn1CsyY59CaqhAJ8gA3fRbV6k6b0f455m0FCFum6GufuyG+beRLOHc2iFS/lN8 xLlLyyoAXEghyVVRvVcjJOjTyTNVDHyyuzKChJoLKblhD6X7lcoE8BsZuffVuQOMxj7f50I/6u iws= X-IronPort-AV: E=Sophos;i="5.70,354,1574146800"; d="scan'208";a="65735580" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Jan 2020 07:03:19 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 23 Jan 2020 07:03:17 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 23 Jan 2020 07:03:17 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mgO8wdjQUtsNzVV7YhC+0DWIfmK+ViXkyRf0kxQyJ4T0VQMAlXoVeWJo2ifav/f2EqBOlbqyTmlHsaIqPtL5khYi8wFMLqFLb1fq7PDH8BtcRLrGt3J+uHW7CsG7YRohoIh7I74d5eb3npE1sS5RxVKLj3gteNdHE4/0DH264IzR68//nYOgOoTrYYBdtsAG6embSAjBt8Kj0fMWKqCW08oP6tKkCkJfhrwInmZ0wXfWed1d98N7oIFiwCaje+b4vSUsQBB0pybZJhsO4OmgRt2JsnHwmyW7/4e0Q5Fph+zQSEYIexpObzj+8gaNtV7PmWyILQUL5HFaXyQzslNwhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Utn9ypide2LtjsTCJlJCWFwEQV20hJPPfkX3MyOY9/A=; b=Fvgg5ekFSF0s1ZqF/2PnQo5SL0lQ8gYMyeJpFDEM4pU9Wklu8PHAndbtuVxgmng+B6p1egEmMSfPmdz7XEhnQRYs+KaS6w9XgyWkq5YARGpdqKA6CXVy6KbfDnSbuoZnA4IrgH4p9vg+pZST124HPYcFrmsJ1JH0b80Dzp5WwVWAbTZqpOPdsrWmIPfW3Z6x+GT6ZRseIsoxc33Vksh4SYq5kCDzWy/OXQk9dmkhDw+SeoTPPrJTNbOxfdxVzUCH+3BpKitri3dlHKqPC2ktkTcdTlmwo4aLm//lIVcP8FqFluPzPlJza5O354kuLMsUgVLNcaZ+ygmiOwj5Hs3bgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Utn9ypide2LtjsTCJlJCWFwEQV20hJPPfkX3MyOY9/A=; b=pCEAdAsRRhz8DdtdUr+rEpQg3L/xMQ3r2NG/bJMGFwaCrOnyCVtC9LXvR9d/6jtl2+KWA/F48XbJxS2SE23IkS0wnl8sriOpKScjFOdAjc+mFAEufPYVZAicEKSPWA0H0Lnx/a1K8UZQ5Y9jiogzF+xsJMPUknBjZGD4nkNzKB8= Received: from MN2PR11MB4448.namprd11.prod.outlook.com (52.135.39.157) by MN2PR11MB4190.namprd11.prod.outlook.com (20.179.151.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Thu, 23 Jan 2020 14:03:16 +0000 Received: from MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb]) by MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb%5]) with mapi id 15.20.2644.027; Thu, 23 Jan 2020 14:03:15 +0000 From: To: , , CC: , , Subject: [PATCH 09/10] dmaengine: at_xdmac: GFP_KERNEL for user that can sleep Thread-Topic: [PATCH 09/10] dmaengine: at_xdmac: GFP_KERNEL for user that can sleep Thread-Index: AQHV0fXb6oX41SDlz0uQvKasDWkPiw== Date: Thu, 23 Jan 2020 14:03:15 +0000 Message-ID: <20200123140237.125799-9-tudor.ambarus@microchip.com> References: <20200123140237.125799-1-tudor.ambarus@microchip.com> In-Reply-To: <20200123140237.125799-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 43bf081e-0578-4737-4cdc-08d7a00cfe10 x-ms-traffictypediagnostic: MN2PR11MB4190: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2887; x-forefront-prvs: 029174C036 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(376002)(136003)(346002)(396003)(366004)(199004)(189003)(1076003)(76116006)(91956017)(66446008)(64756008)(66476007)(66946007)(66556008)(6506007)(86362001)(107886003)(2906002)(4744005)(71200400001)(8936002)(4326008)(26005)(54906003)(36756003)(316002)(2616005)(6486002)(110136005)(81156014)(5660300002)(8676002)(6512007)(186003)(478600001)(81166006);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB4190;H:MN2PR11MB4448.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3z3JnumCA/vOJEzeMfsISnS7G5HlE/dslusvOFCB+dgLzDuFvXrP531YW8euqgGyh5faI7GimmgajjorPLVDemVTgsvE+iW5CxBCVRcxgDGWMXISX2+0GVy3Z9yZivgS+BftGolSjqV5x9u3iXEUhRL1o1HoHtAON7ZbmAK8lkOujtWH4833oRIRMswNergKLaP7ItkAVMfcGwyvwDqdLYeSPjLRoffZdGijU5vOgctJObR394ESTrrYZAyg6e1356FhAhH63Xmx3f1OF23qw8VqJsX5f56seZ5Jvghjw120N1Ejf0x6dSD8JqOFdjuf2BcT3ERzXTxMFHefYEOsMYQhAjKP/J8oRZ8X63WI4phXS2JyDZ0gsGGXl3LSFS7IIK/a0WMbUJDSJsQc26zFD1ho+/ZLgea8vRibh4t6vf5EpWUWVFLv/KjEwt0XdFsi MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 43bf081e-0578-4737-4cdc-08d7a00cfe10 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jan 2020 14:03:15.7927 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: PWblHOOrCS73IwKt/1zN/pfyVyPBdAClCpy1+IFJ7s7I3SCl6wQtrUScnbuVVy/Stm4Nb8ja0W8akkjhYySFybxSt8oS++wp3UKQ4ncjwzg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4190 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org From: Tudor Ambarus device_alloc_chan_resources can sleep, use GFP_KERNEL flag. Signed-off-by: Tudor Ambarus --- drivers/dma/at_xdmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index 8fb01bc90ba7..31321da69ae6 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -1834,7 +1834,7 @@ static int at_xdmac_alloc_chan_resources(struct dma_chan *chan) } for (i = 0; i < init_nr_desc_per_channel; i++) { - desc = at_xdmac_alloc_desc(chan, GFP_ATOMIC); + desc = at_xdmac_alloc_desc(chan, GFP_KERNEL); if (!desc) { dev_warn(chan2dev(chan), "only %d descriptors have been allocated\n", i); From patchwork Thu Jan 23 14:03:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 11348181 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 763F5139A for ; Thu, 23 Jan 2020 14:03:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 40A322467B for ; Thu, 23 Jan 2020 14:03:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=microchiptechnology.onmicrosoft.com header.i=@microchiptechnology.onmicrosoft.com header.b="hVcEXG3R" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728057AbgAWODc (ORCPT ); Thu, 23 Jan 2020 09:03:32 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:5788 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729191AbgAWODX (ORCPT ); Thu, 23 Jan 2020 09:03:23 -0500 Received-SPF: Pass (esa2.microchip.iphmx.com: domain of Tudor.Ambarus@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="Tudor.Ambarus@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa2.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa2.microchip.iphmx.com; envelope-from="Tudor.Ambarus@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa2.microchip.iphmx.com; spf=Pass smtp.mailfrom=Tudor.Ambarus@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dkim=pass (signature verified) header.i=@microchiptechnology.onmicrosoft.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: +SuwJ2geEPTUVyfVVC8KY4h+0BM5fjoSWH97sqqwARGIna/CVqhpIyTOPqEzBc6KaAOsZjo6M7 1+SIY851hqSZ3n77C/6a6jNwppuNvbBF2P0cYGAoE14DMg8AyLv4vEPXDoGjVwPrvIlMdfN/OR mTuKFSKvpqaxrIM3EAe7tTLVJofjUBmGX4igsFnWxnNiD1vf1oKeSJvXcbmKsoCUy3Ydf8QwK0 5cC7lTkeHK/kjOP6UFY/McPgGnIakW4ZwQYbo2b7ykt2yiU+R55vIjnZzZ05ypTbG3tHVLKNst HIs= X-IronPort-AV: E=Sophos;i="5.70,354,1574146800"; d="scan'208";a="63527843" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Jan 2020 07:03:21 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 23 Jan 2020 07:03:18 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 23 Jan 2020 07:03:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QcRqky0Ij3bxRq1bHLtDWTek7+zS3q8Yvq21pbK4QSLnPkDbyZIqpGGbVJlPfRGMJSV+Ng+BMH0eN4hJomvh8l+t/N7/8LIsr/9k4w+r6aZlHoPQJlEWvIIR0uXTcYoDvrWLRDJWVCz+vrSOAYjJFnIiX0C1jHb89zYkVsRnGkNoQkXbRYEbv1sUI/WDncT7Z4Bg8fgCy2uUI+jZVwG+K5ExKsw2lgF6bic+fywpkkY7hJUYUVtj5wY4UTdM4Gu/aB/QUTYRKhsW+jFeAk3bpTwjLbrztuqodOi2N/ycPbhHDRRBdGVoSGwtXAIuC9oLNk5vAyS6lA3gAS/uFyWb2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u1+h7dVbV6KuHmrHlLYHbEDUOaXx+4BA6QBHOz5of6s=; b=P/6+bM1URAguUfpbHg63FXUbQ3Y9EJUe5uwPLTduIymWkRfVCqwdQAjkmdb6OoYEv1iXVdMjzafE21NpGYY8PwJ3t1mRkT0yQ4m/65DDCdWvmFaX0rRlrYvY4vpL4Zh4pT1sq1ja49c9OW1rVg7TrIstIZzOmD8W55Jk9MIS0gtwo6ibUolRY2YiEdl7exQg2jMJDe74m5wVjOFfIkSQPmOQ3kUfioQcT4Ih/rYLHjHlUHKV4iz91ERxB47vScZb9Y4MywgK/2Z/kXO38c7wiG0poc2cI29BDTAv/jDk9qQrdAIG5wVhIYwVt3zPwTvYk06MCmY3GzaeMDGW5sSBWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u1+h7dVbV6KuHmrHlLYHbEDUOaXx+4BA6QBHOz5of6s=; b=hVcEXG3R7nbEY+eMYflWKeOUcyKhdgFsIJ2zG9ktn+wdxbYedB0y0mpBT/Hgogb8BNIVNX440aJKU8z3ld9z/owsHwoQ+v1AzxS+88dziNz0zsP9Dr/oTamUmmAtjZpVkOXwokbtVyl48kup4RtoizHs4VuA9efVPfpu7pEU3Ss= Received: from MN2PR11MB4448.namprd11.prod.outlook.com (52.135.39.157) by MN2PR11MB3582.namprd11.prod.outlook.com (20.178.251.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Thu, 23 Jan 2020 14:03:17 +0000 Received: from MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb]) by MN2PR11MB4448.namprd11.prod.outlook.com ([fe80::3c8f:7a55:cbd:adfb%5]) with mapi id 15.20.2644.027; Thu, 23 Jan 2020 14:03:17 +0000 From: To: , , CC: , , Subject: [PATCH 10/10] dmaengine: at_xdmac: Fix locking in tasklet Thread-Topic: [PATCH 10/10] dmaengine: at_xdmac: Fix locking in tasklet Thread-Index: AQHV0fXcFbXcnKYrSE6o/6h9ErutqQ== Date: Thu, 23 Jan 2020 14:03:17 +0000 Message-ID: <20200123140237.125799-10-tudor.ambarus@microchip.com> References: <20200123140237.125799-1-tudor.ambarus@microchip.com> In-Reply-To: <20200123140237.125799-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [94.177.32.156] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 87a3c654-dff5-46b4-a5ea-08d7a00cff19 x-ms-traffictypediagnostic: MN2PR11MB3582: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3044; x-forefront-prvs: 029174C036 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(346002)(396003)(366004)(39860400002)(136003)(189003)(199004)(2616005)(6486002)(316002)(26005)(36756003)(4326008)(81156014)(186003)(54906003)(110136005)(81166006)(6512007)(5660300002)(478600001)(8676002)(66946007)(64756008)(66476007)(76116006)(91956017)(66446008)(66556008)(1076003)(2906002)(6506007)(107886003)(8936002)(71200400001)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB3582;H:MN2PR11MB4448.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0MeQXV5t/KeNsFuI0nFbSadcwVttu+dleXDuGvlBLdr5hvurQ4Rg6PHpaBUW4XdGi/NVpnzknSYP8XrwO0yIseGXp2+jiKEZvrxcI9NPBIbdGhl9//sHDO7GwZ2onS3RJfp0whxX0H5/PJj2Ks6aWfMKzmHvTJj8kbbK/I6N22cdTyNYpRqWIzMni8YOoRvP9pDXuYtb/wdV+ByB1wS+zrd3/VoFE3hzhXmS1tJ3APQ5D+M/ELK1Bdw5qcjFlZTDX21LuXN7nLHMtIalOTUgk5D+8YDCPAhOScMBO+TFNAIF+wr2m5lKtfxco3Tt84kK5wNYQdEZOt+XOCSYlBhk5PcHOMuvVplkrW1b6gkbQ6BEL6s35zdeKg8Ek0FktJ+nsE+FVCeTM39GkfOzkrrTZcuuaAwUhGpByRNpR/1kmAgYnC5m+vM14YRxuRbTysTL MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 87a3c654-dff5-46b4-a5ea-08d7a00cff19 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jan 2020 14:03:17.4638 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: gDbFX3kxyhUtvGuA8qjKOsg86eD7lar57HuUi4TZd464wildMXcfUm/68Z3itpKUB0c1GfMOie0U88zuxLL5f7ACnmTHPvvAQk8/eO4b9w0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3582 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org From: Tudor Ambarus Tasklets run with all the interrupts enabled. This means that we should replace all the (already present) spin_lock_irqsave() uses in the tasklet with spin_lock_irq() to protect being interrupted by a IRQ which tries to get the same lock (via calls to device_prep_dma_* for example). spin_lock and spin_lock_bh in tasklets are not enough to protect from IRQs, update these to spin_lock_irq(). at_xdmac_advance_work() can be called with all the interrupts enabled (when called from tasklet), or with interrupts disabled (when called from at_xdmac_issue_pending). Move the locking in the callers to be able to use spin_lock_irq() and spin_lock_irqsave() for these cases. Signed-off-by: Tudor Ambarus --- drivers/dma/at_xdmac.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index 31321da69ae6..bb0eaf38b594 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -1543,9 +1543,6 @@ static void at_xdmac_remove_xfer(struct at_xdmac_chan *atchan, static void at_xdmac_advance_work(struct at_xdmac_chan *atchan) { struct at_xdmac_desc *desc; - unsigned long flags; - - spin_lock_irqsave(&atchan->lock, flags); /* * If channel is enabled, do nothing, advance_work will be triggered @@ -1559,8 +1556,6 @@ static void at_xdmac_advance_work(struct at_xdmac_chan *atchan) if (!desc->active_xfer) at_xdmac_start_xfer(atchan, desc); } - - spin_unlock_irqrestore(&atchan->lock, flags); } static void at_xdmac_handle_cyclic(struct at_xdmac_chan *atchan) @@ -1596,7 +1591,7 @@ static void at_xdmac_handle_error(struct at_xdmac_chan *atchan) if (atchan->irq_status & AT_XDMAC_CIS_ROIS) dev_err(chan2dev(&atchan->chan), "request overflow error!!!"); - spin_lock_bh(&atchan->lock); + spin_lock_irq(&atchan->lock); /* Channel must be disabled first as it's not done automatically */ at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask); @@ -1607,7 +1602,7 @@ static void at_xdmac_handle_error(struct at_xdmac_chan *atchan) struct at_xdmac_desc, xfer_node); - spin_unlock_bh(&atchan->lock); + spin_unlock_irq(&atchan->lock); /* Print bad descriptor's details if needed */ dev_dbg(chan2dev(&atchan->chan), @@ -1640,21 +1635,21 @@ static void at_xdmac_tasklet(unsigned long data) if (atchan->irq_status & error_mask) at_xdmac_handle_error(atchan); - spin_lock(&atchan->lock); + spin_lock_irq(&atchan->lock); desc = list_first_entry(&atchan->xfers_list, struct at_xdmac_desc, xfer_node); dev_vdbg(chan2dev(&atchan->chan), "%s: desc 0x%p\n", __func__, desc); if (!desc->active_xfer) { dev_err(chan2dev(&atchan->chan), "Xfer not active: exiting"); - spin_unlock(&atchan->lock); + spin_unlock_irq(&atchan->lock); return; } txd = &desc->tx_dma_desc; at_xdmac_remove_xfer(atchan, desc); - spin_unlock(&atchan->lock); + spin_unlock_irq(&atchan->lock); dma_cookie_complete(txd); if (txd->flags & DMA_PREP_INTERRUPT) @@ -1662,7 +1657,9 @@ static void at_xdmac_tasklet(unsigned long data) dma_run_dependencies(txd); + spin_lock_irq(&atchan->lock); at_xdmac_advance_work(atchan); + spin_unlock_irq(&atchan->lock); } } @@ -1723,11 +1720,15 @@ static irqreturn_t at_xdmac_interrupt(int irq, void *dev_id) static void at_xdmac_issue_pending(struct dma_chan *chan) { struct at_xdmac_chan *atchan = to_at_xdmac_chan(chan); + unsigned long flags; dev_dbg(chan2dev(&atchan->chan), "%s\n", __func__); - if (!at_xdmac_chan_is_cyclic(atchan)) + if (!at_xdmac_chan_is_cyclic(atchan)) { + spin_lock_irqsave(&atchan->lock, flags); at_xdmac_advance_work(atchan); + spin_unlock_irqrestore(&atchan->lock, flags); + } return; }