From patchwork Wed Dec 9 13:18:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57995 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp662605lbb; Wed, 9 Dec 2015 05:18:26 -0800 (PST) X-Received: by 10.98.13.218 with SMTP id 87mr12809130pfn.153.1449667106103; Wed, 09 Dec 2015 05:18:26 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s26si12711651pfi.57.2015.12.09.05.18.25; Wed, 09 Dec 2015 05:18:26 -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 S1754036AbbLINSZ (ORCPT + 4 others); Wed, 9 Dec 2015 08:18:25 -0500 Received: from mail-lb0-f182.google.com ([209.85.217.182]:33915 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751531AbbLINSZ (ORCPT ); Wed, 9 Dec 2015 08:18:25 -0500 Received: by lbbcs9 with SMTP id cs9so29722975lbb.1 for ; Wed, 09 Dec 2015 05:18:23 -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=uzbKU1ccfirM/WE4+ehDsv5CUSr4eeogFXI7CAZwpxg=; b=H53OyfmOHwnHsUocQtKhKlYAJFViVswEq8qausbopcy+yKFMYVL9iP9qpmYk0ky4GF DYafkR6RNL2bwWS4V7bx/VRVHXiBBYQGRA5ac3P5RCpOF4z1JJSX/RyPfxxrNBYz+hJf XkliRD0suuvhaEuw07rLZAuY4k3IAQgCfoFNEHS8Se5EGskJ9pdHCLVgyI2udOsAixB9 7geSAGIPUZ2lqcGyUSK6fZC4mGFgfV+WgJOyNMfyg62ewF3FxcVTsLIR/GwfZuNAI3vt vQCOjZQCFNM5elrjQmB25CW3BbwYlaHCYJrOhwCGoMAf99tTS2yqSonWKaB1CAWYRXs+ aW6Q== 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=uzbKU1ccfirM/WE4+ehDsv5CUSr4eeogFXI7CAZwpxg=; b=b7ZV3XtedkvkK2/A8tm3Tevv/n12hkGZ3ugM84hsMQ9QB8D+3D+rA9A2KtNXhz5yGn o8CRg+cG7pWYKwE3MbZUiwoaVIV5g7SjJdBIvrDzIfFFCaJZhmdJGWoUsT7dyrGhp3R4 3iqVsk7SA2NpbJYWdze/5KVOilQcazThzVBAsD8Dr2/usi0ioPm6rAS8gElSRb1AfwCc NBBSLLSV2F6nWP2sgEkJ+GVjG9icUYr9wMQmu+oQMljqz9Gv9dPayI384HClxTE7vyA1 RsOEok/ljZ7nTQB/GjgHs/vSt9sX/3eYtMbMWTcLV5UdZr2CSyHJW3ne6rY8HIMc8dOM Ivjw== X-Gm-Message-State: ALoCoQlpUY3LIhb6WoasQ7DXhnGA9BzXR+aViHhogDcY7DcnErOkmH02LmTpxOq+ge8DvwFDTvWRKBKz8qoxUbvPrEsgzPwNmA== X-Received: by 10.112.128.199 with SMTP id nq7mr2390524lbb.42.1449667103687; Wed, 09 Dec 2015 05:18:23 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id n65sm1414432lfb.43.2015.12.09.05.18.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:18:23 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Ricardo Ribalda Delgado , John Crispin Subject: [PATCH 040/182] gpio: mm-lantiq: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:18:20 +0100 Message-Id: <1449667100-31646-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: Ricardo Ribalda Delgado Cc: John Crispin Signed-off-by: Linus Walleij --- drivers/gpio/gpio-mm-lantiq.c | 9 +++------ 1 file changed, 3 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/gpio/gpio-mm-lantiq.c b/drivers/gpio/gpio-mm-lantiq.c index f67ef2283d64..a2071ed69f79 100644 --- a/drivers/gpio/gpio-mm-lantiq.c +++ b/drivers/gpio/gpio-mm-lantiq.c @@ -61,9 +61,7 @@ static void ltq_mm_apply(struct ltq_mm *chip) */ static void ltq_mm_set(struct gpio_chip *gc, unsigned offset, int value) { - struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); - struct ltq_mm *chip = - container_of(mm_gc, struct ltq_mm, mmchip); + struct ltq_mm *chip = gpiochip_get_data(gc); if (value) chip->shadow |= (1 << offset); @@ -93,8 +91,7 @@ static int ltq_mm_dir_out(struct gpio_chip *gc, unsigned offset, int value) */ static void ltq_mm_save_regs(struct of_mm_gpio_chip *mm_gc) { - struct ltq_mm *chip = - container_of(mm_gc, struct ltq_mm, mmchip); + struct ltq_mm *chip = gpiochip_get_data(&mm_gc->gc); /* tell the ebu controller which memory address we will be using */ ltq_ebu_w32(CPHYSADDR(chip->mmchip.regs) | 0x1, LTQ_EBU_ADDRSEL1); @@ -122,7 +119,7 @@ static int ltq_mm_probe(struct platform_device *pdev) if (!of_property_read_u32(pdev->dev.of_node, "lantiq,shadow", &shadow)) chip->shadow = shadow; - return of_mm_gpiochip_add(pdev->dev.of_node, &chip->mmchip); + return of_mm_gpiochip_add_data(pdev->dev.of_node, &chip->mmchip, chip); } static int ltq_mm_remove(struct platform_device *pdev)