From patchwork Wed Mar 30 08:48:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 64651 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2467854lbc; Wed, 30 Mar 2016 01:49:59 -0700 (PDT) X-Received: by 10.98.87.200 with SMTP id i69mr10979372pfj.63.1459327798989; Wed, 30 Mar 2016 01:49:58 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p9si4949181pfi.201.2016.03.30.01.49.58; Wed, 30 Mar 2016 01:49:58 -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 S1758933AbcC3It4 (ORCPT + 29 others); Wed, 30 Mar 2016 04:49:56 -0400 Received: from mail-lb0-f180.google.com ([209.85.217.180]:34238 "EHLO mail-lb0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758868AbcC3Isp (ORCPT ); Wed, 30 Mar 2016 04:48:45 -0400 Received: by mail-lb0-f180.google.com with SMTP id vo2so27087399lbb.1 for ; Wed, 30 Mar 2016 01:48:45 -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=MzyiRQvM61KnCIgnq1shb+zl5QqSG/lqkIXf2GHvrPs=; b=GYbFrxOV068F5MS20fXTUnBGmLNqQ4Io884QUOKZ3Bc08MGmFACt7phNoG2ywent4o 3VWLc0gM+yOypd21nuI6oYd1PANLMvlol5P4a81pT2ZL3nTFHaz5ve0gKAl+c83rW2gA w6JlPkq0W0jm/ZABZE200yppFaMvhmlw5LVLI= 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=MzyiRQvM61KnCIgnq1shb+zl5QqSG/lqkIXf2GHvrPs=; b=baCCEwGPNWMVqQzeJIIgpnN3v7bk3SSOsjKpKVCnjNhHfRfWxUK1Mtjy9qHP+IuUeh UMb89SBuNr96ctZ4I1cQthecW149e4YRE7ILFvFBNuplw40+Nl083ljw5nZXIu9nNsnX rGWIcKUoGd93SN+OXjN12QV2qAea2+144eMt82Sq/SvO8aILIDEY9D/WKmQg2iXOmk59 ZbVpRFyr2dAHr6BMWiQdhnQz2jKYiKi1VLOvDwCKr7KldQSWUcY9cwe6sJpLdy8n6xPz 9JfCabksqrmHj+AgwWbb30tAFFb7+g0SqiBFfzZETQy+LxQ1A6W0r40BjhKuHlDOUyfm Ybqw== X-Gm-Message-State: AD7BkJJkXjtowl5fWTJQ3Z4gS1xx4jt0o0vgmRNr1MNEjAGovPrS7eOx/6Dx9CKAFGYtqARG X-Received: by 10.112.149.73 with SMTP id ty9mr2749923lbb.48.1459327724406; Wed, 30 Mar 2016 01:48:44 -0700 (PDT) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l10sm421542lfb.35.2016.03.30.01.48.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Mar 2016 01:48:43 -0700 (PDT) From: Linus Walleij To: Samuel Ortiz , Lee Jones , linux-kernel@vger.kernel.org Cc: Linus Walleij Subject: [PATCH 7/9] mfd: tps65010: Use gpiochip data pointer Date: Wed, 30 Mar 2016 10:48:07 +0200 Message-Id: <1459327689-12786-8-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 Signed-off-by: Linus Walleij --- drivers/mfd/tps65010.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.4.3 diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c index 495e4518fc29..d829a6131f09 100644 --- a/drivers/mfd/tps65010.c +++ b/drivers/mfd/tps65010.c @@ -34,7 +34,7 @@ #include -#include +#include /*-------------------------------------------------------------------------*/ @@ -477,7 +477,7 @@ tps65010_output(struct gpio_chip *chip, unsigned offset, int value) if (offset < 4) { struct tps65010 *tps; - tps = container_of(chip, struct tps65010, chip); + tps = gpiochip_get_data(chip); if (!(tps->outmask & (1 << offset))) return -EINVAL; tps65010_set_gpio_out_value(offset + 1, value); @@ -494,7 +494,7 @@ static int tps65010_gpio_get(struct gpio_chip *chip, unsigned offset) int value; struct tps65010 *tps; - tps = container_of(chip, struct tps65010, chip); + tps = gpiochip_get_data(chip); if (offset < 4) { value = i2c_smbus_read_byte_data(tps->client, TPS_DEFGPIO); @@ -651,7 +651,7 @@ static int tps65010_probe(struct i2c_client *client, tps->chip.ngpio = 7; tps->chip.can_sleep = 1; - status = gpiochip_add(&tps->chip); + status = gpiochip_add_data(&tps->chip, tps); if (status < 0) dev_err(&client->dev, "can't add gpiochip, err %d\n", status);