Received: by 10.213.65.68 with SMTP id h4csp1349916imn; Wed, 21 Mar 2018 08:34:16 -0700 (PDT) X-Google-Smtp-Source: AG47ELuL1eu+lv1kecUJSxy5v76K18kylhJbdZFAN/mEACTvU3UCwNwzSelW4pMh7FO8AYPc1yEE X-Received: by 2002:a17:902:71cf:: with SMTP id t15-v6mr21592612plm.107.1521646456764; Wed, 21 Mar 2018 08:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521646456; cv=none; d=google.com; s=arc-20160816; b=vmJFYsk6CqWx1MS7iQrnpodEwBeljEDLxW8Z1uHocnW4ahDnurFCn2im6OBMN2NlLk qzNYbhN3YhXBXNxVQ+PpETUzprLMMwgBso7KSeXolhunreYRqY62asmEcIrVP9FEP1jU qHdFg38HA+DQIoJZlAqYiVWwC//Fz66A35WfxfI9k3zM5e1yTvlr5hQg/ftojcynzC2G 3twYcQeOUwBZ7JuXiodgXr53aEMRJbRv2Ic8FcsCRpGfXOSKCvd/uQg+e/w8x1ayvMob YV8CQKyc+OtXH5vFzeCT9RTyEBgufxJsVHXSL8q/PG9Wq2nXmiGHyleMTxoidkHDqKPW tvpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=JvuElccLM4wcSE6J5ESArs46ON3TdYGJT3w9S9z31Ic=; b=vfbBc//ak1awENspNEqMLQyexRIXcF2wCjnwefNM1hMYBAcU52uPr/lugYaJPnCkbe xc66y1JZ6kV4FDwl12fCJRjBTtIJ1UDX1tb63FdnOJ+biLBS7ydmwTLWmOYS88IyTMCo m41/64SDuPkQV04uEDwGCqjX7s5wWI0weYu72rIhwil6+qD2dvySCDJ6a31JmnFLhen5 EC4Z2txkzWWyfhDKzdwxr0+Xbfu5ZduvfpYSLCueYONiyGyunSjYkR0+o9lI8xz9UUUB noj03lrJm3kwwxTCy5SP7akH+fjNypsnKty3HYuG+Xbg8Pv0S8U62lPQe6ddx61ne8OI tFIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=okYoH8qY; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r26si2965826pge.608.2018.03.21.08.34.02; Wed, 21 Mar 2018 08:34:16 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=okYoH8qY; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752846AbeCUPcN (ORCPT + 99 others); Wed, 21 Mar 2018 11:32:13 -0400 Received: from mail-qk0-f182.google.com ([209.85.220.182]:36221 "EHLO mail-qk0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752833AbeCUPcE (ORCPT ); Wed, 21 Mar 2018 11:32:04 -0400 Received: by mail-qk0-f182.google.com with SMTP id d206so5863508qkb.3; Wed, 21 Mar 2018 08:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JvuElccLM4wcSE6J5ESArs46ON3TdYGJT3w9S9z31Ic=; b=okYoH8qYJCQ2aLWPJLUmc16WsBqTQeoYf+hJRf21qUo/o3L3rNUTTz8AbQhRxZpeRh eOsY36MlxhbIrH8Yq98G7cBGiiKA/6siWZ7UFZ67Qn/q+Wuf9CsxYoToXid7VwYbnSGJ S/1+qomaBLkUXLt55LgLsqliXWpxkRYiF2X99kADD/o0dpN8S4H7JHNIjGptwPKrRYFe lmJmrtB6jhcQoII4Z/9tJo07NbDvFqVaIAWzuedZeXV8bTJQVFCOR4P6oQwdx0p5arty Z71uL0coyty2hMPa1H3euHdpSdRKdMCDOFKRaQYqJ2TDpne0h7IvpMwmJrG6h8V3XQgW Ouig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JvuElccLM4wcSE6J5ESArs46ON3TdYGJT3w9S9z31Ic=; b=RgVkLSSi3ix2uJi5d/EPMtOPd4IlrFh0cOsi9C0FKpLVYx4l8Mn9aml7ddyrPzs2bS hLU+dhDpaczCVtHRjTPbPLzWyKcJlby4ziKMDrOdNf3c5jbmqyrQAcPxBWIK0hSkURVn mRwtYfId4XFAihmHGOs/uzxvbdUcoTCq/TK7gsYUFRM5VRT2LP6n47muO4bNx4AfEU4t x6+Lon/EDArfiSiy8E283iUTGkn7Tleadrr0Xf6OXUEFfQzXaqH3oVwtkDAdBhqUWQTs jlOBX6UPKC/q3QuwObK6BAe6/5ob2fNnGV8kCqPOV93Ncv/ms5oTHh2CZ3V5aIkFEKzx RqzQ== X-Gm-Message-State: AElRT7F4InFjo6Gv+IiAEFQJQ/IobMZBToguCFGIMn0d+zLyEV2+SbK6 e50gl4wN5BL7vovxFiZSxJp9ZeHvRsUplh5vAUI= X-Received: by 10.55.0.203 with SMTP id t72mr30356121qkg.110.1521646323625; Wed, 21 Mar 2018 08:32:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.137.74 with HTTP; Wed, 21 Mar 2018 08:32:03 -0700 (PDT) In-Reply-To: <486eb9bad0440ed305a78d9fc990728cbeb7d43e.1521301345.git.vilhelm.gray@gmail.com> References: <486eb9bad0440ed305a78d9fc990728cbeb7d43e.1521301345.git.vilhelm.gray@gmail.com> From: Andy Shevchenko Date: Wed, 21 Mar 2018 17:32:03 +0200 Message-ID: Subject: Re: [PATCH v3 2/8] gpio: 104-idio-16: Implement get_multiple callback To: William Breathitt Gray Cc: Linus Walleij , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , linux-iio@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 17, 2018 at 5:50 PM, William Breathitt Gray wrote: > The ACCES I/O 104-IDIO-16 series of devices provides 16 > optically-isolated digital inputs accessed via two 8-bit ports. Since > eight input lines are acquired on a single port input read, the > 104-IDIO-16 GPIO driver may improve multiple input reads by utilizing a > get_multiple callback. This patch implements the > idio_16_gpio_get_multiple function which serves as the respective > get_multiple callback. > +static int idio_16_gpio_get_multiple(struct gpio_chip *chip, > + unsigned long *mask, unsigned long *bits) > +{ > + struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip); > + > + *bits = 0; > + if (*mask & 0xFF0000) GENMASK(23, 16) ? > + *bits |= (unsigned long)inb(idio16gpio->base + 1) << 16; Do you need casting? > + if (*mask & 0xFF000000) GENMASK(31, 24) ? Alternative (and for above): (*mask >> 24) & 0xff (*mask >> 16) & 0xff > + *bits |= (unsigned long)inb(idio16gpio->base + 5) << 24; Do you need casting? > + > + return 0; > +} > + > static void idio_16_gpio_set(struct gpio_chip *chip, unsigned offset, int value) > { > struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip); > @@ -244,6 +258,7 @@ static int idio_16_probe(struct device *dev, unsigned int id) > idio16gpio->chip.direction_input = idio_16_gpio_direction_input; > idio16gpio->chip.direction_output = idio_16_gpio_direction_output; > idio16gpio->chip.get = idio_16_gpio_get; > + idio16gpio->chip.get_multiple = idio_16_gpio_get_multiple; > idio16gpio->chip.set = idio_16_gpio_set; > idio16gpio->chip.set_multiple = idio_16_gpio_set_multiple; > idio16gpio->base = base[id]; > -- > 2.16.2 > -- With Best Regards, Andy Shevchenko