From patchwork Thu Apr 11 22:00:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10896969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F16091515 for ; Thu, 11 Apr 2019 22:01:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D500C28E70 for ; Thu, 11 Apr 2019 22:01:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2D5428E64; Thu, 11 Apr 2019 22:01:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 777C928E5A for ; Thu, 11 Apr 2019 22:01:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GZ5gOz2FMm5R2V03Um0bgzamSqA/UiKUKvysGt2zyN8=; b=dbrvSYX/lZ6Bl9 l5WDPyv4q/Z5SdXo9ewB37mm2qI2V4FoSebUzefiNOZPSA7m66dOoGNpQmNtN6U9BTQ+fmsdJ3+fi OuUDa2WSAOCWOH6xjwRAWoun95vl0eqdqzFOfya4T/eMJl24aSMyUvvV3jggiCOqKNTEGeOukt3Ql 4C1FTbikuqkfOPqiaTYxbE6r+Co2re7ffkIGi7j6pGiXBcgLIlSJ8MygRevK+TeXXANkyaHtMTuKR fae16QpERbsalB7OqLeuMV3dgvyShL9lThkpw+c46L+eBa+3SzVysYZRog6+1o5TUDIyVPjiXPTpE vh+G4frHo9QHxpqlx/fQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEhlQ-00046O-Fg; Thu, 11 Apr 2019 22:01:44 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEhl4-0003YI-LN; Thu, 11 Apr 2019 22:01:23 +0000 Received: by mail-wm1-x344.google.com with SMTP id z24so8544701wmi.5; Thu, 11 Apr 2019 15:01:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TOmehU4NtJzE5DRqIgvNN4m9djQewwCjbGHx9sj8Xmc=; b=EtKBSmFxn8M86szFDp2PbLec2TxzAMfeQHUxm3wZnVjMXX/xmjfc9AsnTxnSI635sv x2KtCKSn4xhsZzr/22KpZhAuF5QvZ0xau0T0gg/3QdHUeGJrDpiVKhh/PBnI/mzkxLrf 6m3A05Zsdrfz/3OYHOOBzenDN3vUl6GwnF9jD14dHDwFxMK83w/jxNg0qnV96zbzLD0H inpXP9+62EqOGeMFmgE5T9pHYv9OVYSr2dNS/HrqRyPyuAPbWmF9AgqKeD7hlxeT4g21 3xmxuXekqTmlmPzc3DuJsOt+2qdqoxXD/IxkWvtadKJ3e1Ylk/VSXufySfbDTg7kcLo0 OisA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TOmehU4NtJzE5DRqIgvNN4m9djQewwCjbGHx9sj8Xmc=; b=nvtHThFV5mRnqQGpVVZh+H5i/X779K7reLvlqPu2Fdjj41qkK9iGtglQOpZ/ifCFMi TfOYZKFPMqTGhMdoRoFNfUi0QuRKw7X7jy5BrRPz+RZvtSR66weplAUvM1Lt+sRh9dRN 6TK1CuD3sNqAhqzZkNrkm6GuXnYmzK0sYvrz9cadnZtp/dyqrjnI0gC6/HSvcRzI0HHW FFbzonLr0hy0Mrt8S2zVjS0sEWo8esq5B67mjppZ0hiZXfpga8jByI10IXViRy/pWXKR uV3uUd8Bd6a2ZiDZ3B7dJzdPiGXAP5U+b6MSlErMw8U/ozXBDnKbySemf12pSEpTr+3P 6HAA== X-Gm-Message-State: APjAAAVtYGMvtP7632pRetcswdK462PjJsZb9bBDR80eqyJZRJOytrxl fDo1TJYQIizL1nUpEqR+nx0= X-Google-Smtp-Source: APXvYqyp2y/bXkFnt+6wuuBKNqjX/TVPl3xAEoP0SGsXv8/vf24Zk69nEmrvknj1iULPO1/MVPxdMw== X-Received: by 2002:a1c:5f06:: with SMTP id t6mr8583638wmb.7.1555020081342; Thu, 11 Apr 2019 15:01:21 -0700 (PDT) Received: from blackbox.darklights.net (p200300F133C8AD0009F15067C8D22C31.dip0.t-ipconnect.de. [2003:f1:33c8:ad00:9f1:5067:c8d2:2c31]) by smtp.googlemail.com with ESMTPSA id s189sm13266186wmf.45.2019.04.11.15.01.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Apr 2019 15:01:20 -0700 (PDT) From: Martin Blumenstingl To: liang.yang@amlogic.com, linux-amlogic@lists.infradead.org, linux-mtd@lists.infradead.org, richard@nod.at, miquel.raynal@bootlin.com Subject: [PATCH 1/4] mtd: rawnand: meson: use struct_size macro Date: Fri, 12 Apr 2019 00:00:53 +0200 Message-Id: <20190411220056.19109-2-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190411220056.19109-1-martin.blumenstingl@googlemail.com> References: <20190411220056.19109-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190411_150122_704033_E2E1F9C6 X-CRM114-Status: GOOD ( 11.68 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jianxin.pan@amlogic.com, bbrezillon@kernel.org, Martin Blumenstingl , linux-kernel@vger.kernel.org, marek.vasut@gmail.com, computersforpeace@gmail.com, dwmw2@infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use the recently introduced struct_size macro instead of open-coding it's logic. No functional changes. Signed-off-by: Martin Blumenstingl Tested-by:Liang Yang Acked-by: Liang Yang --- drivers/mtd/nand/raw/meson_nand.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index cb0b03e36a35..c1a6af57dab5 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -1242,8 +1242,7 @@ meson_nfc_nand_chip_init(struct device *dev, return -EINVAL; } - meson_chip = devm_kzalloc(dev, - sizeof(*meson_chip) + (nsels * sizeof(u8)), + meson_chip = devm_kzalloc(dev, struct_size(meson_chip, sels, nsels), GFP_KERNEL); if (!meson_chip) return -ENOMEM; From patchwork Thu Apr 11 22:00:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10896971 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 64A5B139A for ; Thu, 11 Apr 2019 22:01:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45C1628E75 for ; Thu, 11 Apr 2019 22:01:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F4F928E71; Thu, 11 Apr 2019 22:01:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DCF0B28E62 for ; Thu, 11 Apr 2019 22:01:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pIVsB1360LxKlR99SHidWNDEiv3t1vd6/TCKd1ISbrk=; b=kpebSRo3tJ6tXs 8mqDQZA82ue0P5W1k+bmXLfbZHIyap7HoXo2XA+oPZdKTS7mLmt144olsRbp/5a9pVl9WqWO/v32z 7BQ6zjZCzKsydDV/WOlxX5jdtQOYOBkoVR1UT0KLk6aV62Cs80F0bajWzLHcnolmRHbPqCpZ9FNeQ 2BghpKXPVxNONTK2TKxL6qwjByHlJ5lCuJ+yQGKhbvy6tH15wtpnk+F1Mjx7yFx/mUe6n/TDl30PM K8y6Yibhvp+DmTMpKH2ghsk+chWXz1WjgVMRtzH+skKTWHOWQiah+MVcfw8Cfo+exbsLrhPUqjmje bUPsuG5Dy6FZzR8hGY/w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEhlc-0004QG-PY; Thu, 11 Apr 2019 22:01:56 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEhl6-0003Yt-De; Thu, 11 Apr 2019 22:01:26 +0000 Received: by mail-wm1-x342.google.com with SMTP id z11so8680592wmi.0; Thu, 11 Apr 2019 15:01:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TNpnhysGNBYBU9vZbHTKcY8UQNku4HVmL3x6AsvBeB4=; b=Dl+ME5YNZFahF/2igCGYWogD/O/0Gd3bQea5s/0xjbTfm9BIuXFheqWl1O+VWnobKp njy4xCKs88mG2WRT7KBBdmUoiol97+QcOiz/7ocz9pBT4yFKSbMGie8LYSm5mkn5FQ2F j44Phia/Ko+czhZgjQCaCHFQCxx93EyjC9eY8/dXDMGoky5AbMS9zwLrx4Tp4IP1j93f vTPUVfXj7jk8vbvwoNl4TMwUxF2nXalNmz4ogOl/bEESUCKc+SDkQ9QDzM4iBbp1uQZb nLVkQtuZe6MllvRAUKp5OBnAODevz58LqLo86auklRd9M1H7bpjVKCEfRXhnmgPuCXKl PfDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TNpnhysGNBYBU9vZbHTKcY8UQNku4HVmL3x6AsvBeB4=; b=SdPFe4WJbpZpxp2tGFtd4U2xpEYFQLdZFb4/akCK1ZAg6QT89JdqZj6EIhuWYt32fh eZCuu8r+tU8TDNbg+96Ehko1B0LS8RWBEXvC2PJtCEEK+FKRYSF8xAac3c4vSwfGvFhB whCSFYY3p2AnFf2PRy9hg/TJkPKFHRM6LgFsAqPfeQhtb3cTPHqjhs4mmwAx1k8Fj1wh 4/73cR2OrnssMOs76+O/5FDyBG5J24MBf7ddpLBTU56UYJPbzA9UVLB5BQ34CU3cL/+T jy9u7QJLXCFVvsHpCsvpGTwUXbsVJuSSvC44/0iA23JxpboInk4EnCg23lylL1fyWxV9 +eFw== X-Gm-Message-State: APjAAAX76Ft/J2xoGaSmpH078s8UzChrLjNsm6xiFKzNL7GxNMjZR2qJ L4VEyHu7zAjnXM8tyCT5dpw= X-Google-Smtp-Source: APXvYqz35ooInE1ZKyccYGGGO9VGmdSKB2QtHLGDBX83aWFKO0k452TWykwlq54bD8TUpyg33NUcMQ== X-Received: by 2002:a1c:2348:: with SMTP id j69mr7827582wmj.35.1555020082569; Thu, 11 Apr 2019 15:01:22 -0700 (PDT) Received: from blackbox.darklights.net (p200300F133C8AD0009F15067C8D22C31.dip0.t-ipconnect.de. [2003:f1:33c8:ad00:9f1:5067:c8d2:2c31]) by smtp.googlemail.com with ESMTPSA id s189sm13266186wmf.45.2019.04.11.15.01.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Apr 2019 15:01:21 -0700 (PDT) From: Martin Blumenstingl To: liang.yang@amlogic.com, linux-amlogic@lists.infradead.org, linux-mtd@lists.infradead.org, richard@nod.at, miquel.raynal@bootlin.com Subject: [PATCH 2/4] mtd: rawnand: meson: use of_property_count_elems_of_size helper Date: Fri, 12 Apr 2019 00:00:54 +0200 Message-Id: <20190411220056.19109-3-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190411220056.19109-1-martin.blumenstingl@googlemail.com> References: <20190411220056.19109-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190411_150124_610415_FFFDC334 X-CRM114-Status: GOOD ( 10.63 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jianxin.pan@amlogic.com, bbrezillon@kernel.org, Martin Blumenstingl , linux-kernel@vger.kernel.org, marek.vasut@gmail.com, computersforpeace@gmail.com, dwmw2@infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use the of_property_count_elems_of_size() helper instead of open-coding it's logic. As a bonus this will now error out if the "reg" property values use an incorrect size (anything other than sizeof(u32)). Signed-off-by: Martin Blumenstingl Tested-by:Liang Yang Acked-by: Liang Yang --- drivers/mtd/nand/raw/meson_nand.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index c1a6af57dab5..9a6023638101 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -1233,10 +1233,7 @@ meson_nfc_nand_chip_init(struct device *dev, int ret, i; u32 tmp, nsels; - if (!of_get_property(np, "reg", &nsels)) - return -EINVAL; - - nsels /= sizeof(u32); + nsels = of_property_count_elems_of_size(np, "reg", sizeof(u32)); if (!nsels || nsels > MAX_CE_NUM) { dev_err(dev, "invalid register property size\n"); return -EINVAL; From patchwork Thu Apr 11 22:00:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10896977 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 816FB1515 for ; Thu, 11 Apr 2019 22:02:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62B2428E44 for ; Thu, 11 Apr 2019 22:02:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6104128E54; Thu, 11 Apr 2019 22:02:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F3F5028E47 for ; Thu, 11 Apr 2019 22:02:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jWR64mKvI9mmAjb5zL/sYKKlY1T9WnY+YezaUfUZ7Ss=; b=t1NiHDdt/DJNn6 kFARAH9QE5mdW28xzxWi7xDY09be4OJbOd5m6LTGSU+wfX52JI/aOAAFWuXP2nlAOoCG0D8yPYRBP PIALDIF44o3mT7MVC9EcN6HX+9PgCiAfkTtSqCV+mXHWYn5ZHuq8v/biQdb71Noh1/Pdf2emG92nM sGZIqhy62wfszlXuuAXDOQWNViuFYipH+SZW138rjLqNovFjrk5cD3sqJXDrsAknsXTmWlq6LLM7k xVKFvIR7TiqDkFCGzJ9rA2dV38Ccq/f6HFblvtk0cMGKbO7ZJOI22KzeHB6bztBWbffA4sGeoiaUM ElqC0wXaNPjiglbgV6pQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEhm9-00055u-Pl; Thu, 11 Apr 2019 22:02:29 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEhl7-0003ZS-6y; Thu, 11 Apr 2019 22:01:29 +0000 Received: by mail-wm1-x342.google.com with SMTP id c1so8627452wml.4; Thu, 11 Apr 2019 15:01:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ppI9nqpQVIT5EX87CEcKbfdI9W3paDlwzbHWj7vYXTg=; b=K8z/d+aH5mjiptQEK6iIvRF5y6r0lfHtJ2mmS1otxJlDG8x6bxBz44Ahm4f4XQfs1+ cOqQ4+ESVP8nM6T7Wl724gJlOdaAjcOPaOmwPKL89bDgFvb/fka7ZPYKIgOZZe5vhABe ViA/k5YhxEIxOn0Zvwm88Sd2YC95kEMpRw5yOcTuDYt7zWsmMbIv/Q6pCXyUOo1OD61d XGyoSMgiOeNdP5ETplauulOv5IZIIWKVHWKVMABjThJHeukWIgDihy/TgBGDF8frgK2G U7p2RlmMPOerGXwlzEOai+8xI/JbK3EraMbgpSliTd4337GMu36XDqj2Rpk6WlctInq0 zR8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ppI9nqpQVIT5EX87CEcKbfdI9W3paDlwzbHWj7vYXTg=; b=E5Zg5JnKLxMl5qj5kMlsyJIcyXB+PwXj+3SiDWu1RK7wakQBap/bTmuJnWdETi6tfb 0wlOoLDlw4QIeFKU84iKnSZwPJaUzYg+MEUyJ2HNOxlgm/DmKN3Pd/lseKnUwHsfuaVK HfJTqX/p8gaREY8pXhtAoAoOT1HCfeW77gI2wv5W90/0dzHpscw1GgK+WapYLg3NjzSC yxg+eP2fTohDfHH1bpeOTQ1ncx4Qj7pAfonani3bh9ai8E9TRjI4f4DCNr5TUUArYUnG BWxQZtD9HgF2NItg/s5FZQvEjoGUviQ55YSkeut8lPSoftSZ/ccC7E6FjkaNk+t3jmfq 7Y7w== X-Gm-Message-State: APjAAAVUOYvBpPRS87RoQ49X9y48fD/ucFKyaPoMUtHC3NrG5Hn2qi2S GSkepWoXVVty8kzk2/i3E6M= X-Google-Smtp-Source: APXvYqzluhRlLS7+aeGTBMGtndLaXbk7pEcHusdW0T738cU+A7Iw4rH1UIR99+QzGesPhCuXYb/STQ== X-Received: by 2002:a1c:eb18:: with SMTP id j24mr8160946wmh.32.1555020083782; Thu, 11 Apr 2019 15:01:23 -0700 (PDT) Received: from blackbox.darklights.net (p200300F133C8AD0009F15067C8D22C31.dip0.t-ipconnect.de. [2003:f1:33c8:ad00:9f1:5067:c8d2:2c31]) by smtp.googlemail.com with ESMTPSA id s189sm13266186wmf.45.2019.04.11.15.01.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Apr 2019 15:01:23 -0700 (PDT) From: Martin Blumenstingl To: liang.yang@amlogic.com, linux-amlogic@lists.infradead.org, linux-mtd@lists.infradead.org, richard@nod.at, miquel.raynal@bootlin.com Subject: [PATCH 3/4] mtd: rawnand: meson: use a void pointer for meson_nfc_dma_buffer_setup Date: Fri, 12 Apr 2019 00:00:55 +0200 Message-Id: <20190411220056.19109-4-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190411220056.19109-1-martin.blumenstingl@googlemail.com> References: <20190411220056.19109-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190411_150125_421677_EEDF74B6 X-CRM114-Status: GOOD ( 12.78 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jianxin.pan@amlogic.com, bbrezillon@kernel.org, Martin Blumenstingl , linux-kernel@vger.kernel.org, marek.vasut@gmail.com, computersforpeace@gmail.com, dwmw2@infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This simplifies the code because it gets rid of the casts to an u8-pointer when passing "info_buf" from struct meson_nfc_nand_chip. Also it gets rid of the cast of the u8 databuf pointer to a void pointer. The logic inside meson_nfc_dma_buffer_setup() doesn't care about the pointer types themselves because it only passes them to dma_map_single which accepts a void pointer. No functional changes. Signed-off-by: Martin Blumenstingl Tested-by:Liang Yang Acked-by: Liang Yang Tested-by:Liang Yang Acked-by: Liang Yang Tested-by:Liang Yang Acked-by: Liang Yang --- drivers/mtd/nand/raw/meson_nand.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index 9a6023638101..57cc4bd3f665 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -470,15 +470,15 @@ static int meson_nfc_ecc_correct(struct nand_chip *nand, u32 *bitflips, return ret; } -static int meson_nfc_dma_buffer_setup(struct nand_chip *nand, u8 *databuf, - int datalen, u8 *infobuf, int infolen, +static int meson_nfc_dma_buffer_setup(struct nand_chip *nand, void *databuf, + int datalen, void *infobuf, int infolen, enum dma_data_direction dir) { struct meson_nfc *nfc = nand_get_controller_data(nand); u32 cmd; int ret = 0; - nfc->daddr = dma_map_single(nfc->dev, (void *)databuf, datalen, dir); + nfc->daddr = dma_map_single(nfc->dev, databuf, datalen, dir); ret = dma_mapping_error(nfc->dev, nfc->daddr); if (ret) { dev_err(nfc->dev, "DMA mapping error\n"); @@ -645,7 +645,7 @@ static int meson_nfc_write_page_sub(struct nand_chip *nand, return ret; ret = meson_nfc_dma_buffer_setup(nand, meson_chip->data_buf, - data_len, (u8 *)meson_chip->info_buf, + data_len, meson_chip->info_buf, info_len, DMA_TO_DEVICE); if (ret) return ret; @@ -729,7 +729,7 @@ static int meson_nfc_read_page_sub(struct nand_chip *nand, return ret; ret = meson_nfc_dma_buffer_setup(nand, meson_chip->data_buf, - data_len, (u8 *)meson_chip->info_buf, + data_len, meson_chip->info_buf, info_len, DMA_FROM_DEVICE); if (ret) return ret; From patchwork Thu Apr 11 22:00:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10896995 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C0DD139A for ; Thu, 11 Apr 2019 22:07:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03FAB28516 for ; Thu, 11 Apr 2019 22:07:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC4DF28C20; Thu, 11 Apr 2019 22:06:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A1A6F28CBF for ; Thu, 11 Apr 2019 22:06:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=912FabbkW3LcI5k6JzGz8XT+Cyc6FcBHzhvroYEzoAM=; b=Wu510WO/SBRSJz o9QyKuRI0oc1aHhcPTHEgOxM1Fcu2UBftUwxkRdrMOXzW7DzpS1FgY0K9f40KalIaANGV3QlUI+OE UfQUy2AvXehIh9aZ2a6aKHAKT7ryaXhk8NOPEVatIM4tjfa9x+eL+9X1A0N6aqlhqwSNGEvzB/bDR KAf4PxSvPXHzAJUp1RT9yFDN/Mebnu8El4yxOFlj2KCDKzNgMABcsuapGEDVNTRjYhFMW6dCOJJ1Q PaW7zx2SarpVv+LgHkHIPn/Fa26YZbUdX13YTcU/sZ9hX/alGUyojw+bV+gUijw9uHnjcIy8u3ApB os5JVZK0giU7Tt4rmpaw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEhqT-0007pM-BF; Thu, 11 Apr 2019 22:06:57 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEhl8-0003ag-LW; Thu, 11 Apr 2019 22:01:30 +0000 Received: by mail-wm1-x343.google.com with SMTP id v14so8479256wmf.2; Thu, 11 Apr 2019 15:01:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4m105n5JXJH4GNf9WN+soWtXGry/vpyc5a/iSxRDFzw=; b=NzNFKjHb09kbOIHFC41lGJd95srXDx+k6jOgARNJ6GIQ36ROXxomwgG1t5ZZmtnDcq 9x0D4BW/E1st5N+fdpO4q/KshtnUPtQJjHjutgQdFrpX/HAI1lc5Ni4VWJC9Jhnak+9a WLTkCFzeaPFj4djeAlX7H65RWyYR3vJnvlRvlCcEvZ6vxC6XH5Mo7QYJ4PKFAQdOrrZl BH44N+OpoVxPWmBdIAwy0qsgN2oarmGgx7+jb8cJfmn2RlvtqijKBA420rFOYuQ2us0E shLtv0GWTTcOa/xcgDqYvMJ0mH2xgXcuRLkpajKWtvCRPnSPjSLKY+s4lAdDjEeGD7+3 +R2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4m105n5JXJH4GNf9WN+soWtXGry/vpyc5a/iSxRDFzw=; b=rN086315qtYUGIEjh9yNP8rcCf/CinyGPNxVyTbCRcbs32tczxu/XFfe9XGv/11qmR NhjSfKdbYEttExh8F3pKydEqYQD2giiCF4rZ9g5gbIxQU3Bh40zyTgK4bBZNB08NUpjB ZrQeykR99ylchPrfriUxarCwNnU/Z3ghwyfXtSh5V+QcVk58NxR6WsqTUImiUlYml3hi /A/+powfjIFidvVETratIP0zce3XDfd0gYZSW2bMX+HYDoYHmtY8AimyQ/6E7Bkhe2t/ NenqJ5NnDN9pjOwm6XxbEWpvDltMUPoWq+X0p21Rr4HYf7M26woboXKwfIcwpuvXAkw5 jDRw== X-Gm-Message-State: APjAAAUyVM1y7uLnepsoLv1UoG9DAonKWMEufx4RvmCMkuJSLwj/Xwva YU0XGydRS5oWOixwh0A4ISs= X-Google-Smtp-Source: APXvYqwvz5r4sd151G017FJh/Vn+1GDk5EwoOrb7sRHdQs5rc/n1+l76wMQOKuKsn5oRdB6Q4mftzg== X-Received: by 2002:a1c:6783:: with SMTP id b125mr8256171wmc.41.1555020085029; Thu, 11 Apr 2019 15:01:25 -0700 (PDT) Received: from blackbox.darklights.net (p200300F133C8AD0009F15067C8D22C31.dip0.t-ipconnect.de. [2003:f1:33c8:ad00:9f1:5067:c8d2:2c31]) by smtp.googlemail.com with ESMTPSA id s189sm13266186wmf.45.2019.04.11.15.01.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Apr 2019 15:01:24 -0700 (PDT) From: Martin Blumenstingl To: liang.yang@amlogic.com, linux-amlogic@lists.infradead.org, linux-mtd@lists.infradead.org, richard@nod.at, miquel.raynal@bootlin.com Subject: [PATCH 4/4] mtd: rawnand: meson: only initialize the RB completion once Date: Fri, 12 Apr 2019 00:00:56 +0200 Message-Id: <20190411220056.19109-5-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190411220056.19109-1-martin.blumenstingl@googlemail.com> References: <20190411220056.19109-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190411_150127_040761_09A97E74 X-CRM114-Status: GOOD ( 12.30 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jianxin.pan@amlogic.com, bbrezillon@kernel.org, Martin Blumenstingl , linux-kernel@vger.kernel.org, marek.vasut@gmail.com, computersforpeace@gmail.com, dwmw2@infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Documentation/scheduler/completion.txt states: Calling init_completion() on the same completion object twice is most likely a bug as it re-initializes the queue to an empty queue and enqueued tasks could get "lost" - use reinit_completion() in that case, but be aware of other races. Initialize nfc->completion in meson_nfc_probe using init_completion and change the call in meson_nfc_queue_rb to reinit_completion so the logic matches what the documentation suggests. Signed-off-by: Martin Blumenstingl Tested-by:Liang Yang Acked-by: Liang Yang Tested-by:Liang Yang Acked-by: Liang Yang --- drivers/mtd/nand/raw/meson_nand.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index 57cc4bd3f665..ea57ddcec41e 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -400,7 +400,7 @@ static int meson_nfc_queue_rb(struct meson_nfc *nfc, int timeout_ms) cfg |= NFC_RB_IRQ_EN; writel(cfg, nfc->reg_base + NFC_REG_CFG); - init_completion(&nfc->completion); + reinit_completion(&nfc->completion); /* use the max erase time as the maximum clock for waiting R/B */ cmd = NFC_CMD_RB | NFC_CMD_RB_INT @@ -1380,6 +1380,7 @@ static int meson_nfc_probe(struct platform_device *pdev) nand_controller_init(&nfc->controller); INIT_LIST_HEAD(&nfc->chips); + init_completion(&nfc->completion); nfc->dev = dev;