From patchwork Wed Mar 30 08:48:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 64652 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2468377lbc; Wed, 30 Mar 2016 01:51:27 -0700 (PDT) X-Received: by 10.98.1.74 with SMTP id 71mr11338207pfb.10.1459327886880; Wed, 30 Mar 2016 01:51:26 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g15si5019831pfg.40.2016.03.30.01.51.26; Wed, 30 Mar 2016 01:51:26 -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=@linaro.org; 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 dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758849AbcC3Isj (ORCPT + 29 others); Wed, 30 Mar 2016 04:48:39 -0400 Received: from mail-lb0-f169.google.com ([209.85.217.169]:34153 "EHLO mail-lb0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753503AbcC3Isg (ORCPT ); Wed, 30 Mar 2016 04:48:36 -0400 Received: by mail-lb0-f169.google.com with SMTP id vo2so27085006lbb.1 for ; Wed, 30 Mar 2016 01:48:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nZ9KQfUwm+tL4QWks8HpSox08j+j0EpMaNC/wwhdBf4=; b=V6IQbPpgxp24ujk5bCtmvvdFWOzB60//z0v5Uunmkv/FKpVePqqWVisYIejHtyFGcM qZb8/hgHS9OylarKnQkEH6rU6/AtWg7znYxANUth54dgC42AAPwUrswgf6tq9IhFe+mC jR2m4Dw2+aqI7L+PfVkCMZER4RveM3Ub4xenc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nZ9KQfUwm+tL4QWks8HpSox08j+j0EpMaNC/wwhdBf4=; b=DULUZjJhnPNHfbF4CRfG/PZq/jl6cxruBBP1gLwRaF2UOJsp6xVMtijwWexU855q4Z f7z3BIHyQAvmEH851RGuf9aW/tgo2sRasFXSmA9y8AmZCtwUdTFu6IMxc5SJjboR2QH+ 13ceV9meJmaTDsdY8CBepaGe15bFcWTMB8owlUij9ONXfqU9hXrBxFuh8e7f5ZnDqhsC C5zsp13uKWtQYt0O4TxXMcptmBfQXB+S4TdaHeqttyOssR0e1P599y7HG2xouyquy3IY qkPGbb0lNGqnGQYQc5Rnkd4cbrGNYQk1iAJ3dyrrW996x2y/s+TnrEsCV0copDLFTcJ9 lLAA== X-Gm-Message-State: AD7BkJL4do6wDkZq7Uy6Lt5pWsd+Pr4YtqKOdMHnmiS+NyqyI5pSCdzVL66wndCcKPc5VrM9 X-Received: by 10.112.159.200 with SMTP id xe8mr3253008lbb.75.1459327714717; Wed, 30 Mar 2016 01:48:34 -0700 (PDT) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l10sm421542lfb.35.2016.03.30.01.48.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Mar 2016 01:48:34 -0700 (PDT) From: Linus Walleij To: Samuel Ortiz , Lee Jones , linux-kernel@vger.kernel.org Cc: Linus Walleij Subject: [PATCH 3/9] mfd: htc-egpio: Use gpiochip data pointer Date: Wed, 30 Mar 2016 10:48:03 +0200 Message-Id: <1459327689-12786-4-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1459327689-12786-1-git-send-email-linus.walleij@linaro.org> References: <1459327689-12786-1-git-send-email-linus.walleij@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Acked-by: Lee Jones Acked-by: Philipp Zabel Signed-off-by: Linus Walleij --- drivers/mfd/htc-egpio.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.4.3 diff --git a/drivers/mfd/htc-egpio.c b/drivers/mfd/htc-egpio.c index c636b5f83cfb..513cfc5c8fb6 100644 --- a/drivers/mfd/htc-egpio.c +++ b/drivers/mfd/htc-egpio.c @@ -155,7 +155,7 @@ static int egpio_get(struct gpio_chip *chip, unsigned offset) pr_debug("egpio_get_value(%d)\n", chip->base + offset); - egpio = container_of(chip, struct egpio_chip, chip); + egpio = gpiochip_get_data(chip); ei = dev_get_drvdata(egpio->dev); bit = egpio_bit(ei, offset); reg = egpio->reg_start + egpio_pos(ei, offset); @@ -170,7 +170,7 @@ static int egpio_direction_input(struct gpio_chip *chip, unsigned offset) { struct egpio_chip *egpio; - egpio = container_of(chip, struct egpio_chip, chip); + egpio = gpiochip_get_data(chip); return test_bit(offset, &egpio->is_out) ? -EINVAL : 0; } @@ -192,7 +192,7 @@ static void egpio_set(struct gpio_chip *chip, unsigned offset, int value) pr_debug("egpio_set(%s, %d(%d), %d)\n", chip->label, offset, offset+chip->base, value); - egpio = container_of(chip, struct egpio_chip, chip); + egpio = gpiochip_get_data(chip); ei = dev_get_drvdata(egpio->dev); bit = egpio_bit(ei, offset); pos = egpio_pos(ei, offset); @@ -216,7 +216,7 @@ static int egpio_direction_output(struct gpio_chip *chip, { struct egpio_chip *egpio; - egpio = container_of(chip, struct egpio_chip, chip); + egpio = gpiochip_get_data(chip); if (test_bit(offset, &egpio->is_out)) { egpio_set(chip, offset, value); return 0; @@ -330,7 +330,7 @@ static int __init egpio_probe(struct platform_device *pdev) chip->base = pdata->chip[i].gpio_base; chip->ngpio = pdata->chip[i].num_gpios; - gpiochip_add(chip); + gpiochip_add_data(chip, &ei->chip[i]); } /* Set initial pin values */