From patchwork Wed Dec 9 13:41: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: 58100 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp675792lbb; Wed, 9 Dec 2015 05:41:22 -0800 (PST) X-Received: by 10.66.138.101 with SMTP id qp5mr7922545pab.113.1449668481747; Wed, 09 Dec 2015 05:41:21 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 86si12808196pfn.188.2015.12.09.05.41.21; Wed, 09 Dec 2015 05:41:21 -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 S1753927AbbLINlV (ORCPT + 4 others); Wed, 9 Dec 2015 08:41:21 -0500 Received: from mail-lf0-f48.google.com ([209.85.215.48]:33371 "EHLO mail-lf0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753925AbbLINlU (ORCPT ); Wed, 9 Dec 2015 08:41:20 -0500 Received: by lfaz4 with SMTP id z4so34471661lfa.0 for ; Wed, 09 Dec 2015 05:41:19 -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=nYmEV8Jq0xwmgXc5wAejSmF6pyTY073HODW985GM1Ro=; b=GfO6KkBzZBxKsdUl6d2ZeFfLFpwfae0/Fal73HkNpyhaDgw8JflNrMmRAtj4QQJBtk ceMo7Jze+9G+v2IO95Io1JHozQLACSHvfUx39+395lynjcQfh4REHwDB+1oNthE6w5no +Eyouqj59Eo3IeNDrGI3ck/mI6bMPFA/gCE81zLrYSXJQYI7OwOdde+VreoRB3fRBgtk sslIrDCJZ61O+06obmzVPWyiPdv+jsgAR9oouCHj3EO6ENTHa+mcCaCYrKDTucY45D38 gLDjalHVRkl8qqFYB7rbHxHSpcGomkUexUA5kvPUB34gitEuS0O6zGIzG5KgzpqRpKxw NUBg== 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=nYmEV8Jq0xwmgXc5wAejSmF6pyTY073HODW985GM1Ro=; b=MnNmhfHtU7a9tKkt6kT8eVsudmgZU9YCnmxiiU6cLk8Y484OA+wNAchXJnwxFwqvHG z6Be6mZi6ETiiUFmRPtb+qf/TZps2Y6Zmnm43tbjBSIEbLZbrlWaw/WJ2++w4Epayw8Q 7cYpqcmoWmriZhh+ZRpUjyHH68j5tahHuhV+ZxKx2Br3jk6IAHjFUmizc8LXDSKGNJAd 560kkklEVmc1brNb62NT04NIZwpgFbIBemRRDEL4j/NnYnwHP8dcimNaBFkYx7TAkQcq MwzJzQ1dAvZ5KWTWSvlNz9Pd6EsKJ9G7xUZ15P6oRqP9DEe89FNLZhoM5QzFmNgvZVqL r30Q== X-Gm-Message-State: ALoCoQlSZls1lIJ39JhJ+8mh+A/wUwfyvmb236nOaKO/xTQciFr3JBU1txUCzSOvHjA09oSsUjobu6qYqLNT7tkLxATxV/0Dug== X-Received: by 10.25.22.72 with SMTP id m69mr2237960lfi.127.1449668479313; Wed, 09 Dec 2015 05:41:19 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id w132sm1465411lfd.11.2015.12.09.05.41.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:41:18 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , Anatolij Gustschin , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: Linus Walleij Subject: [PATCH 144/182] powerpc: mpc8349emitx: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:41:16 +0100 Message-Id: <1449668476-4929-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: Anatolij Gustschin Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Signed-off-by: Linus Walleij --- Power maintainers: please ACK this. I cannot really say if this should ideally be broken out as a separate driver in drivers/gpio or if it is better to keep it here. For now just refactoring... --- arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 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/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c index 15e8021ddef9..dbcd0303afed 100644 --- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c +++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include @@ -99,7 +99,7 @@ static void mcu_power_off(void) static void mcu_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) { - struct mcu *mcu = container_of(gc, struct mcu, gc); + struct mcu *mcu = gpiochip_get_data(gc); u8 bit = 1 << (4 + gpio); mutex_lock(&mcu->lock); @@ -136,7 +136,7 @@ static int mcu_gpiochip_add(struct mcu *mcu) gc->direction_output = mcu_gpio_dir_out; gc->of_node = np; - return gpiochip_add(gc); + return gpiochip_add_data(gc, mcu); } static int mcu_gpiochip_remove(struct mcu *mcu)