From patchwork Wed Dec 9 13:46:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58114 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp678567lbb; Wed, 9 Dec 2015 05:46:16 -0800 (PST) X-Received: by 10.66.216.7 with SMTP id om7mr7980853pac.90.1449668776791; Wed, 09 Dec 2015 05:46:16 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 18si12844963pfm.219.2015.12.09.05.46.16 for ; Wed, 09 Dec 2015 05:46:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-leds-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-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-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 S1754710AbbLINqQ (ORCPT ); Wed, 9 Dec 2015 08:46:16 -0500 Received: from mail-lb0-f170.google.com ([209.85.217.170]:33753 "EHLO mail-lb0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753083AbbLINqP (ORCPT ); Wed, 9 Dec 2015 08:46:15 -0500 Received: by lbbkw15 with SMTP id kw15so30279363lbb.0 for ; Wed, 09 Dec 2015 05:46:13 -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=Xzl11dLVQiKsl09/Wq1IA86O//wTyLTwZEioxAlzw4Y=; b=hPqwFPNovPNTo0KULiEA2nXW9zYWLu66L4y6XFNYrthDKNzbwMevv5LJgScvOySu3X VC1zjQP248dLI5FA0SO7WFQAaPWUIn9/xTSEu2fMJErNIm3Kht2Fu7KQS55UDVsk071x WVsIplEZTLwfIxU3r405j38RaDKUS7f/Y6PSyGBWyREpMkedJrhkXJWr9TVod/HvBtYK 4V8zLugkTjPVOU1kfa93Gryjp/IKusXPouH4+V2iVqIabX4VPpJ/B0/NxwLqsehJrc+O 0R/H5o3j1o930BboX6ZoMnTOq5O1orJl6Rmi5CfsFkMaoxU6il8WaeZ+kedmoX+OfykH e3cg== 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=Xzl11dLVQiKsl09/Wq1IA86O//wTyLTwZEioxAlzw4Y=; b=B/3NEMvv/STCKgUc7IPkeprsUoB+nMBocA9o5OcsvAjFhhIX4w+2HMpQEHeAzh7SAU Lj6F9sBizXRRLnH3v42pYH5LGOKpgQ4yCR/nNA9sS4Kngm33Wh8tSYd3gOWplQ9xB3cH 9hjGC/1/N1rvZsIiSQCrNr6Kg4NR8mkmUQv4PT5+W+cmLB4EgicRX/l1Qp6ztt+XctJ3 24V0oT4pNXCyxjb9tRvUCQRUXUIYd56vkKca8+mDzEpsKlY7aaXXIMFPJVArCG9DrbN+ ObR9P6O+Q4aKvD1KL3tHvRxlbNEOA+wRpAibbkCWNHdWo9NcKD27qNo6QulYL/CLFUKk NW6Q== X-Gm-Message-State: ALoCoQnvQP2kSjQaqvkVEl2AKXpPzS9ysifBrYQc8yGyO9mTr53EqE6zW0dhjQYZV8WS27WhAgx1uwyWuLZetodwlfLygOrb0Q== X-Received: by 10.112.202.101 with SMTP id kh5mr2407834lbc.66.1449668773843; Wed, 09 Dec 2015 05:46:13 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id qr6sm1402982lbb.19.2015.12.09.05.46.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:46:13 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , Riku Voipio , Richard Purdie , Jacek Anaszewski Cc: Linus Walleij , linux-leds@vger.kernel.org Subject: [PATCH 158/182] leds: pca9532: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:46:10 +0100 Message-Id: <1449668770-5933-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@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: Riku Voipio Cc: Richard Purdie Cc: Jacek Anaszewski Cc: linux-leds@vger.kernel.org Signed-off-by: Linus Walleij --- LEDS people: please ACK this so I can merge it in the GPIO tree. --- drivers/leds/leds-pca9532.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-leds" 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/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c index a975b32ee8c8..1b228adfd1a7 100644 --- a/drivers/leds/leds-pca9532.c +++ b/drivers/leds/leds-pca9532.c @@ -245,7 +245,7 @@ static void pca9532_led_work(struct work_struct *work) #ifdef CONFIG_LEDS_PCA9532_GPIO static int pca9532_gpio_request_pin(struct gpio_chip *gc, unsigned offset) { - struct pca9532_data *data = container_of(gc, struct pca9532_data, gpio); + struct pca9532_data *data = gpiochip_get_data(gc); struct pca9532_led *led = &data->leds[offset]; if (led->type == PCA9532_TYPE_GPIO) @@ -256,7 +256,7 @@ static int pca9532_gpio_request_pin(struct gpio_chip *gc, unsigned offset) static void pca9532_gpio_set_value(struct gpio_chip *gc, unsigned offset, int val) { - struct pca9532_data *data = container_of(gc, struct pca9532_data, gpio); + struct pca9532_data *data = gpiochip_get_data(gc); struct pca9532_led *led = &data->leds[offset]; if (val) @@ -269,7 +269,7 @@ static void pca9532_gpio_set_value(struct gpio_chip *gc, unsigned offset, int va static int pca9532_gpio_get_value(struct gpio_chip *gc, unsigned offset) { - struct pca9532_data *data = container_of(gc, struct pca9532_data, gpio); + struct pca9532_data *data = gpiochip_get_data(gc); unsigned char reg; reg = i2c_smbus_read_byte_data(data->client, PCA9532_REG_INPUT(offset)); @@ -416,7 +416,7 @@ static int pca9532_configure(struct i2c_client *client, data->gpio.parent = &client->dev; data->gpio.owner = THIS_MODULE; - err = gpiochip_add(&data->gpio); + err = gpiochip_add_data(&data->gpio, data); if (err) { /* Use data->gpio.dev as a flag for freeing gpiochip */ data->gpio.parent = NULL;