From patchwork Sun Sep 14 13:56:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 389066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B61BA140086 for ; Sun, 14 Sep 2014 23:57:40 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752494AbaINN5W (ORCPT ); Sun, 14 Sep 2014 09:57:22 -0400 Received: from mailrelay012.isp.belgacom.be ([195.238.6.179]:43233 "EHLO mailrelay012.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752489AbaINN5V (ORCPT ); Sun, 14 Sep 2014 09:57:21 -0400 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah0OAMWdFVRbsGnM/2dsb2JhbABggw2zSAEBAQEBAQUBbwGdfIEEF3iEMS8jgRo3iEIBqG2PGYV8iVEdhDUFnQiMMIkPghuBRTsvgkoBAQE Received: from 204.105-176-91.adsl-dyn.isp.belgacom.be (HELO localhost.localdomain) ([91.176.105.204]) by relay.skynet.be with ESMTP; 14 Sep 2014 15:57:19 +0200 From: Fabian Frederick To: linux-kernel@vger.kernel.org Cc: Fabian Frederick , Linus Walleij , Alexandre Courbot , linux-gpio@vger.kernel.org Subject: [PATCH 1/1 linux-next] gpio: use container_of to resolve cs5535_gpio_chip from gpio_chip Date: Sun, 14 Sep 2014 15:56:55 +0200 Message-Id: <1410703015-24127-1-git-send-email-fabf@skynet.be> X-Mailer: git-send-email 1.9.1 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Use container_of instead of casting first structure member. Signed-off-by: Fabian Frederick --- Compiled but untested. drivers/gpio/gpio-cs5535.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-cs5535.c b/drivers/gpio/gpio-cs5535.c index 92ec58f..668127f 100644 --- a/drivers/gpio/gpio-cs5535.c +++ b/drivers/gpio/gpio-cs5535.c @@ -201,7 +201,8 @@ EXPORT_SYMBOL_GPL(cs5535_gpio_setup_event); static int chip_gpio_request(struct gpio_chip *c, unsigned offset) { - struct cs5535_gpio_chip *chip = (struct cs5535_gpio_chip *) c; + struct cs5535_gpio_chip *chip = + container_of(c, struct cs5535_gpio_chip, chip); unsigned long flags; spin_lock_irqsave(&chip->lock, flags); @@ -241,7 +242,8 @@ static void chip_gpio_set(struct gpio_chip *chip, unsigned offset, int val) static int chip_direction_input(struct gpio_chip *c, unsigned offset) { - struct cs5535_gpio_chip *chip = (struct cs5535_gpio_chip *) c; + struct cs5535_gpio_chip *chip = + container_of(c, struct cs5535_gpio_chip, chip); unsigned long flags; spin_lock_irqsave(&chip->lock, flags); @@ -254,7 +256,8 @@ static int chip_direction_input(struct gpio_chip *c, unsigned offset) static int chip_direction_output(struct gpio_chip *c, unsigned offset, int val) { - struct cs5535_gpio_chip *chip = (struct cs5535_gpio_chip *) c; + struct cs5535_gpio_chip *chip = + container_of(c, struct cs5535_gpio_chip, chip); unsigned long flags; spin_lock_irqsave(&chip->lock, flags);