From patchwork Wed Dec 9 13:46:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 7808771 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B9FD19F39B for ; Wed, 9 Dec 2015 13:47:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E13FF204AB for ; Wed, 9 Dec 2015 13:47:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5DE1A20490 for ; Wed, 9 Dec 2015 13:47:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754792AbbLINrB (ORCPT ); Wed, 9 Dec 2015 08:47:01 -0500 Received: from mail-lf0-f51.google.com ([209.85.215.51]:35468 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753131AbbLINrA (ORCPT ); Wed, 9 Dec 2015 08:47:00 -0500 Received: by lfdl133 with SMTP id l133so34406495lfd.2 for ; Wed, 09 Dec 2015 05:46:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=j/whOmUCs7NHbV08j/z0a2bwqQufihZZ+rAO5AuQyB4=; b=njm9wqk5x2MzO+rPDr+zDpEVmUg2eMU6i6JfI5x645r57IMdYNF0bSn5r+TRlpwS8A eS7WjFMG7QOI5GdONTU7UWdetIu72TgQTH68n3bpEbyLwjCkvl+xrwvPcYuVVInHPnHB V+8EoNRAA3mf4BbiIPw+pVnD8Q/FPEDZysm6SyWghyQ6qbdK87WGP+uWr/9QDjbHez6D JKSMIKXlx2ZBlg49NxBB61zAT5fn7bdel/iIxG00h1oFKefd2ATvstPj8dWgFh0ta+UY oAXfTe+Tsf+EZqecCVFjHfFRfxVV1p+qDrZV6wWEQgrrdVHZhFAg6aiI+nOACe1jy2BS nfYg== 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; bh=j/whOmUCs7NHbV08j/z0a2bwqQufihZZ+rAO5AuQyB4=; b=Cg2X20Z/a+ncwVdNiMb6mVVkzV3oZEY8J1KmE8fEXCbXquK5rWgGBtP12dUh7HBkJj uDeFatoSHmnxjgqBsZ7zxnyaxnaibZv4sV5HZc3DPUhg7uTFyQjpfPsnDbgIdP5zCk/l prU0a0Ar106bPevUnARrkRX5nBNfwpw12Ssymhz70pAbkQZu+xbETxoite6kbztoFCmR DeFDsZEgJNQMqjXCBWAvKkV9bMFDOd9/lFq7gILtBh6J8dQRZaUMgO5vCa/qEkTymS4p TnN6e3G/WB4NgtjmMFXpz/DtIfb+2O3CxseMumxU6imNmYTqgkCXK9RWaOLWn9pneGbX mdJQ== X-Gm-Message-State: ALoCoQksZq8uuItxlx8mNfY3KpWKAQBaIe1aAlcLyTqW3z9FSgr+k6qHKMALpEZ71hHmuDsVkrchziCgrJvBp/zYBAcyiXWW+w== X-Received: by 10.25.169.15 with SMTP id s15mr2329141lfe.20.1449668819264; Wed, 09 Dec 2015 05:46:59 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id dz6sm1442645lbb.17.2015.12.09.05.46.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:46:58 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , Antti Palosaari , Mauro Carvalho Chehab Cc: Linus Walleij , linux-media@vger.kernel.org Subject: [PATCH 160/182] [media]: cxd2830r: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:46:55 +0100 Message-Id: <1449668815-6072-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(). Cc: Antti Palosaari Cc: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Signed-off-by: Linus Walleij --- Mauro: please ACK this so I can merge it in the GPIO tree. --- drivers/media/dvb-frontends/cxd2820r_core.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/media/dvb-frontends/cxd2820r_core.c b/drivers/media/dvb-frontends/cxd2820r_core.c index 24a457d9d803..ba4cb7557aa5 100644 --- a/drivers/media/dvb-frontends/cxd2820r_core.c +++ b/drivers/media/dvb-frontends/cxd2820r_core.c @@ -606,8 +606,7 @@ static int cxd2820r_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) static int cxd2820r_gpio_direction_output(struct gpio_chip *chip, unsigned nr, int val) { - struct cxd2820r_priv *priv = - container_of(chip, struct cxd2820r_priv, gpio_chip); + struct cxd2820r_priv *priv = gpiochip_get_data(chip); u8 gpio[GPIO_COUNT]; dev_dbg(&priv->i2c->dev, "%s: nr=%d val=%d\n", __func__, nr, val); @@ -620,8 +619,7 @@ static int cxd2820r_gpio_direction_output(struct gpio_chip *chip, unsigned nr, static void cxd2820r_gpio_set(struct gpio_chip *chip, unsigned nr, int val) { - struct cxd2820r_priv *priv = - container_of(chip, struct cxd2820r_priv, gpio_chip); + struct cxd2820r_priv *priv = gpiochip_get_data(chip); u8 gpio[GPIO_COUNT]; dev_dbg(&priv->i2c->dev, "%s: nr=%d val=%d\n", __func__, nr, val); @@ -636,8 +634,7 @@ static void cxd2820r_gpio_set(struct gpio_chip *chip, unsigned nr, int val) static int cxd2820r_gpio_get(struct gpio_chip *chip, unsigned nr) { - struct cxd2820r_priv *priv = - container_of(chip, struct cxd2820r_priv, gpio_chip); + struct cxd2820r_priv *priv = gpiochip_get_data(chip); dev_dbg(&priv->i2c->dev, "%s: nr=%d\n", __func__, nr); @@ -731,7 +728,7 @@ struct dvb_frontend *cxd2820r_attach(const struct cxd2820r_config *cfg, priv->gpio_chip.base = -1; /* dynamic allocation */ priv->gpio_chip.ngpio = GPIO_COUNT; priv->gpio_chip.can_sleep = 1; - ret = gpiochip_add(&priv->gpio_chip); + ret = gpiochip_add_data(&priv->gpio_chip, priv); if (ret) goto error;