From patchwork Mon May 4 15:10:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 467666 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 ADDB11402D5 for ; Tue, 5 May 2015 01:18:05 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=0MBfRWLZ; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752057AbbEDPSE (ORCPT ); Mon, 4 May 2015 11:18:04 -0400 Received: from mail-la0-f48.google.com ([209.85.215.48]:35690 "EHLO mail-la0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752050AbbEDPNp (ORCPT ); Mon, 4 May 2015 11:13:45 -0400 Received: by labbd9 with SMTP id bd9so106448841lab.2; Mon, 04 May 2015 08:13:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Dw8wCE9Ej3df1/9E6XCeS6XlXqF2ExRhuyrIwSGBQQ8=; b=0MBfRWLZfCK5TE8F45+FNUjY9eOWacVdt2bQDJl50lHMrPcYPdshZej5cnHGP6fT2M 3hIPONM3GvvbVyTYa+f+CtxaPCkMvk0sA0Q81UO2N3ZipVZxi0jKfqae90MmICihvh/z FmfiBAdeCMRVA2tzjRxELRbQB+wqrqtsyyZeDJSZB5ksEm0RPOjbLtIEjGYtZ2vDX+Pj X+AO5a+DajBYtHGmoH0LWBoxfe+OgzObw56eKcA2gsNkVA6WtGJKPi8U2pmv+h3wqTEp QSCK/odsf/C7I5OXwiF7egC4wvVhflH6AGXPSPbAXAsdR0eBvIJ9+645pXP/9dwkKMUm n1dw== X-Received: by 10.112.202.234 with SMTP id kl10mr19836488lbc.51.1430752423740; Mon, 04 May 2015 08:13:43 -0700 (PDT) Received: from xi.terra (c193-14-96-226.cust.tele2.se. [193.14.96.226]) by mx.google.com with ESMTPSA id kf8sm3417164lbc.0.2015.05.04.08.13.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2015 08:13:41 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.84) (envelope-from ) id 1YpI3y-00042i-V3; Mon, 04 May 2015 17:13:43 +0200 From: Johan Hovold To: Linus Walleij Cc: Alexandre Courbot , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH v2 13/23] gpio: sysfs: remove redundant gpio-descriptor parameters Date: Mon, 4 May 2015 17:10:38 +0200 Message-Id: <1430752248-15401-14-git-send-email-johan@kernel.org> X-Mailer: git-send-email 2.0.5 In-Reply-To: <1430752248-15401-1-git-send-email-johan@kernel.org> References: <1430752248-15401-1-git-send-email-johan@kernel.org> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Remove redundant gpio-descriptor parameters from sysfs_set_active_low and gpio_setup_irq. Signed-off-by: Johan Hovold --- drivers/gpio/gpiolib-sysfs.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c index 097e7e539c9d..0bc959fbcf23 100644 --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c @@ -133,9 +133,10 @@ static irqreturn_t gpio_sysfs_irq(int irq, void *priv) return IRQ_HANDLED; } -static int gpio_setup_irq(struct gpio_desc *desc, struct device *dev, - unsigned long gpio_flags) +static int gpio_setup_irq(struct device *dev, unsigned long gpio_flags) { + struct gpiod_data *data = dev_get_drvdata(dev); + struct gpio_desc *desc = data->desc; struct kernfs_node *value_sd; unsigned long irq_flags; int ret, irq, id; @@ -257,8 +258,6 @@ static ssize_t edge_show(struct device *dev, static ssize_t edge_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { - struct gpiod_data *data = dev_get_drvdata(dev); - struct gpio_desc *desc = data->desc; ssize_t status; int i; @@ -270,7 +269,7 @@ static ssize_t edge_store(struct device *dev, found: mutex_lock(&sysfs_lock); - status = gpio_setup_irq(desc, dev, trigger_types[i].flags); + status = gpio_setup_irq(dev, trigger_types[i].flags); if (!status) status = size; @@ -280,9 +279,10 @@ found: } static DEVICE_ATTR_RW(edge); -static int sysfs_set_active_low(struct gpio_desc *desc, struct device *dev, - int value) +static int sysfs_set_active_low(struct device *dev, int value) { + struct gpiod_data *data = dev_get_drvdata(dev); + struct gpio_desc *desc = data->desc; int status = 0; if (!!test_bit(FLAG_ACTIVE_LOW, &desc->flags) == !!value) @@ -298,8 +298,8 @@ static int sysfs_set_active_low(struct gpio_desc *desc, struct device *dev, !!test_bit(FLAG_TRIG_FALL, &desc->flags)) { unsigned long trigger_flags = desc->flags & GPIO_TRIGGER_MASK; - gpio_setup_irq(desc, dev, 0); - status = gpio_setup_irq(desc, dev, trigger_flags); + gpio_setup_irq(dev, 0); + status = gpio_setup_irq(dev, trigger_flags); } return status; @@ -325,8 +325,6 @@ static ssize_t active_low_show(struct device *dev, static ssize_t active_low_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { - struct gpiod_data *data = dev_get_drvdata(dev); - struct gpio_desc *desc = data->desc; ssize_t status; long value; @@ -334,7 +332,7 @@ static ssize_t active_low_store(struct device *dev, status = kstrtol(buf, 0, &value); if (status == 0) - status = sysfs_set_active_low(desc, dev, value != 0); + status = sysfs_set_active_low(dev, value != 0); mutex_unlock(&sysfs_lock); @@ -710,7 +708,7 @@ void gpiod_unexport(struct gpio_desc *desc) * Release irq after deregistration to prevent race with * edge_store. */ - gpio_setup_irq(desc, dev, 0); + gpio_setup_irq(dev, 0); put_device(dev); kfree(data); }