From patchwork Mon May 4 15:10:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 467646 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 667FA140317 for ; Tue, 5 May 2015 01:14:01 +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=eRol7XwC; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751944AbbEDPNz (ORCPT ); Mon, 4 May 2015 11:13:55 -0400 Received: from mail-lb0-f181.google.com ([209.85.217.181]:35371 "EHLO mail-lb0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbbEDPNm (ORCPT ); Mon, 4 May 2015 11:13:42 -0400 Received: by lbbuc2 with SMTP id uc2so107025792lbb.2; Mon, 04 May 2015 08:13:41 -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=31C+phm3+L8tTO4SxS7PbNWcqPSZ9cH5qMX9XAHvZhk=; b=eRol7XwC9MB5SaeNLurx5OYjEs2XUrCp/6oBVNTbUdZuUBJKHdfRe7rdMX9v4e4sL0 GCJkB6527ue0R205Z/f1pnx+pGlfGXTUfsa0kHQX8fLpWeqsbjGRGnXtohH2pgUWynEl NkxUGQTsdgVcHIATAh55+X5eYW6MWU4xmDiH+MynCTLuOXornJB46D5cpIYK4zfym+bn pCpvCpiLgffHMalGJk+B41av/2waPY/Fk/gCGD2ys8AIEDoWEgKkuVaeRLXhByIKGs22 zZcoRKBv+nICxzf5S4WSeV+6yoerv6VQAcm6TJpb6M4jwYaDzU8i0cdrVMsOcyYdreg5 pfcg== X-Received: by 10.112.218.67 with SMTP id pe3mr19060536lbc.53.1430752420959; Mon, 04 May 2015 08:13:40 -0700 (PDT) Received: from xi.terra (c193-14-96-226.cust.tele2.se. [193.14.96.226]) by mx.google.com with ESMTPSA id lf12sm3411946lac.38.2015.05.04.08.13.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 May 2015 08:13:39 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.84) (envelope-from ) id 1YpI3y-00041z-0S; Mon, 04 May 2015 17:13:42 +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 04/23] gpio: sysfs: preparatory clean ups Date: Mon, 4 May 2015 17:10:29 +0200 Message-Id: <1430752248-15401-5-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 Put the recently introduced gpio-chip pointer to some more use in gpiod_export. Signed-off-by: Johan Hovold --- drivers/gpio/gpiolib-sysfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c index b2b62cc6f9e1..658ed28e6d7d 100644 --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c @@ -599,7 +599,7 @@ int gpiod_export(struct gpio_desc *desc, bool direction_may_change) goto fail_unlock; } - if (desc->chip->direction_input && desc->chip->direction_output && + if (chip->direction_input && chip->direction_output && direction_may_change) { set_bit(FLAG_SYSFS_DIR, &desc->flags); } @@ -607,10 +607,10 @@ int gpiod_export(struct gpio_desc *desc, bool direction_may_change) spin_unlock_irqrestore(&gpio_lock, flags); offset = gpio_chip_hwgpio(desc); - if (desc->chip->names && desc->chip->names[offset]) - ioname = desc->chip->names[offset]; + if (chip->names && chip->names[offset]) + ioname = chip->names[offset]; - dev = device_create_with_groups(&gpio_class, desc->chip->dev, + dev = device_create_with_groups(&gpio_class, chip->dev, MKDEV(0, 0), desc, gpio_groups, ioname ? ioname : "gpio%u", desc_to_gpio(desc));