Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4410918imu; Tue, 29 Jan 2019 00:46:08 -0800 (PST) X-Google-Smtp-Source: ALg8bN4vt2g74+AwMCdX7gNi79nZudlvG4NsrYOuY1HZCYtzblQg1PR63ZzoZaFkGCqU5WuBN27n X-Received: by 2002:a63:3c58:: with SMTP id i24mr23220409pgn.284.1548751568540; Tue, 29 Jan 2019 00:46:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548751568; cv=none; d=google.com; s=arc-20160816; b=0mN5SKmsBIzvjCqnXBvgqD19Uaf+ObP+9VVwXZwvhG/0OD8DkPir34aDNsFv+k/L// hR8gJ0gNH6OJ0XerbuAK5gLb+S/F6FxZeBt2vE6t2DeSepwUgbuJq/LLxjxelpkIWWQX e/uKcGf9mm2PvEAuAWljRTXgcjDKhyNtAdkYhj18Z8f+ApviSfm8U98zm7+dchlvC5WC mfwuSd7SbKXUrpsFGmzlqNo8dWoFTpGQe2r1OQz5vzp0YC4/6oBYu7YJhbMhrT4ClPG1 +LmV0tilj0xYihkmPTph2uywWGIA6Mmx/HUqqikXD0PBoQzvxeMxlCjaudwSuXT6Ft94 e2vw== 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=758F2G6mHwZtHqDlM/wuN9QC0Q3bwGTIieLyA4J0jgo=; b=rbz27E0MkvSSfGTUCw5uThnmJgEUtdDQ9VG7ilwcE6XyrwwVJ7whmv92g+hmnZJ5qc f6t9x4bsy/7Ufb8LUhD/h+LQ9OJVjDfiNt8gof3iEW0jEefglX5lnLBCoBTgJ1ZPQ353 fFTvi1t2Lfk6sCwW3wi/Aw5ZKJ2gu8ZaP98Fssoam03snHFW6YSzLyWG3YwdcuNSd5dv r6Irj2lXdNIHEtDGSiP+yE7Ks6h7HuXPtvtzDAhXoVxvF+FWaGrTct65ADYRJ0LS7Ab0 khTd0gVOlvd+sSFXGCNSygy/Le86V9c/fEDogIem8hDTcyaMAf/xGsSn4Q9dP6tXkYL2 bySA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=lyKX9xki; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11si34117345plk.191.2019.01.29.00.45.53; Tue, 29 Jan 2019 00:46:08 -0800 (PST) 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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=lyKX9xki; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728032AbfA2Iob (ORCPT + 99 others); Tue, 29 Jan 2019 03:44:31 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:36211 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727998AbfA2Io3 (ORCPT ); Tue, 29 Jan 2019 03:44:29 -0500 Received: by mail-wm1-f65.google.com with SMTP id p6so16715376wmc.1 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=STrDAHXsdMLitmZ127EwRDfqVvrnU0nXCaoPz8WrSA1pVInpoum34oc7dvoltY2p+9 hw71mZl43l5hcdDqsHkI4g4PfHXfOS9gWe5DIsCQjfJZkqt+Z2yUhwXISS0QlDEj5gp4 4t5UpwmKfJGq2k4CCzDtkAwFGMS62iIj0HgyTDjXLuCMFwbnOqV+AGaYLjixw4NrWNYU +QmMlCgv50cOe1teEG3azwdjMLs6SFKbMea8hmdJbnKEDc+jTGwy1LpFcDXuVZeVxB3t NKHoo50wpCUTVMx/tgTk/LsJxR+KBUOdPHz+BIF3/ieSLEhggBD/98ktE+QsKHqzI4/h E6tw== X-Gm-Message-State: AJcUuke2Q/ZPReN6+6C1+uo+AhU8DySsqmbeVj/JJKZiNk7F9jM8K2SW 5ZpmBkzSn4hmo5ugbvHE7qkGbg== 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=20Kleine-K=C3=B6nig?= 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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; -- 2.19.1