Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2993810AbbEOXoR (ORCPT ); Fri, 15 May 2015 19:44:17 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43089 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1946316AbbEOXKi (ORCPT ); Fri, 15 May 2015 19:10:38 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Linus Walleij Subject: [PATCH 3.10 05/17] gpio: unregister gpiochip device before removing it Date: Fri, 15 May 2015 16:10:13 -0700 Message-Id: <20150515231005.060881656@linuxfoundation.org> X-Mailer: git-send-email 2.4.0 In-Reply-To: <20150515231004.395424105@linuxfoundation.org> References: <20150515231004.395424105@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1326 Lines: 48 3.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 01cca93a9491ed95992523ff7e79dd9bfcdea8e0 upstream. Unregister gpiochip device (used to export information through sysfs) before removing it internally. This way removal will reverse addition. Signed-off-by: Johan Hovold Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpiolib.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1265,6 +1265,8 @@ int gpiochip_remove(struct gpio_chip *ch int status = 0; unsigned id; + gpiochip_unexport(chip); + spin_lock_irqsave(&gpio_lock, flags); gpiochip_remove_pin_ranges(chip); @@ -1285,9 +1287,6 @@ int gpiochip_remove(struct gpio_chip *ch spin_unlock_irqrestore(&gpio_lock, flags); - if (status == 0) - gpiochip_unexport(chip); - return status; } EXPORT_SYMBOL_GPL(gpiochip_remove); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/