From patchwork Tue Jan 29 08:44:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 1032596 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="Pp5HBo+z"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43pg6d14MRz9sN6 for ; Tue, 29 Jan 2019 19:44:57 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727973AbfA2Io0 (ORCPT ); Tue, 29 Jan 2019 03:44:26 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:36206 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727958AbfA2Io0 (ORCPT ); Tue, 29 Jan 2019 03:44:26 -0500 Received: by mail-wm1-f65.google.com with SMTP id p6so16715165wmc.1 for ; Tue, 29 Jan 2019 00:44:24 -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=PpLsHCDGluO1vsNVw+7Cy8rzFc8ImPXS2+/9yCySWm4=; b=Pp5HBo+zRn/FU3isdmHpTUH2RZxF4VrG1kIQFAFHV7e3eCTHrhIqw0HV5j+fgORdEb AyeOXMEEhhUV5WAOteb6y+p8Db3NR4cwuI2d6nk2DTcBeM9wrJxY3L1DumfbihVPbUir K8UYsOdcbW+BFEr5+nBg+p1ebfAsf/tWzkDgOWZb4fMe8AID9Lg85VvOcBf0oSHF9RVK LbnHmFnKYOqMG4nC//v3wcvYBkVjCvO+o/RmKxa1kKQ8YyxdXS7mSBdEQuGh1OWgHyOp PPsuU/Kw5vf9vNkQQCH7htsqKQsaKSZcVtgKjugMEeXPH6Zw08HIj5uxvMZ67m1SW4JV AOiw== 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=PpLsHCDGluO1vsNVw+7Cy8rzFc8ImPXS2+/9yCySWm4=; b=oKXhUsbhgCXJcVRDrQAUw6oMybl/BzdO00oZTJa8utkU+W9sHzYzAwu0bHGkR/k7Lw PAJkDzRRbgOo9ZFpXNNWXSI/xiXDYD9K4z7hvrbOr/99SnbMDB5+/lK6PjqqrqyliUZg zG4VI5yWtN+kyeUZJXmQG6SgT2JhBA5tiIrExA1w40EYtfjOWzE4xhuCYIv3XRD7g3Ia V5EOQz06OtUFOMCaaullcbGAIMvVU+ns3p6balAuf1yBBWuQcRWO+mtMCjJq779oPZQp 3e1YLnHluj96q6c+mRMsM7dZwi3/Uuyuw7ABFRyq2L1Lvm9SIQ03voKckSHrx+My9lRH ycAw== X-Gm-Message-State: AJcUukf5mYAqxLIfmLuhuxAvqDkIUBD0U3XlQ4qrL6pNxpEiVOwgREMx 2eN7VnaBz5q0qGDJxU/4H9hxTg== X-Google-Smtp-Source: ALg8bN6YcqkYwHzvCHmHeMYrBuWpIGlT1j625Q0slRB9xXDK9KqBHcVex1iZ8MJnK+qisOvn0hTZ0A== X-Received: by 2002:a1c:b189:: with SMTP id a131mr21019132wmf.38.1548751464206; Tue, 29 Jan 2019 00:44:24 -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.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jan 2019 00:44:23 -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 5/9] gpio: mockup: implement get_multiple() Date: Tue, 29 Jan 2019 09:44:07 +0100 Message-Id: <20190129084411.30495-6-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 We already support set_multiple(). Implement get_multiple() as well. Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-mockup.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c index b4c1de6acf74..1c945c967f60 100644 --- a/drivers/gpio/gpio-mockup.c +++ b/drivers/gpio/gpio-mockup.c @@ -102,6 +102,22 @@ static int gpio_mockup_get(struct gpio_chip *gc, unsigned int offset) return val; } +static int gpio_mockup_get_multiple(struct gpio_chip *gc, + unsigned long *mask, unsigned long *bits) +{ + struct gpio_mockup_chip *chip = gpiochip_get_data(gc); + unsigned int bit, val; + + mutex_lock(&chip->lock); + for_each_set_bit(bit, mask, gc->ngpio) { + val = __gpio_mockup_get(gc, bit); + __assign_bit(bit, bits, val); + } + mutex_unlock(&chip->lock); + + return 0; +} + static void __gpio_mockup_set(struct gpio_chip *gc, unsigned int offset, int value) { @@ -327,6 +343,7 @@ static int gpio_mockup_probe(struct platform_device *pdev) gc->parent = dev; gc->get = gpio_mockup_get; gc->set = gpio_mockup_set; + gc->get_multiple = gpio_mockup_get_multiple; gc->set_multiple = gpio_mockup_set_multiple; gc->direction_output = gpio_mockup_dirout; gc->direction_input = gpio_mockup_dirin;