From patchwork Tue Jan 29 08:44:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 1032594 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="lyKX9xki"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43pg6c21Cwz9sDr for ; Tue, 29 Jan 2019 19:44:56 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727588AbfA2Iot (ORCPT ); Tue, 29 Jan 2019 03:44:49 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:55710 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727997AbfA2Io3 (ORCPT ); Tue, 29 Jan 2019 03:44:29 -0500 Received: by mail-wm1-f66.google.com with SMTP id y139so16681418wmc.5 for ; Tue, 29 Jan 2019 00:44:28 -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=758F2G6mHwZtHqDlM/wuN9QC0Q3bwGTIieLyA4J0jgo=; b=lyKX9xkiI/Bovn76zRMXJO30jERWYnJHRj1nbY9VwTRItB8f+F68u07LdTNwMtLeX2 X3ooOKBVT/qgY1uoEyFq9QuzXUbdTLSmGzTq9iuIAPpDm1gbtyeqEPmSPHXmsFnpIp1N xGNEM/DsWCvDe/IgcfNV1uMUFj3I4Hp1MGhuKpX3HXfDTAkNfTcdQqP9ncoy7lAJMIp9 2ceyhF7D40/4fyZ8dEB9cEVM1LLmLovFxhQdfOSUIZ1KRzsGxlfB8tWZpIQY9N/LgHY3 tXK23cl3PGGz2+nCGSxpPKr0TMmMj9+F972KnYQBivI4BTUeVVUSFuLkpTQcSwOgKIe4 PSUA== 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=758F2G6mHwZtHqDlM/wuN9QC0Q3bwGTIieLyA4J0jgo=; b=uBUVr782t6fgsZHG06i1YV1zEOIogdx4EbCzkzKNisDgL8lLOSFP4SpHy5d2joZHKm 2Q84afo+0XmI1cw6hAS2OIbq28s986d01REFqRoW4ljDoYRUZtxNWil5QDcp9dH59fzH QN3x0eqBfQilcRlmBTsXf/d2ZuEc8GcAZ6jYU1IW9gRGSYtOZdL3U2RKFSZOuN9VmBqi dm6UgbJgYeJWly+55lHb6wjSQ0MpJwVC5oR/zjpM/WBXZQhFUVdAFsjR1AT0hPk674/y u1SXr0hHdgVuQZxHXBKd9zJ46VQJkdeSb6VKKGMBhQjlsF+gZIX5OWcn/IE1GmG+Xg5F ikxw== X-Gm-Message-State: AJcUukcE1mJzLOIO1ZNRa7ERYVMfr3qcUWimvAnmiMLi2VMcO5cIHrgv GL66dXQEmHlouLlO0qpJvE8Dow== X-Google-Smtp-Source: ALg8bN4m1L7bgNHf5/WqP1XjiyFIzvV2wKp1npYAIqMfzD5zkyUybevb9PiM7ahJVcTc0l2Rt+6KsA== X-Received: by 2002:a1c:b70b:: with SMTP id h11mr21132414wmf.72.1548751467733; Tue, 29 Jan 2019 00:44:27 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id c1sm3979319wmb.14.2019.01.29.00.44.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jan 2019 00:44:27 -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 v2 8/9] gpio: mockup: change the signature of unlocked get/set helpers Date: Tue, 29 Jan 2019 09:44:10 +0100 Message-Id: <20190129084411.30495-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190129084411.30495-1-brgl@bgdev.pl> References: <20190129084411.30495-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;