From patchwork Mon Feb 18 16:41:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 1044180 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="tFtdgmeS"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4438ly4lw6z9s7h for ; Tue, 19 Feb 2019 03:42:06 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732158AbfBRQmF (ORCPT ); Mon, 18 Feb 2019 11:42:05 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:43394 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389954AbfBRQlv (ORCPT ); Mon, 18 Feb 2019 11:41:51 -0500 Received: by mail-wr1-f67.google.com with SMTP id d17so4678028wre.10 for ; Mon, 18 Feb 2019 08:41:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2P/9cB+jmoaw2Dnwldpp3xOYGEGj2ZimLHwmer8wLno=; b=tFtdgmeSEfLXBWexpF0a6CIK7rP4GudZIGUAUQfj8fAjnob6TRnT3JC2/y5gtm2G+I LMtuM53/fSXzWCsvGNmsbQ0QL7gcJBo39X/3yDASJ0VXRrXWJm0ljiNChoJQf8Nr+DrN 3l6t/rhUBK+8Mr4LZ3N+XlGmaZoo+POS29x5+nxS+h+F3icyw2DPlJvvLglhNXRhMLxI dWd7NpQ18HiA5BYXdEThTIt1T7VqX/QWkbDGL+1X4E16zm5LSP1UJi1oQxQ0qoQmBsg+ wdzRHCcIpgn727AfMOn96jwZuMTy6xBoGn6P9utOWtSHLZfcrWz40fj5CIiymleSHFwe Njsw== 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=2P/9cB+jmoaw2Dnwldpp3xOYGEGj2ZimLHwmer8wLno=; b=E000jgwTPqHGG2SPfmtfCXErWz36I3VkGDclZ6HU4Hm1aRz7gvIG3Kl42679h5f30Q ceqJkVKLnbhVaAuh7ubfB8EvWp8L1Qyn/CVny02WeqEoncuEz9vyKa1O9Y86HvKxgk0Q bFoxqHjJ1nSNYjjlxAI2IdyN8HW3DT6fvbX/Qr5jdm0Au8URsWxcVZSxsjWHPtYAhK/l 6OhXb6Pcn3vMqE5FSvyjtyiP5KYjKYy5PALqdnXLTZLL3ZHsRecpUQ5UY/JQeUfEYqD1 ju7ERVE4yRSQfyqakMJBbpnopJ8V2Qxd0aTMMWLWWnzDwAAyaO59wV5mKdV6AixDMCMR pJtw== X-Gm-Message-State: AHQUAub/EnpEYFZvyjkGBtiyjQvhsZpKN17DCjheqSThFd4E33Gxj4ig Z5o/5SRbFn2bytBMnqaNvNjsbQ== X-Google-Smtp-Source: AHgI3IZe1mt9ICtwOhvEW2P1PyCMYa1bI7fuHIdrkz0ren9l6siNlirhPv5C+T5ov09cQiBI7kIgMA== X-Received: by 2002:adf:fa47:: with SMTP id y7mr17519894wrr.301.1550508109106; Mon, 18 Feb 2019 08:41:49 -0800 (PST) Received: from localhost.localdomain (aputeaux-684-1-7-43.w90-86.abo.wanadoo.fr. [90.86.124.43]) by smtp.gmail.com with ESMTPSA id w10sm6325442wru.5.2019.02.18.08.41.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Feb 2019 08:41:48 -0800 (PST) From: Bartosz Golaszewski To: Linus Walleij , Thomas Gleixner , Marc Zyngier , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?b?w7ZuaWc=?= Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v5 6/7] gpio: mockup: change the signature of unlocked get/set helpers Date: Mon, 18 Feb 2019 17:41:37 +0100 Message-Id: <20190218164138.24921-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218164138.24921-1-brgl@bgdev.pl> References: <20190218164138.24921-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Bartosz Golaszewski The unlocked variants only get called from places where we already have the pointer to the underlying gpio_mockup_chip structure, so take it as parameter instead of struct gpio_chip. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-mockup.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c index 433adb3b4617..c498b0fbbec8 100644 --- a/drivers/gpio/gpio-mockup.c +++ b/drivers/gpio/gpio-mockup.c @@ -83,10 +83,9 @@ static int gpio_mockup_range_ngpio(unsigned int index) return gpio_mockup_ranges[index * 2 + 1]; } -static int __gpio_mockup_get(struct gpio_chip *gc, unsigned int offset) +static int __gpio_mockup_get(struct gpio_mockup_chip *chip, + unsigned int offset) { - struct gpio_mockup_chip *chip = gpiochip_get_data(gc); - return chip->lines[offset].value; } @@ -96,7 +95,7 @@ static int gpio_mockup_get(struct gpio_chip *gc, unsigned int offset) int val; mutex_lock(&chip->lock); - val = __gpio_mockup_get(gc, offset); + val = __gpio_mockup_get(chip, offset); mutex_unlock(&chip->lock); return val; @@ -110,7 +109,7 @@ static int gpio_mockup_get_multiple(struct gpio_chip *gc, mutex_lock(&chip->lock); for_each_set_bit(bit, mask, gc->ngpio) { - val = __gpio_mockup_get(gc, bit); + val = __gpio_mockup_get(chip, bit); __assign_bit(bit, bits, val); } mutex_unlock(&chip->lock); @@ -118,11 +117,9 @@ static int gpio_mockup_get_multiple(struct gpio_chip *gc, return 0; } -static void __gpio_mockup_set(struct gpio_chip *gc, +static void __gpio_mockup_set(struct gpio_mockup_chip *chip, unsigned int offset, int value) { - struct gpio_mockup_chip *chip = gpiochip_get_data(gc); - chip->lines[offset].value = !!value; } @@ -132,7 +129,7 @@ static void gpio_mockup_set(struct gpio_chip *gc, struct gpio_mockup_chip *chip = gpiochip_get_data(gc); mutex_lock(&chip->lock); - __gpio_mockup_set(gc, offset, value); + __gpio_mockup_set(chip, offset, value); mutex_unlock(&chip->lock); } @@ -144,7 +141,7 @@ static void gpio_mockup_set_multiple(struct gpio_chip *gc, mutex_lock(&chip->lock); for_each_set_bit(bit, mask, gc->ngpio) - __gpio_mockup_set(gc, bit, test_bit(bit, bits)); + __gpio_mockup_set(chip, bit, test_bit(bit, bits)); mutex_unlock(&chip->lock); } @@ -155,7 +152,7 @@ static int gpio_mockup_dirout(struct gpio_chip *gc, mutex_lock(&chip->lock); chip->lines[offset].dir = GPIO_MOCKUP_DIR_OUT; - __gpio_mockup_set(gc, offset, value); + __gpio_mockup_set(chip, offset, value); mutex_unlock(&chip->lock); return 0;