From patchwork Wed Sep 7 13:37:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 75662 Delivered-To: patch@linaro.org Received: by 10.140.106.11 with SMTP id d11csp331030qgf; Wed, 7 Sep 2016 06:38:09 -0700 (PDT) X-Received: by 10.98.53.68 with SMTP id c65mr82387456pfa.66.1473255489314; Wed, 07 Sep 2016 06:38:09 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si3237773pac.259.2016.09.07.06.38.09; Wed, 07 Sep 2016 06:38:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757773AbcIGNiF (ORCPT + 4 others); Wed, 7 Sep 2016 09:38:05 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:36135 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757781AbcIGNiD (ORCPT ); Wed, 7 Sep 2016 09:38:03 -0400 Received: by mail-wm0-f48.google.com with SMTP id b187so116472881wme.1 for ; Wed, 07 Sep 2016 06:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fqmemz1Yb4QcULfOY93E+Mwv21rFfJimxVdDtiGWeRg=; b=adm78fIw648kbatyeCdOwkZTZVltB/hm0xfnM9nEBQGpLqEDRvke1/jUiiSt2R5K0O NYUtEIAd+mxlxTPDn6YpXpObl0tJCKtnVukWA6DRNzmmBFnyLT5EdCCDVMLaNUKCfMCe RpK20fk0wpkC+WixeJeAMxEnKcZ9+9LxXBy4NnrBCy0IP6LKh1fySEG8HZNZqxf4f7jP FIuzBZuu4ZTRS/RzTDzFdDZz9S647tvbhhCw1dCEfhLvVVi05SLeH/0b9HlA00fwPMFr 8OjjV4Pk5SzY/jGwM5F7xDCKPEcWPvVMHaQQz3gEqhiVuh0OjtuxmvTLoCoPRvdolNVk RKKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fqmemz1Yb4QcULfOY93E+Mwv21rFfJimxVdDtiGWeRg=; b=Sm/Aal+wC8W+iW6oCJ0O2dYtPi11It7BEww7PxPAgt5zFY2x9EokE+v/QE33JP23TR ZXsZUUxGuoklL5GHEb9pF4larp7P6pZRs+149BngpU2d0zO9+/bHwtt2Nq/GsRxzcVt4 Vd0r8b+zfvQnkf8SnE0Y2WWMRMKKfXK3RdmSHpTPL4OEG7/0M5xE3E+7ggB52zTWu+II zyBIg2bMgG/6pPDETkKAxzxZ7S/+VMEJdGHN+DhBCnEekDH4nDT9cPUb4pbRMFBntlaP jpq8nPbpgllgNz6uJaHcL3sitZQg0JGNf/xdzs2k7btY7GbpkjzIi2hGjU9m6VrVuaHE 3flw== X-Gm-Message-State: AE9vXwOEhtg/y4GWM1cTN2Xv4FIJuGP5URvZ2Dm2cM3dA9CRkRBFTjrzH1kTffPhaWQj5EQm X-Received: by 10.194.65.35 with SMTP id u3mr21046412wjs.189.1473255481995; Wed, 07 Sep 2016 06:38:01 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id 190sm4363889wmk.13.2016.09.07.06.38.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Sep 2016 06:38:01 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij , Alexandre Courbot , Andy Shevchenko , Vignesh R , Yong Li , Geert Uytterhoeven Cc: linux-gpio , LKML , Bartosz Golaszewski Subject: [PATCH v3 5/5] gpio: pca953x: coding style fixes Date: Wed, 7 Sep 2016 15:37:52 +0200 Message-Id: <1473255472-16090-6-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1473255472-16090-1-git-send-email-bgolaszewski@baylibre.com> References: <1473255472-16090-1-git-send-email-bgolaszewski@baylibre.com> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org pca953x_gpio_set_multiple() has some coding style issues that make it harder to read. Tweak the code a bit. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-pca953x.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index b08ed52..bbec5d7 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -360,25 +360,26 @@ exit: } static void pca953x_gpio_set_multiple(struct gpio_chip *gc, - unsigned long *mask, unsigned long *bits) + unsigned long *mask, unsigned long *bits) { struct pca953x_chip *chip = gpiochip_get_data(gc); u8 reg_val[MAX_BANK]; - int ret; + int ret, bank; int bank_shift = fls((chip->gpio_chip.ngpio - 1) / BANK_SZ); - int bank; + unsigned int bankmask, bankval; memcpy(reg_val, chip->reg_output, NBANK(chip)); mutex_lock(&chip->i2c_lock); - for(bank=0; bank> - ((bank % sizeof(*mask)) * 8); - if(bankmask) { - unsigned bankval = bits[bank / sizeof(*bits)] >> - ((bank % sizeof(*bits)) * 8); + for (bank = 0; bank < NBANK(chip); bank++) { + bankmask = mask[bank / sizeof(*mask)] >> + ((bank % sizeof(*mask)) * 8); + if (bankmask) { + bankval = bits[bank / sizeof(*bits)] >> + ((bank % sizeof(*bits)) * 8); reg_val[bank] = (reg_val[bank] & ~bankmask) | bankval; } } + ret = i2c_smbus_write_i2c_block_data(chip->client, chip->offset->output << bank_shift, NBANK(chip), reg_val);