From patchwork Wed Dec 9 13:50:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58130 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp680816lbb; Wed, 9 Dec 2015 05:50:30 -0800 (PST) X-Received: by 10.66.236.162 with SMTP id uv2mr8045439pac.101.1449669030816; Wed, 09 Dec 2015 05:50:30 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id af1si12828618pad.198.2015.12.09.05.50.30; Wed, 09 Dec 2015 05:50:30 -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 S1753998AbbLINua (ORCPT + 4 others); Wed, 9 Dec 2015 08:50:30 -0500 Received: from mail-lf0-f52.google.com ([209.85.215.52]:33285 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753131AbbLINu3 (ORCPT ); Wed, 9 Dec 2015 08:50:29 -0500 Received: by lfaz4 with SMTP id z4so34652367lfa.0 for ; Wed, 09 Dec 2015 05:50:28 -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=ZqxFXT4sDLrHSWQ6scroarjn58dR6Fhv+EDG6GAO6ic=; b=tVjsS55tOydKMwdVmRIWJ1tkDmnHuIsNQ0EOQlNLkjnVk2SyZE+f8Gj2v+iFdJjkoN IBmc+tAlz6gf1epl8/Hc2jrLQrofYguJ+hDxvHkRyHawPZ+2YhBudMjFBol3BXYp65cL v+X0Tr9AnJeWURH9M98J/2vR1yKpHeUdareet2ZxP5R2Fa4wxq41VN5mDQpD55LFkoWU XymOj3PQGje6gsKTXl0DV7zVzLRv0hzm1U+fE+qXr5jl+SiZIAl/zctquO5ulKM+Bg1i lnJGKuyTySHiWpJ1czb6rmOrHqrFzbhqmvGkFWr42eGqCCJtvamQPmHPWPRq4yebZbe7 5QCQ== 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=ZqxFXT4sDLrHSWQ6scroarjn58dR6Fhv+EDG6GAO6ic=; b=dBtzbWBkO4Qh/peOKHfsv9jxGgoii1l7OqljL3GNrFo0GH5tGcmQuXojM5LZ/xcBby B+LAN/NevhYA0RM8Rx8uyfeVnzut8N0vhaW4pDwCKxjU4uIC35gTzE3zIBb95UzT8v0a RCpnNPpI0AUw8E4K/qpKTuicnNFVlkqzfoHg23LH20mYmblZEVspARIJJMa1V0mCQiGz 8ppKYu3BVQAjBP4/TcC1ZbmzQHzk900Rp6tn1bo4WihjfOhZGcf4JRi4l0FF4tLGHsWF AEYYu+Rxkwtu0Xew1VwvIjy8f0WJbu8lyacu4Xug2PkB9xlbToFhxR31+GQN1CjLMo7+ jDXQ== X-Gm-Message-State: ALoCoQndxv6opEiBpgEYnxgP/Ff3AIGBRi3vOkqPaZsczGSsx/Q/XHkH23k3nKLeivGQvxAxZq9dwkYRPiFHOLDd9Gw6kNWBQg== X-Received: by 10.25.218.9 with SMTP id r9mr2322713lfg.138.1449669028380; Wed, 09 Dec 2015 05:50:28 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 42sm1476474lfv.29.2015.12.09.05.50.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:50:27 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , Greg Kroah-Hartman Cc: Linus Walleij , Jiri Slaby Subject: [PATCH 174/182] serial: sc16is7xx: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:50:25 +0100 Message-Id: <1449669025-6929-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: Greg Kroah-Hartman Cc: Jiri Slaby Signed-off-by: Linus Walleij --- Greg, please ACK this so I can take it through the GPIO tree. --- drivers/tty/serial/sc16is7xx.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 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/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index cc86c348d809..b1eefcd80d05 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include @@ -1083,8 +1083,7 @@ static const struct uart_ops sc16is7xx_ops = { static int sc16is7xx_gpio_get(struct gpio_chip *chip, unsigned offset) { unsigned int val; - struct sc16is7xx_port *s = container_of(chip, struct sc16is7xx_port, - gpio); + struct sc16is7xx_port *s = gpiochip_get_data(chip); struct uart_port *port = &s->p[0].port; val = sc16is7xx_port_read(port, SC16IS7XX_IOSTATE_REG); @@ -1094,8 +1093,7 @@ static int sc16is7xx_gpio_get(struct gpio_chip *chip, unsigned offset) static void sc16is7xx_gpio_set(struct gpio_chip *chip, unsigned offset, int val) { - struct sc16is7xx_port *s = container_of(chip, struct sc16is7xx_port, - gpio); + struct sc16is7xx_port *s = gpiochip_get_data(chip); struct uart_port *port = &s->p[0].port; sc16is7xx_port_update(port, SC16IS7XX_IOSTATE_REG, BIT(offset), @@ -1105,8 +1103,7 @@ static void sc16is7xx_gpio_set(struct gpio_chip *chip, unsigned offset, int val) static int sc16is7xx_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { - struct sc16is7xx_port *s = container_of(chip, struct sc16is7xx_port, - gpio); + struct sc16is7xx_port *s = gpiochip_get_data(chip); struct uart_port *port = &s->p[0].port; sc16is7xx_port_update(port, SC16IS7XX_IODIR_REG, BIT(offset), 0); @@ -1117,8 +1114,7 @@ static int sc16is7xx_gpio_direction_input(struct gpio_chip *chip, static int sc16is7xx_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int val) { - struct sc16is7xx_port *s = container_of(chip, struct sc16is7xx_port, - gpio); + struct sc16is7xx_port *s = gpiochip_get_data(chip); struct uart_port *port = &s->p[0].port; sc16is7xx_port_update(port, SC16IS7XX_IOSTATE_REG, BIT(offset), @@ -1189,7 +1185,7 @@ static int sc16is7xx_probe(struct device *dev, s->gpio.base = -1; s->gpio.ngpio = devtype->nr_gpio; s->gpio.can_sleep = 1; - ret = gpiochip_add(&s->gpio); + ret = gpiochip_add_data(&s->gpio, s); if (ret) goto out_thread; }