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: 58116 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp678981lbb; Wed, 9 Dec 2015 05:47:03 -0800 (PST) X-Received: by 10.66.216.200 with SMTP id os8mr8000962pac.143.1449668823195; Wed, 09 Dec 2015 05:47:03 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ah10si12832383pad.118.2015.12.09.05.47.02; Wed, 09 Dec 2015 05:47:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754780AbbLINrB (ORCPT + 4 others); Wed, 9 Dec 2015 08:47:01 -0500 Received: from mail-lf0-f44.google.com ([209.85.215.44]:34696 "EHLO mail-lf0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753083AbbLINrA (ORCPT ); Wed, 9 Dec 2015 08:47:00 -0500 Received: by lffu14 with SMTP id u14so34599256lff.1 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=kpT91Tjob+O9Aj6j3zKmUMF/e+qOXvTvTAE9BDegP8SSKt46WIUlOoxpT8ssbkMm4c V8lFhyf7rYfSFb6dXKHPqmuLkxopFpAVy//Y5NLU/OHGAl//3c2qUf2cYYjLYL1XA6hR KYGpQRV6qAjfN3kOAD/N6kzovPKu2W0S/zVIi7lf+5IkxeP1mi92KEV/2k+YtcUTHxnr CS998y9YfL2dPdZXKbNzZ2njg4KGE7nOrHSaA8YdFrYsZ1S+VdfZ9bysI+jep+7M70ZW xser37qngUj7WT1alNzeD5gAdxEdP9qfmAvtzYNfioETGNpYvuwiu7vvUEWck/IIVVuL GQRg== X-Gm-Message-State: ALoCoQnG1azfT+mEzDM+IpU53KnThFQndBn2AYV2hCZNrcNTCCY/0SdhnIpOpIeQ3rsA5xahc7lWPvBf3ZcHvg2bn6WRjb75Tw== 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-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@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(). 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(-) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;