All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@kernel.org>
To: Johannes Thumshirn <jthumshirn@suse.de>
Cc: "Pali Rohár" <pali.rohar@gmail.com>,
	"Dmitry Eremin-Solenikov" <dbaryshkov@gmail.com>,
	"David Woodhouse" <dwmw2@infradead.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Tejun Heo" <tj@kernel.org>
Subject: Re: [PATCH] power: Destroy IDRs on module exit
Date: Tue, 14 Jul 2015 12:19:48 +0200	[thread overview]
Message-ID: <20150714101948.GA17240@earth> (raw)
In-Reply-To: <1436865374-22027-1-git-send-email-jthumshirn@suse.de>

[-- Attachment #1: Type: text/plain, Size: 831 bytes --]

[+CC: Tejun Heo <tj@kernel.org>, for being very active in lib/idr.c]

Hi,

On Tue, Jul 14, 2015 at 11:16:14AM +0200, Johannes Thumshirn wrote:
> Destroy IDRs on module exit, freeing the resources for
> * bq2415x_charger.c
> * ds2782_battery.c
> * ltc2941-battery-gauge.c

You missed bq27x00_battery.c. Maybe a coccinelle script should be
written?

> The drivers had to be converted to "ordinary" module_init()/module_exit()
> style drivers instead of using module_i2c_driver.

mh I would prefer another solution. How about adding something
like this:

static void idr_remove_and_destroy(struct idr *idp, int id)
{
    idr_remove(idp, id);
    if (idr_is_empty(idp)
        idr_destroy(idp);
}

If that is called by the drivers instead of idr_remove(), there
should be no need for adding idr_destroy to module_exit().

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2015-07-14 10:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14  9:16 [PATCH] power: Destroy IDRs on module exit Johannes Thumshirn
2015-07-14  9:17 ` Oliver Neukum
2015-07-14  9:20 ` Pali Rohár
2015-07-14 10:19 ` Sebastian Reichel [this message]
2015-07-14 10:48   ` Johannes Thumshirn
2015-07-14 12:14     ` Sebastian Reichel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150714101948.GA17240@earth \
    --to=sre@kernel.org \
    --cc=dbaryshkov@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=jthumshirn@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.