From patchwork Sat Dec 21 10:49:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rashika Kheria X-Patchwork-Id: 304407 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 801CB2C00A7 for ; Sat, 21 Dec 2013 21:50:05 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751651Ab3LUKte (ORCPT ); Sat, 21 Dec 2013 05:49:34 -0500 Received: from mail-pd0-f181.google.com ([209.85.192.181]:59488 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751291Ab3LUKtc (ORCPT ); Sat, 21 Dec 2013 05:49:32 -0500 Received: by mail-pd0-f181.google.com with SMTP id p10so3486097pdj.26 for ; Sat, 21 Dec 2013 02:49:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=oIYKkK7xmzc/Ok3qpwn2Y5v0ItDoFCaYckxxFTm1ZFg=; b=aXbZvX/QRvNKyDZQgUjgirMddIH5duAmn3/jIorNg7yhmp/mw+o+UaLbcZ6IxLjgZc JYL0rb7gkM8zyTS1Fr0paLDLCb91gdaOrojl5mlg4R8PEJQg1Rz86z7TVlPhOzAgKEia 7b/4vAURotQwO7IWqFYGFC+WAWrLgVWh1p42QOgnZA2gYssiyg2ahaybkWc8UVnraHxd R5T++9E9ft1G/g+rE2/Cx9VXhIDMk0YqRIeyjS/rF1//LURBUPbLLqjeVL9jCv7TpNrb ftugEopXCNBL+Tld2PMYBbhdyazxekrIm5Y2j0rLadvxWOKrzdvYuKov9VfJj1hoOypK c09g== X-Received: by 10.68.198.68 with SMTP id ja4mr14273500pbc.24.1387622970338; Sat, 21 Dec 2013 02:49:30 -0800 (PST) Received: from rashika ([14.98.10.27]) by mx.google.com with ESMTPSA id jn12sm20400094pbd.37.2013.12.21.02.49.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 21 Dec 2013 02:49:29 -0800 (PST) Date: Sat, 21 Dec 2013 16:19:20 +0530 From: Rashika Kheria To: linux-kernel@vger.kernel.org Cc: Linus Walleij , Kishon Vijay Abraham I , Thierry Reding , Alexandre Courbot , linux-gpio@vger.kernel.org, linux-pwm@vger.kernel.org, josh@joshtriplett.org Subject: [PATCH] drivers: Remove unused devm_*_put functions Message-ID: <20131221104920.GA3626@rashika> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pwm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pwm@vger.kernel.org Remove unused devm_*_put functions because none of them are used anywhere in the kernel and devm does automatic cleanup of resources and requires no manual cleanup. Signed-off-by: Rashika Kheria Reviewed-by: Josh Triplett --- drivers/gpio/devres.c | 25 ------------------------- drivers/phy/phy-core.c | 17 ----------------- drivers/pwm/core.c | 15 --------------- include/linux/gpio/consumer.h | 9 --------- include/linux/phy/phy.h | 5 ----- include/linux/pwm.h | 5 ----- 6 files changed, 76 deletions(-) diff --git a/drivers/gpio/devres.c b/drivers/gpio/devres.c index 307464f..07ecca3 100644 --- a/drivers/gpio/devres.c +++ b/drivers/gpio/devres.c @@ -28,13 +28,6 @@ static void devm_gpiod_release(struct device *dev, void *res) gpiod_put(*desc); } -static int devm_gpiod_match(struct device *dev, void *res, void *data) -{ - struct gpio_desc **this = res, **gpio = data; - - return *this == *gpio; -} - /** * devm_gpiod_get - Resource-managed gpiod_get() * @dev: GPIO consumer @@ -86,24 +79,6 @@ struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, } EXPORT_SYMBOL(devm_gpiod_get_index); -/** - * devm_gpiod_put - Resource-managed gpiod_put() - * @desc: GPIO descriptor to dispose of - * - * Dispose of a GPIO descriptor obtained with devm_gpiod_get() or - * devm_gpiod_get_index(). Normally this function will not be called as the GPIO - * will be disposed of by the resource management code. - */ -void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) -{ - WARN_ON(devres_release(dev, devm_gpiod_release, devm_gpiod_match, - &desc)); -} -EXPORT_SYMBOL(devm_gpiod_put); - - - - static void devm_gpio_release(struct device *dev, void *res) { unsigned *gpio = res; diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 03cf8fb..913643f 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -299,23 +299,6 @@ void phy_put(struct phy *phy) EXPORT_SYMBOL_GPL(phy_put); /** - * devm_phy_put() - release the PHY - * @dev: device that wants to release this phy - * @phy: the phy returned by devm_phy_get() - * - * destroys the devres associated with this phy and invokes phy_put - * to release the phy. - */ -void devm_phy_put(struct device *dev, struct phy *phy) -{ - int r; - - r = devres_destroy(dev, devm_phy_release, devm_phy_match, phy); - dev_WARN_ONCE(dev, r, "couldn't find PHY resource\n"); -} -EXPORT_SYMBOL_GPL(devm_phy_put); - -/** * of_phy_simple_xlate() - returns the phy instance from phy provider * @dev: the PHY provider device * @args: of_phandle_args (not used here) diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 2ca9504..c503b88e 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -771,21 +771,6 @@ static int devm_pwm_match(struct device *dev, void *res, void *data) } /** - * devm_pwm_put() - resource managed pwm_put() - * @dev: device for PWM consumer - * @pwm: PWM device - * - * Release a PWM previously allocated using devm_pwm_get(). Calling this - * function is usually not needed because devm-allocated resources are - * automatically released on driver detach. - */ -void devm_pwm_put(struct device *dev, struct pwm_device *pwm) -{ - WARN_ON(devres_release(dev, devm_pwm_release, devm_pwm_match, pwm)); -} -EXPORT_SYMBOL_GPL(devm_pwm_put); - -/** * pwm_can_sleep() - report whether PWM access will sleep * @pwm: PWM device * diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index 4d34dbb..70862f7 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -31,7 +31,6 @@ struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, const char *con_id, unsigned int idx); -void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); int gpiod_get_direction(const struct gpio_desc *desc); int gpiod_direction_input(struct gpio_desc *desc); @@ -94,14 +93,6 @@ struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, { return ERR_PTR(-ENOSYS); } -static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) -{ - might_sleep(); - - /* GPIO can never have been requested */ - WARN_ON(1); -} - static inline int gpiod_get_direction(const struct gpio_desc *desc) { diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 6d72269..129bac7 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -130,7 +130,6 @@ int phy_power_off(struct phy *phy); struct phy *phy_get(struct device *dev, const char *string); struct phy *devm_phy_get(struct device *dev, const char *string); void phy_put(struct phy *phy); -void devm_phy_put(struct device *dev, struct phy *phy); struct phy *of_phy_simple_xlate(struct device *dev, struct of_phandle_args *args); struct phy *phy_create(struct device *dev, const struct phy_ops *ops, @@ -213,10 +212,6 @@ static inline void phy_put(struct phy *phy) { } -static inline void devm_phy_put(struct device *dev, struct phy *phy) -{ -} - static inline struct phy *of_phy_simple_xlate(struct device *dev, struct of_phandle_args *args) { diff --git a/include/linux/pwm.h b/include/linux/pwm.h index f0feafd..10ec30a 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -198,7 +198,6 @@ void pwm_put(struct pwm_device *pwm); struct pwm_device *devm_pwm_get(struct device *dev, const char *con_id); struct pwm_device *devm_of_pwm_get(struct device *dev, struct device_node *np, const char *con_id); -void devm_pwm_put(struct device *dev, struct pwm_device *pwm); bool pwm_can_sleep(struct pwm_device *pwm); #else @@ -258,10 +257,6 @@ static inline struct pwm_device *devm_of_pwm_get(struct device *dev, return ERR_PTR(-ENODEV); } -static inline void devm_pwm_put(struct device *dev, struct pwm_device *pwm) -{ -} - static inline bool pwm_can_sleep(struct pwm_device *pwm) { return false;