From patchwork Tue Jul 14 09:16:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 6784611 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 165529F2E8 for ; Tue, 14 Jul 2015 09:16:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 29B06207AF for ; Tue, 14 Jul 2015 09:16:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0B630207AA for ; Tue, 14 Jul 2015 09:16:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752675AbbGNJQa (ORCPT ); Tue, 14 Jul 2015 05:16:30 -0400 Received: from cantor2.suse.de ([195.135.220.15]:41921 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751994AbbGNJQ3 (ORCPT ); Tue, 14 Jul 2015 05:16:29 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 93BECABA5; Tue, 14 Jul 2015 09:16:27 +0000 (UTC) From: Johannes Thumshirn To: =?UTF-8?q?Pali=20Roh=C3=A1r?= , Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn Subject: [PATCH] power: Destroy IDRs on module exit Date: Tue, 14 Jul 2015 11:16:14 +0200 Message-Id: <1436865374-22027-1-git-send-email-jthumshirn@suse.de> X-Mailer: git-send-email 2.4.5 MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Destroy IDRs on module exit, freeing the resources for * bq2415x_charger.c * ds2782_battery.c * ltc2941-battery-gauge.c The drivers had to be converted to "ordinary" module_init()/module_exit() style drivers instead of using module_i2c_driver. Signed-off-by: Johannes Thumshirn --- drivers/power/bq2415x_charger.c | 20 +++++++++++++++++++- drivers/power/ds2782_battery.c | 20 +++++++++++++++++++- drivers/power/ltc2941-battery-gauge.c | 20 +++++++++++++++++++- 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c index e98dcb6..38f4208 100644 --- a/drivers/power/bq2415x_charger.c +++ b/drivers/power/bq2415x_charger.c @@ -1773,7 +1773,25 @@ static struct i2c_driver bq2415x_driver = { .remove = bq2415x_remove, .id_table = bq2415x_i2c_id_table, }; -module_i2c_driver(bq2415x_driver); + +static int __init bq2415x_init(void) +{ + int ret; + + ret = i2c_add_driver(&bq2415x_driver); + if (ret) + printk(KERN_ERR "Unable to register bq2415x-battery driver\n"); + + return ret; +} +module_init(bq2415x_init); + +static void __exit bq2415x_exit(void) +{ + i2c_del_driver(&bq2415x_driver); + idr_destroy(&bq2415x_id); +} +module_exit(bq2415x_exit); MODULE_AUTHOR("Pali Rohár "); MODULE_DESCRIPTION("bq2415x charger driver"); diff --git a/drivers/power/ds2782_battery.c b/drivers/power/ds2782_battery.c index ed4d756..410bc9d 100644 --- a/drivers/power/ds2782_battery.c +++ b/drivers/power/ds2782_battery.c @@ -468,7 +468,25 @@ static struct i2c_driver ds278x_battery_driver = { .remove = ds278x_battery_remove, .id_table = ds278x_id, }; -module_i2c_driver(ds278x_battery_driver); + +static int __init ds2782_init(void) +{ + int ret; + + ret = i2c_add_driver(&ds278x_battery_driver); + if (ret) + printk(KERN_ERR "Unable to register ds2782-battery driver\n"); + + return ret; +} +module_init(ds2782_init); + +static void __exit ds2782_exit(void) +{ + i2c_del_driver(&ds278x_battery_driver); + idr_destroy(&battery_id); +} +module_exit(ds2782_exit); MODULE_AUTHOR("Ryan Mallon"); MODULE_DESCRIPTION("Maxim/Dallas DS2782 Stand-Alone Fuel Gauage IC driver"); diff --git a/drivers/power/ltc2941-battery-gauge.c b/drivers/power/ltc2941-battery-gauge.c index daeb086..6fbbcd2 100644 --- a/drivers/power/ltc2941-battery-gauge.c +++ b/drivers/power/ltc2941-battery-gauge.c @@ -544,7 +544,25 @@ static struct i2c_driver ltc294x_driver = { .remove = ltc294x_i2c_remove, .id_table = ltc294x_i2c_id, }; -module_i2c_driver(ltc294x_driver); + +static int __init ltc294x_init(void) +{ + int ret; + + ret = i2c_add_driver(<c294x_driver); + if (ret) + printk(KERN_ERR "Unable to register bq2415x-battery driver\n"); + + return ret; +} +module_init(ltc294x_init); + +static void __exit ltc294x_exit(void) +{ + i2c_del_driver(<c294x_driver); + idr_destroy(<c294x_id); +} +module_exit(ltc294x_exit); MODULE_AUTHOR("Auryn Verwegen, Topic Embedded Systems"); MODULE_AUTHOR("Mike Looijmans, Topic Embedded Products");