From patchwork Wed Dec 9 13:50:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58129 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp680762lbb; Wed, 9 Dec 2015 05:50:23 -0800 (PST) X-Received: by 10.66.232.202 with SMTP id tq10mr7750213pac.156.1449669023131; Wed, 09 Dec 2015 05:50:23 -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.22; Wed, 09 Dec 2015 05:50:23 -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 S1754621AbbLINuW (ORCPT + 4 others); Wed, 9 Dec 2015 08:50:22 -0500 Received: from mail-lb0-f176.google.com ([209.85.217.176]:33684 "EHLO mail-lb0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753131AbbLINuV (ORCPT ); Wed, 9 Dec 2015 08:50:21 -0500 Received: by lbbkw15 with SMTP id kw15so30350515lbb.0 for ; Wed, 09 Dec 2015 05:50:20 -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=pKmxeI+v7l/USAzxWpYGtfhsbv4YxRLM6inw2yOQ0CQ=; b=LEQjbO4D/p7lQVMPU0I+iS7+AfFuh1SUI5oqVXmqO5l6hGn1Fzd8uceh1hjYyTJxia lhDUx1zoXXSNos+KT6XA2gqF8+rsuaJF1dcM/cwwjJgupmNLXjYjJxr34oudfU5Gyrp5 ppB0cUBVYTQbTUCsCeOXlptveov+XWUQnUmKuq5Drk84vukcej3+LqRV/3KWLTva9Fam bARWYR9iLF9oM4ZQiW+NvKhglE8NzrO1yQ/kskcdMWu8B4MtCTsxOyhj7DU62nRnDK8X Nvq9j/XGUuFtFOySg1KNcMA9TiK0ImscXhj25ooI/4L6Vqy768phYbcBIG2l3hxhoFvE AeGg== 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=pKmxeI+v7l/USAzxWpYGtfhsbv4YxRLM6inw2yOQ0CQ=; b=lVybTD+uHJaooVvNUamipEolrsbKn1BczsNbkMGmdIJ7E7dpiZk9VMclqa2qJ7AyIw MQ/qd9GCAScEYL6BRaJLQ+OcZNPehCV+ql2zyIUdSEJyMUjMTEfvXcvOqnBdVFCnx/SP FICYLuLcOlQe+4m0FzjD/yZOkIpekxVxtEOydZiYEmXmRjoVCTJUEk1sJQY2TpFjNRRE A29OdLZAN07+yL3uIT3morLTs9KwL7aVPaOs/O5/c+z+mRxODmhxbumc8wrkFSZ3OjU+ U8zl9Dkceafs934rndn1EwkStaItqY5tgOlwY1WxZ2eLUjmRqKTj1OgTlcY4kpV8mcsJ 9Rug== X-Gm-Message-State: ALoCoQnwGk3tznaWKqrKA/5cF2nbhx9HnHvrVmwCnf7+WAnbXYTjPDgLn5Ia+TKUE427uQazqhRnjA1e8X7W7vfIxpVcyYOy4g== X-Received: by 10.112.161.131 with SMTP id xs3mr2506187lbb.0.1449669020495; Wed, 09 Dec 2015 05:50:20 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id d2sm1444535lbc.11.2015.12.09.05.50.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:50:19 -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 173/182] serial: max310x: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:50:16 +0100 Message-Id: <1449669016-6882-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/max310x.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 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/max310x.c b/drivers/tty/serial/max310x.c index 3f98165b479c..3f6e0ab725fe 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include @@ -1036,7 +1036,7 @@ static SIMPLE_DEV_PM_OPS(max310x_pm_ops, max310x_suspend, max310x_resume); static int max310x_gpio_get(struct gpio_chip *chip, unsigned offset) { unsigned int val; - struct max310x_port *s = container_of(chip, struct max310x_port, gpio); + struct max310x_port *s = gpiochip_get_data(chip); struct uart_port *port = &s->p[offset / 4].port; val = max310x_port_read(port, MAX310X_GPIODATA_REG); @@ -1046,7 +1046,7 @@ static int max310x_gpio_get(struct gpio_chip *chip, unsigned offset) static void max310x_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct max310x_port *s = container_of(chip, struct max310x_port, gpio); + struct max310x_port *s = gpiochip_get_data(chip); struct uart_port *port = &s->p[offset / 4].port; max310x_port_update(port, MAX310X_GPIODATA_REG, 1 << (offset % 4), @@ -1055,7 +1055,7 @@ static void max310x_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static int max310x_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { - struct max310x_port *s = container_of(chip, struct max310x_port, gpio); + struct max310x_port *s = gpiochip_get_data(chip); struct uart_port *port = &s->p[offset / 4].port; max310x_port_update(port, MAX310X_GPIOCFG_REG, 1 << (offset % 4), 0); @@ -1066,7 +1066,7 @@ static int max310x_gpio_direction_input(struct gpio_chip *chip, unsigned offset) static int max310x_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) { - struct max310x_port *s = container_of(chip, struct max310x_port, gpio); + struct max310x_port *s = gpiochip_get_data(chip); struct uart_port *port = &s->p[offset / 4].port; max310x_port_update(port, MAX310X_GPIODATA_REG, 1 << (offset % 4), @@ -1183,7 +1183,7 @@ static int max310x_probe(struct device *dev, struct max310x_devtype *devtype, s->gpio.base = -1; s->gpio.ngpio = devtype->nr * 4; s->gpio.can_sleep = 1; - ret = gpiochip_add(&s->gpio); + ret = gpiochip_add_data(&s->gpio, s); if (ret) goto out_uart; #endif