From: =?UTF-8?q?Horia=20Geant=C4=83?= Subject: [RFC 4/7] soc/qman: add helper functions needed by caam/qi driver Date: Fri, 3 Mar 2017 16:52:10 +0200 Message-ID: <1488552733-20806-5-git-send-email-horia.geanta@nxp.com> References: <1488552733-20806-1-git-send-email-horia.geanta@nxp.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Cc: linux-arm-kernel@lists.infradead.org, Claudiu Manoil , Cristian Stoica , Dan Douglass , linux-crypto@vger.kernel.org, Vakul Garg , Alexandru Porosanu To: Herbert Xu , Scott Wood , Roy Pledge Return-path: In-Reply-To: <1488552733-20806-1-git-send-email-horia.geanta@nxp.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org List-Id: linux-crypto.vger.kernel.org QWRkIGhlbHBlciBmdW5jdGlvbnMsIG1hY3JvcywgI2RlZmluZXMgZm9yIGFjY2Vzc2luZyAvIGVu YWJsaW5nCnFtYW4gZnVuY3Rpb25hbGl0eSBmcm9tIGNhYW0vcWkgZHJpdmVyLCBzdWNoIHRoYXQg dGhpcyBkcml2ZXIKaXMgbm90IGF3YXJlIG9mIHRoZSBuZWVkIGZvciBkYXRhIGNvbnZlcnNpb24g dG8gYmlnIGVuZGlhbi4KcW1hbiBpcyB1cGRhdGVkIHRvIHVzZSB0aGVzZSBoZWxwZXJzIGludGVy bmFsbHkuCgpTaWduZWQtb2ZmLWJ5OiBIb3JpYSBHZWFudMSDIDxob3JpYS5nZWFudGFAbnhwLmNv bT4KLS0tCiBkcml2ZXJzL3NvYy9mc2wvcWJtYW4vcW1hbi5jICAgICAgICAgICAgfCAxNiArKysr Ky0tLS0tLQogZHJpdmVycy9zb2MvZnNsL3FibWFuL3FtYW5fdGVzdF9zdGFzaC5jIHwgIDUgKyst LQogaW5jbHVkZS9zb2MvZnNsL3FtYW4uaCAgICAgICA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