From patchwork Thu Nov 8 16:52:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 995020 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="JHo+tAVD"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42rTr12fh1z9sBh for ; Fri, 9 Nov 2018 03:53:21 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727440AbeKIC3f (ORCPT ); Thu, 8 Nov 2018 21:29:35 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:44100 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727369AbeKIC3e (ORCPT ); Thu, 8 Nov 2018 21:29:34 -0500 Received: by mail-wr1-f66.google.com with SMTP id j17-v6so16878511wrq.11 for ; Thu, 08 Nov 2018 08:53:12 -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=RTop1/ZKpMeTxQR7kMHNViu+sfNC80EGmmamdx7DZuY=; b=JHo+tAVD4pfManEDrMkNfiShzpIH5mVzw4R69EvVR6l0eMG8pV3VlfdRiNJd31vmo+ CER3ae4qjtIaRBO1PmPjisZ2E60gQrD8hdu0EBdnJm+k+tDiZeVLhpDMofVg0qFfL6r6 5Y+URFdiLC7cg5ArKmGZFs2SHoo+L8BAax8xWOCJACH+EnhqvnJdxL4QAPwDfaOqzbjm X+XcBPbJDbmZ6SI5byASnWR2OATucBdRN+4WaAnhhEdd1uAWk/+jrI7wJkXF12kSv4pe k6oMpM2lwUMRk+tp9uhnIfuWHiFnCG2Ei/RDYB1PVkfvgEwAg/3rAoRre3QZnztTX4AC DUqA== 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=RTop1/ZKpMeTxQR7kMHNViu+sfNC80EGmmamdx7DZuY=; b=JOwMtDT2T5LnG+Us5WtVIZeSjmfKAk7egUDqIE5m2fRD0h597iQSZhTaMBB11ULP1L gWauegbhcZdw+ZYLgsDSwPv53F9OEUtrlUNOFWkMh8QQFqmCcHe7C1HClmOcZ5kQq9fQ iA2oPtzDUNGNC8Mn+sXoqpqfx687mzjhwkOW/5bWBzeAYYO97NlkA+Fcl8ZQaG2a0kaB Ih9AZUGM8QtShxDNztriG0G1fxZ0+2VpfFUF4AGpOgrajtiFMY7n99hymI1h5od72S5/ McW45W45Z9UMb0WiqNDGXj6aF5Jn81yaE9Z5F6fSbnTJWqNwECQabRF9BwNE1vDdSijG fdnQ== X-Gm-Message-State: AGRZ1gIqe5Al8BaNKu/1YBMidqA8WVjoThiHJ9myWwx1LLxfAaE0k8j7 CYTz0XfidjwHYKVcicme7eOG6g== X-Google-Smtp-Source: AJdET5dGnFkZmPm5esPCxIyjBPPuX5HDB6qhW1s3k5075VfTeijcBxr56tE7NkQXQzel/XpmquXkZQ== X-Received: by 2002:adf:c189:: with SMTP id x9-v6mr4773949wre.233.1541695992007; Thu, 08 Nov 2018 08:53:12 -0800 (PST) Received: from debian-brgl.lan ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id h5-v6sm7815987wrs.51.2018.11.08.08.53.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Nov 2018 08:53:11 -0800 (PST) From: Bartosz Golaszewski To: Bamvor Jian Zhang , Linus Walleij , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 3/3] gpio: mockup: implement get_multiple() Date: Thu, 8 Nov 2018 17:52:55 +0100 Message-Id: <20181108165255.9940-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108165255.9940-1-brgl@bgdev.pl> References: <20181108165255.9940-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 We already support set_multiple(). Implement get_multiple() as well. Signed-off-by: Bartosz Golaszewski Acked-by: Uwe Kleine-König --- 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 3cd92912c414..a4c054cf9c5f 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;