From patchwork Sun Sep 3 14:57:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 111519 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp454073qge; Sun, 3 Sep 2017 07:58:03 -0700 (PDT) X-Google-Smtp-Source: ADKCNb4m1T4vEJ1HAjCCm815R8Lfw9KRvCIAlVgUyy6Xz/q/q9qAokLZccGzxjR0VfEch8LLAKv9 X-Received: by 10.84.225.5 with SMTP id t5mr8213171plj.333.1504450683557; Sun, 03 Sep 2017 07:58:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504450683; cv=none; d=google.com; s=arc-20160816; b=v9Dg07yTZaSa4Oo/j48ejv7ha6XGE7oAohx2MUp1WKpdSHfUkFanFJ4d1hPeK0E5AS i/rhOC4r1ZNG6NxOGz+C2zaa2MO9n/9ZggfGV40SCsknzJI/DJq6bxcIL4ZAwDM6nj3t qRmKwZH1OXaa/YDPjDgEsJkLOuhSmuyi8HTehVCnHx4WbLCKck4xQC0HwgJP0CX4cuTp 5s00364GvpjQ9vQanHzQZFHBXxtwT+MoqTpSHt/npeFE7qbLjSlDv/4US6DfOHSA2sA2 M0GCpMbPiOVg8WEJPdR7Qqqi3JARTUoj3WxcqQaeJrA+tLd734fZZSZM4EombTUWWZY9 np6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=vr0O0X1ppuf7Ox72JxDd97Kmq4myzJbIb1/QbStSqYg=; b=ILlRLXWNqvIBTMWDZljcCaKBkCHRa62pb422ncixL02d/U+M/Sp95jmDVrmC3Ro9Iq p4wNm5YwgFAxtUiMWRTW1qiUfn+fiFxRiWE+bqK1eEokEyNUD/043yeC4a/u0Zq4ezxu 7RsTSna86oTMKAxc1rn8hDcf8uQGVNfiNAcY5jGKteV70+fAwUHlpbgXQng8A3Fhy6g4 ZPfOdaEL9BoSTllIfK76fhZYN3depNY8ZlN864rl0FUL94mYBlD/ZZOGpTsZklpS9IeN xS/za0/UKrdJ/HFwBN4/0jbIAzfNpDzZu1jHpyPpWqOAvu4usX/1AsjI6bkMkZE39/4T 9n+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e68si3397070pfb.300.2017.09.03.07.58.03; Sun, 03 Sep 2017 07:58:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753165AbdICO55 (ORCPT + 26 others); Sun, 3 Sep 2017 10:57:57 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50852 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753142AbdICO5y (ORCPT ); Sun, 3 Sep 2017 10:57:54 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5EFD680D; Sun, 3 Sep 2017 07:57:54 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 02AF93F3E1; Sun, 3 Sep 2017 07:57:51 -0700 (PDT) From: Gilad Ben-Yossef To: Greg Kroah-Hartman , linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Cc: Ofir Drang , Suniel Mahesh Subject: [PATCH v2 1/8] staging: ccree: Replace kzalloc with devm_kzalloc Date: Sun, 3 Sep 2017 17:57:36 +0300 Message-Id: <1504450664-28252-2-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1504450664-28252-1-git-send-email-gilad@benyossef.com> References: <1504450664-28252-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suniel Mahesh It is recommended to use managed function devm_kzalloc, which simplifies driver cleanup paths and driver code. This patch does the following: (a) replace kzalloc with devm_kzalloc. (b) drop kfree(), because memory allocated with devm_kzalloc() is automatically freed on driver detach, otherwise it leads to a double free. (c) remove unnecessary blank lines. Signed-off-by: Suniel Mahesh [gby: rebase on top of latest coding style fixes changes] Acked-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_driver.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) -- 2.1.4 diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 9c6f120..47e0880 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -223,14 +223,15 @@ static int init_cc_resources(struct platform_device *plat_dev) struct resource *req_mem_cc_regs = NULL; void __iomem *cc_base = NULL; bool irq_registered = false; - struct ssi_drvdata *new_drvdata = kzalloc(sizeof(*new_drvdata), - GFP_KERNEL); + struct ssi_drvdata *new_drvdata; struct device *dev = &plat_dev->dev; struct device_node *np = dev->of_node; u32 signature_val; int rc = 0; - if (unlikely(!new_drvdata)) { + new_drvdata = devm_kzalloc(&plat_dev->dev, sizeof(*new_drvdata), + GFP_KERNEL); + if (!new_drvdata) { SSI_LOG_ERR("Failed to allocate drvdata"); rc = -ENOMEM; goto init_cc_res_err; @@ -435,10 +436,8 @@ static int init_cc_resources(struct platform_device *plat_dev) resource_size(new_drvdata->res_mem)); new_drvdata->res_mem = NULL; } - kfree(new_drvdata); dev_set_drvdata(&plat_dev->dev, NULL); } - return rc; } @@ -479,8 +478,6 @@ static void cleanup_cc_resources(struct platform_device *plat_dev) drvdata->cc_base = NULL; drvdata->res_mem = NULL; } - - kfree(drvdata); dev_set_drvdata(&plat_dev->dev, NULL); } From patchwork Sun Sep 3 14:57:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 111520 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp454127qge; Sun, 3 Sep 2017 07:58:08 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5L+XraWXuQgNFrqGPWpL8qUUvHsky668K9Q+54GaAf8auIKgdrhz2Ob3OoJgJvYZzZI+tB X-Received: by 10.84.215.204 with SMTP id g12mr8401285plj.145.1504450687923; Sun, 03 Sep 2017 07:58:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504450687; cv=none; d=google.com; s=arc-20160816; b=XKYBcrghzd+emQwZ4if3TwmLAhJURJaKoEh67Oxy0j2K9KXHL5m2DFeuEimi67Q92b mDKjl2vKexzEfg/Nql7cGuG0rH+Sard3VQ1E7RProKH+Av/p52ptslIM1j+llW9Mb95z Lcnx2W/op5kCQ1uxvdT7DFjyP4dvsOgVyn1V1d6aRSgcjZjDkQXXsWrToKdYkPXPjqpX FCkC28kfZhFSMHtWIonMG2PhvCDkwQvuAGNMqcw3VSCKK5ZyJ2oiQcD8xN9sQFqnOviU slj48Roh//CQ1Xj0qLz4gEZKj3Zh3wnNYFYGzHf/RWmf2KnkIUjCN4lb3Lc0Kei9Wjto WHvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=WBFc9mldpDmCJp7r59odRl1RR1IG/4YwI1a6Ztw0VmM=; b=HpBDiTcP3ccdi/4/gnSfaZYMtoTj+/hfLJJENqEhBMsJP0dMZi+kujtwbPZQ9MPGZQ tEh/wg5g1a+N2fVbZot43kPUa6xuCETgtNDERc3BflbnGNlkd+SVuDuwDkjtKyHW8iUB EmPpzzvVb4CUik2L2/mdRiIHZNpU8Aw4chrd8kwFvCvmnYRGMQCVhpnphGJt53uh7i4N tpNSt1a+EuukFS0XloSRpQKotNIeEKtSJq88Qm/H6em3N3lj0ui+DYNMWGKXcqEoBTY7 +kJY+QKAsPYEm7pefHggdu1VND3o2PnYrLfGtZSfQK/I6/PFJf8KoMflXUMoB3hZd8NW kFjw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g16si3492219pfd.70.2017.09.03.07.58.07; Sun, 03 Sep 2017 07:58:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753186AbdICO6B (ORCPT + 26 others); Sun, 3 Sep 2017 10:58:01 -0400 Received: from foss.arm.com ([217.140.101.70]:50860 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753063AbdICO56 (ORCPT ); Sun, 3 Sep 2017 10:57:58 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2F48180D; Sun, 3 Sep 2017 07:57:58 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 105E33F3E1; Sun, 3 Sep 2017 07:57:55 -0700 (PDT) From: Gilad Ben-Yossef To: Greg Kroah-Hartman , linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Cc: Ofir Drang , Suniel Mahesh Subject: [PATCH v2 2/8] staging: ccree: Convert to devm_ioremap_resource for map, unmap Date: Sun, 3 Sep 2017 17:57:37 +0300 Message-Id: <1504450664-28252-3-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1504450664-28252-1-git-send-email-gilad@benyossef.com> References: <1504450664-28252-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suniel Mahesh It is recommended to use managed function devm_ioremap_resource(), which simplifies driver cleanup paths and driver code. This patch does the following: (a) replace request_mem_region(), ioremap() and corresponding error handling with devm_ioremap_resource(). (b) remove struct resource pointer(res_mem) in struct ssi_drvdata as it seems redundant, use struct resource pointer which is defined locally and adjust return value of platform_get_resource() accordingly. (c) release_mem_region() and iounmap() are dropped, since devm_ioremap_ resource() releases and unmaps mem region on driver detach. (d) adjust log messages accordingly and remove any blank lines. Signed-off-by: Suniel Mahesh [gby: rebase on top of latest coding style fixes changes] Acked-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_driver.c | 60 ++++++++++---------------------------- drivers/staging/ccree/ssi_driver.h | 1 - 2 files changed, 15 insertions(+), 46 deletions(-) -- 2.1.4 diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 47e0880..cbe9a03 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -246,35 +246,21 @@ static int init_cc_resources(struct platform_device *plat_dev) dev_set_drvdata(&plat_dev->dev, new_drvdata); /* Get device resources */ /* First CC registers space */ - new_drvdata->res_mem = platform_get_resource(plat_dev, IORESOURCE_MEM, 0); - if (unlikely(!new_drvdata->res_mem)) { - SSI_LOG_ERR("Failed getting IO memory resource\n"); - rc = -ENODEV; - goto init_cc_res_err; - } - SSI_LOG_DEBUG("Got MEM resource (%s): start=%pad end=%pad\n", - new_drvdata->res_mem->name, - new_drvdata->res_mem->start, - new_drvdata->res_mem->end); + req_mem_cc_regs = platform_get_resource(plat_dev, IORESOURCE_MEM, 0); /* Map registers space */ - req_mem_cc_regs = request_mem_region(new_drvdata->res_mem->start, resource_size(new_drvdata->res_mem), "arm_cc7x_regs"); - if (unlikely(!req_mem_cc_regs)) { - SSI_LOG_ERR("Couldn't allocate registers memory region at " - "0x%08X\n", (unsigned int)new_drvdata->res_mem->start); - rc = -EBUSY; - goto init_cc_res_err; - } - cc_base = ioremap(new_drvdata->res_mem->start, resource_size(new_drvdata->res_mem)); - if (unlikely(!cc_base)) { - SSI_LOG_ERR("ioremap[CC](0x%08X,0x%08X) failed\n", - (unsigned int)new_drvdata->res_mem->start, - (unsigned int)resource_size(new_drvdata->res_mem)); - rc = -ENOMEM; + new_drvdata->cc_base = devm_ioremap_resource(&plat_dev->dev, + req_mem_cc_regs); + if (IS_ERR(new_drvdata->cc_base)) { + rc = PTR_ERR(new_drvdata->cc_base); goto init_cc_res_err; } - SSI_LOG_DEBUG("CC registers mapped from %pa to 0x%p\n", &new_drvdata->res_mem->start, cc_base); - new_drvdata->cc_base = cc_base; - + SSI_LOG_DEBUG("Got MEM resource (%s): start=%pad end=%pad\n", + req_mem_cc_regs->name, + req_mem_cc_regs->start, + req_mem_cc_regs->end); + SSI_LOG_DEBUG("CC registers mapped from %pa to 0x%p\n", + &req_mem_cc_regs->start, new_drvdata->cc_base); + cc_base = new_drvdata->cc_base; /* Then IRQ */ new_drvdata->res_irq = platform_get_resource(plat_dev, IORESOURCE_IRQ, 0); if (unlikely(!new_drvdata->res_irq)) { @@ -424,17 +410,9 @@ static int init_cc_resources(struct platform_device *plat_dev) #ifdef ENABLE_CC_SYSFS ssi_sysfs_fini(); #endif - - if (req_mem_cc_regs) { - if (irq_registered) { - free_irq(new_drvdata->res_irq->start, new_drvdata); - new_drvdata->res_irq = NULL; - iounmap(cc_base); - new_drvdata->cc_base = NULL; - } - release_mem_region(new_drvdata->res_mem->start, - resource_size(new_drvdata->res_mem)); - new_drvdata->res_mem = NULL; + if (irq_registered) { + free_irq(new_drvdata->res_irq->start, new_drvdata); + new_drvdata->res_irq = NULL; } dev_set_drvdata(&plat_dev->dev, NULL); } @@ -470,14 +448,6 @@ static void cleanup_cc_resources(struct platform_device *plat_dev) cc_clk_off(drvdata); free_irq(drvdata->res_irq->start, drvdata); drvdata->res_irq = NULL; - - if (drvdata->cc_base) { - iounmap(drvdata->cc_base); - release_mem_region(drvdata->res_mem->start, - resource_size(drvdata->res_mem)); - drvdata->cc_base = NULL; - drvdata->res_mem = NULL; - } dev_set_drvdata(&plat_dev->dev, NULL); } diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index b6ad89a..518c0bf 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -128,7 +128,6 @@ struct ssi_crypto_req { * @fw_ver: SeP loaded firmware version */ struct ssi_drvdata { - struct resource *res_mem; struct resource *res_irq; void __iomem *cc_base; unsigned int irq; From patchwork Sun Sep 3 14:57:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 111521 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp454148qge; Sun, 3 Sep 2017 07:58:09 -0700 (PDT) X-Google-Smtp-Source: ADKCNb6f249ORkHEdyYdpGqz4y5NoE9TTuoWQodNzahL03g/mUIzHcf2voyt0vpI0Wpi71aYVys0 X-Received: by 10.84.231.197 with SMTP id g5mr9646721pln.446.1504450689455; Sun, 03 Sep 2017 07:58:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504450689; cv=none; d=google.com; s=arc-20160816; b=WefhfMGA7crZo7zQGCACWSj/d2NC0BxeodpgsiJ3U/vW7qaQfaISr6Yf9N93WCRrQB KfleSBJmlldPNCx1meax6pV1sz8GUWWH60rki931odIT+09dAJOZwQSQ1qdhCRFCCKY2 kG48GGP74xsG1nseqRUUxPa3wMWDXZUgrpp6GytlyluotZO2zj1CAFhgZh6GtQq+MQ6i KMZPxSjT933sPEgmVRdjWUS0w7UEknCW/JFNcb23Lr9h/Fs6WNC5+whkDkMgyYw6sqgA ipE5pkQnwfnsRqVQpiHagsOh2j8SrIxIcsvLJkxqcnOCtZPPJShOuCPf/Qkp6spnOrnT INqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=KRr5Brtbn7+lWxsa1t3z9Rzcq69LpXlVz7xUB2/UEA8=; b=Oi1+0iQfR/2YswjZcfRW47FOlAGSEBoJpa08e0SuKeTUA5mfhqdwms4LZQEeJp/2Yl aoza79LLr06HnIVjEl8Dpv7d5u7tJ3kj4MlRZpW+uEZwDjF/qemzzFWtIaGBLHK491CH pGQynrVh/skE+akk4PXGac4NLRYWdlXAdzmIZcVhbk/V4anvGtOkVy7kzrji00fwfzR9 9DUZH+U4ejYa1sRqgsoyvFK4fst97nqdvLJVNZDTYi/fnEUwpTQcddLffoYhaVIHMhdN A4ZrEMSBZ9xD6UddvQj9zY1BeNWCBJznjcGcof2zm08x7Bxi3BmwkTkxCEUrEuPMOLq6 2IKA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g16si3492219pfd.70.2017.09.03.07.58.09; Sun, 03 Sep 2017 07:58:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753213AbdICO6E (ORCPT + 26 others); Sun, 3 Sep 2017 10:58:04 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50870 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753063AbdICO6C (ORCPT ); Sun, 3 Sep 2017 10:58:02 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DCCFE80D; Sun, 3 Sep 2017 07:58:01 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D55193F3E1; Sun, 3 Sep 2017 07:57:59 -0700 (PDT) From: Gilad Ben-Yossef To: Greg Kroah-Hartman , linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Cc: Ofir Drang , Suniel Mahesh Subject: [PATCH v2 3/8] staging: ccree: Use platform_get_irq and devm_request_irq Date: Sun, 3 Sep 2017 17:57:38 +0300 Message-Id: <1504450664-28252-4-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1504450664-28252-1-git-send-email-gilad@benyossef.com> References: <1504450664-28252-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suniel Mahesh It is recommended to use managed function devm_request_irq(), which simplifies driver cleanup paths and driver code. This patch does the following: (a) replace platform_get_resource(), request_irq() and corresponding error handling with platform_get_irq() and devm_request_irq(). (b) remove struct resource pointer(res_irq) in struct ssi_drvdata as it seems redundant. (c) change type of member irq in struct ssi_drvdata from unsigned int to int, as return type of platform_get_irq is int and can be used in error handling. (d) remove irq_registered variable from driver probe as it seems redundant. (e) free_irq is not required any more, devm_request_irq() free's it on driver detach. (f) adjust log messages accordingly and remove any blank lines. Signed-off-by: Suniel Mahesh Acked-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_driver.c | 30 +++++++++--------------------- drivers/staging/ccree/ssi_driver.h | 3 +-- 2 files changed, 10 insertions(+), 23 deletions(-) -- 2.1.4 diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index cbe9a03..3e7193d 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -222,7 +222,6 @@ static int init_cc_resources(struct platform_device *plat_dev) { struct resource *req_mem_cc_regs = NULL; void __iomem *cc_base = NULL; - bool irq_registered = false; struct ssi_drvdata *new_drvdata; struct device *dev = &plat_dev->dev; struct device_node *np = dev->of_node; @@ -262,26 +261,22 @@ static int init_cc_resources(struct platform_device *plat_dev) &req_mem_cc_regs->start, new_drvdata->cc_base); cc_base = new_drvdata->cc_base; /* Then IRQ */ - new_drvdata->res_irq = platform_get_resource(plat_dev, IORESOURCE_IRQ, 0); - if (unlikely(!new_drvdata->res_irq)) { + new_drvdata->irq = platform_get_irq(plat_dev, 0); + if (new_drvdata->irq < 0) { SSI_LOG_ERR("Failed getting IRQ resource\n"); - rc = -ENODEV; + rc = new_drvdata->irq; goto init_cc_res_err; } - rc = request_irq(new_drvdata->res_irq->start, cc_isr, - IRQF_SHARED, "arm_cc7x", new_drvdata); - if (unlikely(rc != 0)) { - SSI_LOG_ERR("Could not register to interrupt %llu\n", - (unsigned long long)new_drvdata->res_irq->start); + rc = devm_request_irq(&plat_dev->dev, new_drvdata->irq, cc_isr, + IRQF_SHARED, "arm_cc7x", new_drvdata); + if (rc) { + SSI_LOG_ERR("Could not register to interrupt %d\n", + new_drvdata->irq); goto init_cc_res_err; } init_completion(&new_drvdata->icache_setup_completion); - irq_registered = true; - SSI_LOG_DEBUG("Registered to IRQ (%s) %llu\n", - new_drvdata->res_irq->name, - (unsigned long long)new_drvdata->res_irq->start); - + SSI_LOG_DEBUG("Registered to IRQ: %d\n", new_drvdata->irq); new_drvdata->plat_dev = plat_dev; rc = cc_clk_on(new_drvdata); @@ -410,10 +405,6 @@ static int init_cc_resources(struct platform_device *plat_dev) #ifdef ENABLE_CC_SYSFS ssi_sysfs_fini(); #endif - if (irq_registered) { - free_irq(new_drvdata->res_irq->start, new_drvdata); - new_drvdata->res_irq = NULL; - } dev_set_drvdata(&plat_dev->dev, NULL); } return rc; @@ -443,11 +434,8 @@ static void cleanup_cc_resources(struct platform_device *plat_dev) #ifdef ENABLE_CC_SYSFS ssi_sysfs_fini(); #endif - fini_cc_regs(drvdata); cc_clk_off(drvdata); - free_irq(drvdata->res_irq->start, drvdata); - drvdata->res_irq = NULL; dev_set_drvdata(&plat_dev->dev, NULL); } diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index 518c0bf..88ef370 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -128,9 +128,8 @@ struct ssi_crypto_req { * @fw_ver: SeP loaded firmware version */ struct ssi_drvdata { - struct resource *res_irq; void __iomem *cc_base; - unsigned int irq; + int irq; u32 irq_mask; u32 fw_ver; /* Calibration time of start/stop From patchwork Sun Sep 3 14:57:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 111523 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp454274qge; Sun, 3 Sep 2017 07:58:18 -0700 (PDT) X-Google-Smtp-Source: ADKCNb7TGvKB1pRLzWiH4G9rS31SRqmcGxnm2X2b46gywYMN3f3dil64aLe9I/y7AIlomsahkMNz X-Received: by 10.98.43.78 with SMTP id r75mr8494572pfr.255.1504450697908; Sun, 03 Sep 2017 07:58:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504450697; cv=none; d=google.com; s=arc-20160816; b=d9JGMPbizz8XQWC2956NQa0wa8cND7p19DB0eSf22+aK2bo/lHQsW80fDFDhGdfyvC EMSO3WBGVnxWAwaqtd11JWYTDj8N576DsiKVGRgT7YxfMgV9iZrNiP5QRrAofd3kIIV5 tj32v5D2mcTkMr09MXOz3fpD4Gt6oX4A3BdX+XEG01a2CPYA6W1LrGX9HbeYKNtUE9Mv T76srZw0TtOSIBStrgCQR1Jiyp9dNkj2AFOBodrnQXH8OI6pg16OVNhcohn3m4jjg1N5 V5CHVqzbcDjcZf07aZ+i7aKY17UQ+zG5JT7G+7kKh52c43XjwR+D4TbDw4kv3GT/8O+I EbFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=cltr8pjqX4JQrNKKm4tUqzDLMeEjwcUbneo+qt0i6pw=; b=IUY6tdFMhiOLvAJqCnO9u44l55Nwa/RmzQfSW3VTfXbxOPxqbuU6oMxMTRV2M33Tim Q1uPjP+p4fBrTyA+u7EOdQPo7oAi7s0bTsU+sCPmor6JG+oKu1Bvd1919ZZX++X7MVgH liO2ekLW7GX+xq9IC0JFswh12/VJ3BfQj47qoWSW7186Fj6owjtZn0p4pswWB94H2kTc vVq1ziEj+c+WeiaEBnbSbCe92JfOce8a23rjQUOR2cDooo9R0AjGWi+qsRPwgp8J2n4v QYAaIyz6tzoU++BTZ6GKfLU6oRV5rdSokqZd0J74IxXnNlKwFfCjnTYwj3nX9BZLQK+W RC+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j186si3507923pgc.500.2017.09.03.07.58.17; Sun, 03 Sep 2017 07:58:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753253AbdICO6N (ORCPT + 26 others); Sun, 3 Sep 2017 10:58:13 -0400 Received: from foss.arm.com ([217.140.101.70]:50892 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753232AbdICO6J (ORCPT ); Sun, 3 Sep 2017 10:58:09 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2713A80D; Sun, 3 Sep 2017 07:58:09 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5459D3F3E1; Sun, 3 Sep 2017 07:58:07 -0700 (PDT) From: Gilad Ben-Yossef To: Greg Kroah-Hartman , linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Cc: Ofir Drang Subject: [PATCH v2 5/8] staging: ccree: remove unused completion Date: Sun, 3 Sep 2017 17:57:40 +0300 Message-Id: <1504450664-28252-6-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1504450664-28252-1-git-send-email-gilad@benyossef.com> References: <1504450664-28252-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org icache_setup_completion is no longer used. Remove it. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_driver.c | 2 -- drivers/staging/ccree/ssi_driver.h | 1 - 2 files changed, 3 deletions(-) -- 2.1.4 diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index dc22f13..8f1d7af 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -279,8 +279,6 @@ static int init_cc_resources(struct platform_device *plat_dev) } SSI_LOG_DEBUG("Registered to IRQ: %d\n", new_drvdata->irq); - init_completion(&new_drvdata->icache_setup_completion); - rc = cc_clk_on(new_drvdata); if (rc) goto post_drvdata_err; diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index 88ef370..9b6476d 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -138,7 +138,6 @@ struct ssi_drvdata { u32 monitor_null_cycles; struct platform_device *plat_dev; ssi_sram_addr_t mlli_sram_addr; - struct completion icache_setup_completion; void *buff_mgr_handle; void *hash_handle; void *aead_handle; From patchwork Sun Sep 3 14:57:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 111526 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp454782qge; Sun, 3 Sep 2017 07:58:56 -0700 (PDT) X-Google-Smtp-Source: ADKCNb4K84hSavhoDN12qwXVzD9QpwPXgZXc8vCrUxRj+1XGynb4WtEt6sqS9PNAXvGWwasD8BHF X-Received: by 10.99.186.91 with SMTP id l27mr4631639pgu.426.1504450736008; Sun, 03 Sep 2017 07:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504450735; cv=none; d=google.com; s=arc-20160816; b=xCeeh8RfpUF/EeI6+oZrjbWt5eDa3hOAB6PYTdIFHu06ejaI0FCvym5qFeYt291EYF Pj4UIq9cspH0E3qRVudeVsFo/9zBGk8YTKKqGqTEZ9C9CeW2tm8YLaIUieEIsLuPRyma jt6ov5yGXSJwS3YPvwiCbbvqUkdRPYoHgnIoXU8gUf5IJvEx+Kr8uh/wRdPbZ85Lhrls Rw6hltqDXSytDgDAHEfMow8szRpckigCWoEnO4V98yhN68ZyGq6OsRbwYayAYt0i3Wqq tb3ED3KsKREMg+nPa+YBV1mZvEAQZSe8nlYD9LTD5E3vrVAZt5O0fGWt6ZnbJv36D264 xlBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=fwtsk9ntsL2uaf31Vro4gEycuDzb/TJQ/Epr9eZi83o=; b=EktAq1wTdACkJ78hU0XJBrDmcK8mRDt0Inm8fWh1K4Y3exChrNf4LNWNkBOIvsfyyF ttm4Fh1Imrpymc3igNYf2XIslegvvutmJydmMmm7vtSw9kq/Fy9g1/62IZHatku5ecsK hNo3gngCJEIOF68sAgJJhK37Q2LqfZAER0UTIcfw11UTf8gL3uoHeXWt/9roVSa8r2ye ugufuaM1lsR8sIJ1s5L70Ztp4Dohk8gYqNZxHhvrpQPdYCzDErwljWvOnD0nPsPiZCl5 v/QMLJ44c/4GssNrFLT8ql/qxohcyT+mrKtu2phMfmErvHoq7+oYk+aoprEpTcPlUTfk P/Gg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h4si3755320plk.745.2017.09.03.07.58.55; Sun, 03 Sep 2017 07:58:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753292AbdICO6x (ORCPT + 26 others); Sun, 3 Sep 2017 10:58:53 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50900 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753241AbdICO6N (ORCPT ); Sun, 3 Sep 2017 10:58:13 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E74F480D; Sun, 3 Sep 2017 07:58:12 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C97283F3E1; Sun, 3 Sep 2017 07:58:10 -0700 (PDT) From: Gilad Ben-Yossef To: Greg Kroah-Hartman , linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Cc: Ofir Drang Subject: [PATCH v2 6/8] staging: ccree: move over to BIT macro for bit defines Date: Sun, 3 Sep 2017 17:57:41 +0300 Message-Id: <1504450664-28252-7-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1504450664-28252-1-git-send-email-gilad@benyossef.com> References: <1504450664-28252-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use BIT macro for bit definitions where needed. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_cipher.h | 10 +++++----- drivers/staging/ccree/ssi_driver.c | 3 ++- drivers/staging/ccree/ssi_driver.h | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) -- 2.1.4 diff --git a/drivers/staging/ccree/ssi_cipher.h b/drivers/staging/ccree/ssi_cipher.h index 296b375..c9a83df 100644 --- a/drivers/staging/ccree/ssi_cipher.h +++ b/drivers/staging/ccree/ssi_cipher.h @@ -27,11 +27,11 @@ #include "ssi_buffer_mgr.h" /* Crypto cipher flags */ -#define CC_CRYPTO_CIPHER_KEY_KFDE0 (1 << 0) -#define CC_CRYPTO_CIPHER_KEY_KFDE1 (1 << 1) -#define CC_CRYPTO_CIPHER_KEY_KFDE2 (1 << 2) -#define CC_CRYPTO_CIPHER_KEY_KFDE3 (1 << 3) -#define CC_CRYPTO_CIPHER_DU_SIZE_512B (1 << 4) +#define CC_CRYPTO_CIPHER_KEY_KFDE0 BIT(0) +#define CC_CRYPTO_CIPHER_KEY_KFDE1 BIT(1) +#define CC_CRYPTO_CIPHER_KEY_KFDE2 BIT(2) +#define CC_CRYPTO_CIPHER_KEY_KFDE3 BIT(3) +#define CC_CRYPTO_CIPHER_DU_SIZE_512B BIT(4) #define CC_CRYPTO_CIPHER_KEY_KFDE_MASK (CC_CRYPTO_CIPHER_KEY_KFDE0 | CC_CRYPTO_CIPHER_KEY_KFDE1 | CC_CRYPTO_CIPHER_KEY_KFDE2 | CC_CRYPTO_CIPHER_KEY_KFDE3) diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index 8f1d7af..6d16220 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -185,7 +185,8 @@ int init_cc_regs(struct ssi_drvdata *drvdata, bool is_probe) CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_ICR), val); /* Unmask relevant interrupt cause */ - val = (~(SSI_COMP_IRQ_MASK | SSI_AXI_ERR_IRQ_MASK | SSI_GPR0_IRQ_MASK)); + val = (unsigned int)(~(SSI_COMP_IRQ_MASK | SSI_AXI_ERR_IRQ_MASK | + SSI_GPR0_IRQ_MASK)); CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR), val); #ifdef DX_HOST_IRQ_TIMER_INIT_VAL_REG_OFFSET diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index 9b6476d..06a3c48 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -68,12 +68,12 @@ #define SSI_AXI_IRQ_MASK ((1 << DX_AXIM_CFG_BRESPMASK_BIT_SHIFT) | (1 << DX_AXIM_CFG_RRESPMASK_BIT_SHIFT) | \ (1 << DX_AXIM_CFG_INFLTMASK_BIT_SHIFT) | (1 << DX_AXIM_CFG_COMPMASK_BIT_SHIFT)) -#define SSI_AXI_ERR_IRQ_MASK (1 << DX_HOST_IRR_AXI_ERR_INT_BIT_SHIFT) +#define SSI_AXI_ERR_IRQ_MASK BIT(DX_HOST_IRR_AXI_ERR_INT_BIT_SHIFT) -#define SSI_COMP_IRQ_MASK (1 << DX_HOST_IRR_AXIM_COMP_INT_BIT_SHIFT) +#define SSI_COMP_IRQ_MASK BIT(DX_HOST_IRR_AXIM_COMP_INT_BIT_SHIFT) /* TEE FIPS status interrupt */ -#define SSI_GPR0_IRQ_MASK (1 << DX_HOST_IRR_GPR0_BIT_SHIFT) +#define SSI_GPR0_IRQ_MASK BIT(DX_HOST_IRR_GPR0_BIT_SHIFT) #define SSI_CRA_PRIO 3000 From patchwork Sun Sep 3 14:57:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 111524 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp454343qge; Sun, 3 Sep 2017 07:58:24 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5mLCLzVvkpuJ7qJBW2e5U2WPxIwbmjNo80kDTJARxwcPxDjt8N9kM63DnfbBENsPlqwBz4 X-Received: by 10.84.209.171 with SMTP id y40mr9681278plh.192.1504450704549; Sun, 03 Sep 2017 07:58:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504450704; cv=none; d=google.com; s=arc-20160816; b=DG6ITFbf6Ok9qYWFLhDarOLdG/KrauBxv2mAfFG/YUPKZ3C2M42ndauN3dwPwTbocP fiVNCpJJbcpPrpD22zksDQSPoTMa2LMuF5hoHvzr8T1FNMrQ9gB6UNTzydaBIAde7KBR 9W4ZFcHzEathsL/uBlJAeKDQ7rHyaOyoa3PoQDjr9n/bxIjieADyQ5FufDvLLghcHFT4 dsjtnQKkwa4oK0TNYraDF4c9M1G52uWz8HymESqc1Z7vin4QnVtHd+8Q7Gi56/0dI+OU vMUKt5Ea/trKYv98eVHfqMf0AuqIbh2q5NjOxeAU6H/3NAMyMs49TY523U6epXDiMSRA uhkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=ygVRmwXQzWKb702PQIYi0AFGAis9YqVvuo2lFaJW/Gk=; b=o2s1UEP75mfuL8co2CK7sfCEYRtnQLRrjohx5HSvRN2iob/v6hDpgv4EssMO2jhPeT 2mqudIkmANTWr/s+Zzz+Co7wZ2TKhuLh1dYcYh5VMgafWnxKO4efUVqQ8FFc3RzxIZzY WwOHAu490oH+FIfu0jPHnJXqdKiRyfCy6J8qFX0SQlK3qPcyyxcp6KqBNRLBJEUlTr2e LG0DBI74QSRN8X+BcucMedfj6APp2NXnbq92Y1buCgkDzGjraVcGP1wZbjagdTBDDAo+ YNPc9JePHQE3YzMo0WcoDJUKFl0YI+6VjrKzHfgZXi1LHxCmJbmtmU/Q8CNYFUvAvf5/ Tl2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 16si3445226pfb.116.2017.09.03.07.58.24; Sun, 03 Sep 2017 07:58:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753271AbdICO6W (ORCPT + 26 others); Sun, 3 Sep 2017 10:58:22 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50912 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753254AbdICO6R (ORCPT ); Sun, 3 Sep 2017 10:58:17 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B674680D; Sun, 3 Sep 2017 07:58:16 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 910A53F3E1; Sun, 3 Sep 2017 07:58:14 -0700 (PDT) From: Gilad Ben-Yossef To: Greg Kroah-Hartman , linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Cc: Ofir Drang Subject: [PATCH v2 7/8] staging: ccree: replace noop macro with inline Date: Sun, 3 Sep 2017 17:57:42 +0300 Message-Id: <1504450664-28252-8-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1504450664-28252-1-git-send-email-gilad@benyossef.com> References: <1504450664-28252-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace noop macro with a noop inline function Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_driver.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.1.4 diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index 06a3c48..81ba827 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -187,8 +187,8 @@ struct async_gen_req_ctx { #ifdef DX_DUMP_BYTES void dump_byte_array(const char *name, const u8 *the_array, unsigned long size); #else -#define dump_byte_array(name, array, size) do { \ -} while (0); +static inline void dump_byte_array(const char *name, const u8 *the_array, + unsigned long size) {}; #endif int init_cc_regs(struct ssi_drvdata *drvdata, bool is_probe);