From patchwork Mon Aug 6 22:29:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 10558015 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 AE63E13AC for ; Mon, 6 Aug 2018 22:32:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A58128FC1 for ; Mon, 6 Aug 2018 22:32:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D6AE29001; Mon, 6 Aug 2018 22:32:50 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=unavailable 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 392EA28FC1 for ; Mon, 6 Aug 2018 22:32:50 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=1NY4vuPNNs9udc384uzuJWGz3LGb4sLFJ5JETvDEPkY=; b=QZ5aCCpSHDQrYugwWAbKDqttru +xQ+Xm77TQNjTayhR3nPYPB+RgFFQihf1kKaVpl+SIHVxSR9ja4gOtUl4MlYknuV/sot/Oz4L49+D lfACX6OzgeIJh4rsILCgIiAj6kJ1MGc5RNUo3eWiAXnye/m7Ig/nu8TBwjH8EmOU01WR/dKWAM8kg OElmaAWSSl0gscSz41bYI+NTSj1AiRZW4IriQCwRUl2mJRaWBlCWmxdjZH84Z0jtRVfNoblDYNnXN 2DbHUehgU3Y7ccTCiq05GkUgPGt9ajk6sw9AivdRtPIqPQfm9FG2Ap8BFR9KPcdXct4LsMhXxLIqC GJ4Mbq7A==; 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 1fmo3S-00028V-5R; Mon, 06 Aug 2018 22:32:46 +0000 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fmo0a-0005TF-GT; Mon, 06 Aug 2018 22:30:02 +0000 Received: by mail-lf1-x141.google.com with SMTP id f135-v6so10187075lfg.10; Mon, 06 Aug 2018 15:29:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FDaMkIad0o9QzNTv2EARYdjQpGULA5HnpcmySlWm3i8=; b=O2N6qSTD6wcYUO5uf/sAtdsjHk+jMRgROxM64BeLFfqEax+Sd2rSsUJXBLoACFBcfU vpNekW03thHx+TO+4dBbmDjf2ARNzjZJ8OwQ2JmymgK+1PhoIzxi4XFh9k23tXNkeVvg R/uUcHgx02mbIEzP04Oerc0v2PIDWffK6wANRL7q1ngph2ViEoL9LEDoA7W496FeGGWy fDEOFe7qBJJOAxK5zUlkF+1u2agqRzLDQjvJ1yRepsL8yKJFWV99oaF+DF47sTpWYxgX BhOrFttIAwOnfZYjZuWzM/h2xNhw20WJknDy/Yd3cYox7qeKVDQ+D6qNwpfoF+0FY7d4 Dgug== 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; bh=FDaMkIad0o9QzNTv2EARYdjQpGULA5HnpcmySlWm3i8=; b=ABJTfWoyWvSxjaj6VCgZ/tH8WhOPrX0kj3zyPN+Ng7xfajq4NjfK2lz088eZw6OVJi u5FRc4XYEBYh2SDaJ7MOK9eqOjltTn0fSv70YGJ0CFPzkANayqwt6ZbQ/+VoV4yiklmX AOsugpW5W4VMsCdbLJgYoGbDHjhpAlMyAk6JmoclGJMSnjE5nuovB6MaNqgXPMieZvAJ pprzlJEOgGFcgWLrem45yugmTFWzMXOemd3eADqyy0KpxXvKxgbSk5vVhdiGnfMnQegJ ijWerimbHwzYuDso0cTP6BeMYg5kO9WJIy7+kxQjeiMVTrzsWlA0eF5s5YnDBDhPyQbh 2WzA== X-Gm-Message-State: AOUpUlEG77Kzu7V+sAaRfgrHQjIuwR9RPH9aArn2V6Injn/mWlVO/Lum RwrK+yCuLVfuc8wIgllOZ8k= X-Google-Smtp-Source: AAOMgpciX3+0nE/8mArhut1MLp5m3pxfDitwVhtDsHuy0YeZFQlZ9DyC70LgedcTWPE5Cjl89pXqDA== X-Received: by 2002:a19:b24e:: with SMTP id b75-v6mr11741465lff.11.1533594583186; Mon, 06 Aug 2018 15:29:43 -0700 (PDT) Received: from z50.lan (93-181-165-181.internetia.net.pl. [93.181.165.181]) by smtp.gmail.com with ESMTPSA id o4-v6sm2438561ljc.67.2018.08.06.15.29.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Aug 2018 15:29:42 -0700 (PDT) From: Janusz Krzysztofik To: Boris Brezillon , Linus Walleij Subject: [RFC PATCH v2 11/12] mtd: rawnand: ams-delta: Use GPIO API bitmap extension Date: Tue, 7 Aug 2018 00:29:17 +0200 Message-Id: <20180806222918.12644-12-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180806222918.12644-1-jmkrzyszt@gmail.com> References: <20180718235710.18242-1-jmkrzyszt@gmail.com> <20180806222918.12644-1-jmkrzyszt@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180806_152949_010493_9D250FA0 X-CRM114-Status: GOOD ( 13.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-omap@vger.kernel.org, Jonathan Corbet , Tony Lindgren , Richard Weinberger , linux-gpio@vger.kernel.org, Aaro Koskinen , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Marek Vasut , Janusz Krzysztofik , linux-mtd@lists.infradead.org, Miquel Raynal , Brian Norris , David Woodhouse , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Try to address the driver performance issues by replacing traditional get/set array function calls with their bitmap based equivalents. As long as fast bitmap processing path is not implemented in the new API extension, performance of the driver remains unchanged. Signed-off-by: Janusz Krzysztofik --- drivers/mtd/nand/raw/ams-delta.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/mtd/nand/raw/ams-delta.c b/drivers/mtd/nand/raw/ams-delta.c index 30c461138195..7b08b2c441d3 100644 --- a/drivers/mtd/nand/raw/ams-delta.c +++ b/drivers/mtd/nand/raw/ams-delta.c @@ -78,15 +78,9 @@ static void ams_delta_write_commit(struct ams_delta_nand *priv) static void ams_delta_write_next_byte(struct ams_delta_nand *priv, u_char byte) { - struct gpio_descs *data_gpiods = priv->data_gpiods; unsigned long bits = byte; - int i, value_array[data_gpiods->ndescs]; - - for (i = 0; i < data_gpiods->ndescs; i++) - value_array[i] = test_bit(i, &bits); - gpiod_set_raw_array_value(data_gpiods->ndescs, data_gpiods->desc, - value_array); + gpiod_set_raw_array_bitmap(priv->data_gpiods, &bits); ams_delta_write_commit(priv); } @@ -106,22 +100,15 @@ static void ams_delta_write_first_byte(struct ams_delta_nand *priv, u_char byte) static u_char ams_delta_read_next_byte(struct ams_delta_nand *priv) { - struct gpio_descs *data_gpiods = priv->data_gpiods; - unsigned long bits = 0; - int i, value_array[data_gpiods->ndescs]; + unsigned long bits; gpiod_set_value(priv->gpiod_nre, 0); ndelay(40); - gpiod_get_raw_array_value(data_gpiods->ndescs, data_gpiods->desc, - value_array); + gpiod_get_raw_array_bitmap(priv->data_gpiods, &bits); gpiod_set_value(priv->gpiod_nre, 1); - for (i = 0; i < data_gpiods->ndescs; i++) - if (value_array[i]) - __set_bit(i, &bits); - return bits; }