Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1074907ybp; Wed, 9 Oct 2019 08:28:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxk96JTJZO5/IwvckBxXqZsVhf3M2K9HNiyROyNWiWSSjKCy3gbS/M7v/G2CNW2wWSI2Cv/ X-Received: by 2002:a17:906:3010:: with SMTP id 16mr3499243ejz.74.1570634934247; Wed, 09 Oct 2019 08:28:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570634934; cv=none; d=google.com; s=arc-20160816; b=eh/ckb0EGwzcNx9UrZidOWLbXQFdPWNTdPSLYx4H7zssvIB4OHGvctQGMqCX9i2VVw ZtcrRifA4Fpdm5vSP72gSx86safyAIoXDcNNLYFN5jLMny2fwrBs3TE/tq0QWUz0Glc/ 6Q0YLrEXBcDieELSNsic3wiGWSVXmgdWQn5G1tD2FeuiMXvCSRiFkioeNdAGbfScF8X/ /HouxajXRFrVzxfE839Zr9kn+BMTKkdHDFGLXw0iDhiP+DwRSf0gz4VqPgpvZjd3Sfzp 895ILelofGnqJxQ/oPmqi4/T5c1ft12HTIapmauNR67avh42nm51aZdYi6lBynIsDDdA rPFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W+SY6yjQG6ah82xj2QYbshpM9aG1FiA4CAoNvKBotSg=; b=laT2FVbe+Q/CnLO3ZsqdQvlO7c/m3ug6yunZsmLuLFlS6YQgOxZ90oQV6LzKOsePhk FDmj6tSpbYZwMAP0aQkMdftdf0rO3huZE4WNfaXUS1DQgNAeR8oXjrJhBvFZ05f49YLH lqGPd3wFBocWVRN5LOMj1DqAX6YdsiBu8o2CfsTMCw7oVm+HzYoaGBb7Gc1KNuNdfq6L Fke9JNNfErJ5WO616lnC9FkcxN6es//ttvg2XdZwfA0Kdw+7w47WMv02UHRrVC9In8Oz +iRUO+o6Ie51h1zRiFbVnKzfHOxloazNUKIWcfr7n7ZHxMByJtuQUbG2GHNYIyhJZFFI QdIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YytU7O4M; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5si1341899ejp.430.2019.10.09.08.28.31; Wed, 09 Oct 2019 08:28:54 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YytU7O4M; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731801AbfJIP16 (ORCPT + 99 others); Wed, 9 Oct 2019 11:27:58 -0400 Received: from mail-yw1-f68.google.com ([209.85.161.68]:36961 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731785AbfJIP1z (ORCPT ); Wed, 9 Oct 2019 11:27:55 -0400 Received: by mail-yw1-f68.google.com with SMTP id m7so961733ywe.4; Wed, 09 Oct 2019 08:27:54 -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 :mime-version:content-transfer-encoding; bh=W+SY6yjQG6ah82xj2QYbshpM9aG1FiA4CAoNvKBotSg=; b=YytU7O4Mr0gz7kyPQD4eZtBeA5dJSUNfBOhztctdYxmLpl7HVtMLdxEx20d9wYV02I T7NN/5qhMHUYYJfhzJKA3JVtpElQDrumt6yQPI2mja+XbTCSpl2V8kCJ7DXU20Q7S6NJ hIzCoosqtECV+MMvbIyPyjs7dsKOgCuOlwL+wCOInPovvX5/0/A1aQGBI6vGS0FA2Vy2 UcA1uSnuRf7hgNzuaRIpr9Kh9NEIF34qHnRASpyn8OrRGC4EXuEwGBpYr4jB8Vjm9MfE Fg9IIDFjgDMapqezD9Nz+n/lDgAKFhZxNfbRoRZY7miIbYS/CP7zTCTN3gOlk3d53I99 liDg== 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=W+SY6yjQG6ah82xj2QYbshpM9aG1FiA4CAoNvKBotSg=; b=lPgXpUaJ7U+GKlEwajwdAQ2wdwbeXNx6tpMMQvpn4A9s165mRP8cniWSaV/LJ+m2DR xTHXWtf1EZ3s+8Bb9ztXMw3fgGnEMTMZuRe9R4Fy+NItNWPwNuPllPOCwU4+mUtV3e7v Qq3hig4i0bjD6jPQCUyHmd5CRq1ZGv9h5jJrImFgJ6o7Yc5Fxex0IY+HHp2mFee3wK31 XT6aYJjuciY1s34onPjCFU/Jf0BbkUNhOhSMthOiFSIZghku2aZg0anRt/zlOFPpGY+Q tmMCGdGBuyCrHxuAvGQugiXGOJ7TbGXIyfGJfjfv/CE22ON6z9TX5NEPA0dazTQUhtPh oM+w== X-Gm-Message-State: APjAAAWipXBJ+LRM2y6gFQ54BROKHAWWUoQokhKcHAnR9K00nDFU5Fpt zL9X+h43s5yUB4WdQwy8jq4= X-Received: by 2002:a0d:d7c2:: with SMTP id z185mr3088421ywd.156.1570634873928; Wed, 09 Oct 2019 08:27:53 -0700 (PDT) Received: from localhost.localdomain (072-189-084-142.res.spectrum.com. [72.189.84.142]) by smtp.gmail.com with ESMTPSA id g40sm611863ywk.14.2019.10.09.08.27.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 08:27:53 -0700 (PDT) From: William Breathitt Gray To: linus.walleij@linaro.org, bgolaszewski@baylibre.com, akpm@linux-foundation.org Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, andriy.shevchenko@linux.intel.com, linux@rasmusvillemoes.dk, yamada.masahiro@socionext.com, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, geert@linux-m68k.org, preid@electromag.com.au, lukas@wunner.de, sean.nyekjaer@prevas.dk, morten.tiljeset@prevas.dk, William Breathitt Gray Subject: [PATCH v17 12/14] gpio: pisosr: Utilize the for_each_set_clump8 macro Date: Wed, 9 Oct 2019 11:27:10 -0400 Message-Id: <7a6080c8fb003ae0fb6a40da103faeabcadb0204.1570633189.git.vilhelm.gray@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace verbose implementation in get_multiple callback with for_each_set_clump8 macro to simplify code and improve clarity. Cc: Morten Hein Tiljeset Cc: Sean Nyekjaer Signed-off-by: William Breathitt Gray --- drivers/gpio/gpio-pisosr.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpio-pisosr.c b/drivers/gpio/gpio-pisosr.c index f809a5a8e9eb..9ab2c044ef52 100644 --- a/drivers/gpio/gpio-pisosr.c +++ b/drivers/gpio/gpio-pisosr.c @@ -96,16 +96,16 @@ static int pisosr_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask, unsigned long *bits) { struct pisosr_gpio *gpio = gpiochip_get_data(chip); - unsigned int nbytes = DIV_ROUND_UP(chip->ngpio, 8); - unsigned int i, j; + unsigned long offset; + unsigned long gpio_mask; + unsigned long buffer_state; pisosr_gpio_refresh(gpio); bitmap_zero(bits, chip->ngpio); - for (i = 0; i < nbytes; i++) { - j = i / sizeof(unsigned long); - bits[j] |= ((unsigned long) gpio->buffer[i]) - << (8 * (i % sizeof(unsigned long))); + for_each_set_clump8(offset, gpio_mask, mask, chip->ngpio) { + buffer_state = gpio->buffer[offset / 8] & gpio_mask; + bitmap_set_value8(bits, buffer_state, offset); } return 0; -- 2.23.0