From patchwork Thu Feb 19 01:52:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 441518 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 8D3491400DE for ; Thu, 19 Feb 2015 12:52:42 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751646AbbBSBwk (ORCPT ); Wed, 18 Feb 2015 20:52:40 -0500 Received: from mail-wg0-f48.google.com ([74.125.82.48]:57150 "EHLO mail-wg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751382AbbBSBwj (ORCPT ); Wed, 18 Feb 2015 20:52:39 -0500 Received: by mail-wg0-f48.google.com with SMTP id l18so4557737wgh.7; Wed, 18 Feb 2015 17:52:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=HVsXWtUcJTM1z3L5UuiLGykHQPZpw2VeCzYzmHk+2Qw=; b=tQgWWEbr4EEEEu9lqsniF/WPtg+8c9tyESadlkdoGwixbWjdzC/0nTroPSm9ucELi2 bagNg8dNwGnX4/g8djfgPNnBJtlZiTMQLTg+m+OzlL28tT+FFJjQaVFtlReRsT9CJDHj cKx8CLh7bYe5I64vqgsYneSReYhy/nDohGACwIOoFDjkUgGvhXDHopIv2PXwRI7QKbDI caFf5XU1oUjEugGO9kssD9xX+QRPPlEH+hA18ROYDrCbSWO9YkCNjHk6mW7Cd5GiLtVI 8HvpAkUn0DT5jVpzT9if+IbSyvvcykPORrV9+xqJC1rLdwQBNzCGtwQZSoMQzSsVHqqf Q6Wg== X-Received: by 10.194.89.163 with SMTP id bp3mr3814313wjb.145.1424310758271; Wed, 18 Feb 2015 17:52:38 -0800 (PST) Received: from localhost.localdomain ([37.228.224.79]) by mx.google.com with ESMTPSA id yy9sm35207280wjc.20.2015.02.18.17.52.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Feb 2015 17:52:37 -0800 (PST) From: Nicolas Saenz Julienne To: linus.walleij@linaro.org, gnurou@gmail.com Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolas Saenz Julienne Subject: [PATCH] gpio: tps65912: fix wrong container_of arguments Date: Thu, 19 Feb 2015 01:52:25 +0000 Message-Id: <1424310745-28101-1-git-send-email-nicolassaenzj@gmail.com> X-Mailer: git-send-email 2.1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The gpio_chip operations receive a pointer the gpio_chip struct which is contained in the driver's private struct, yet the container_of call in those functions point to the mfd struct defined in include/linux/mfd/tps65912.h. Signed-off-by: Nicolas Saenz Julienne --- drivers/gpio/gpio-tps65912.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-tps65912.c b/drivers/gpio/gpio-tps65912.c index 472fb5b..9cdbc0c 100644 --- a/drivers/gpio/gpio-tps65912.c +++ b/drivers/gpio/gpio-tps65912.c @@ -26,9 +26,12 @@ struct tps65912_gpio_data { struct gpio_chip gpio_chip; }; +#define to_tgd(gc) container_of(gc, struct tps65912_gpio_data, gpio_chip) + static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) { - struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); + struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); + struct tps65912 *tps65912 = tps65912_gpio->tps65912; int val; val = tps65912_reg_read(tps65912, TPS65912_GPIO1 + offset); @@ -42,7 +45,8 @@ static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, int value) { - struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); + struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); + struct tps65912 *tps65912 = tps65912_gpio->tps65912; if (value) tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset, @@ -55,7 +59,8 @@ static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, int value) { - struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); + struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); + struct tps65912 *tps65912 = tps65912_gpio->tps65912; /* Set the initial value */ tps65912_gpio_set(gc, offset, value); @@ -66,7 +71,8 @@ static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset) { - struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); + struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); + struct tps65912 *tps65912 = tps65912_gpio->tps65912; return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset, GPIO_CFG_MASK);