Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1222684

Re: cpufreq: mediatek: allow modular build

From Russell King - ARM Linux <linux@arm.linux.org.uk>
Newsgroups linux.kernel
Subject Re: cpufreq: mediatek: allow modular build
Date 2015-09-11 12:20 +0200
Message-ID <q7tB0-71O-7@gated-at.bofh.it> (permalink)
References (4 earlier) <q7s2e-4Hu-15@gated-at.bofh.it> <q7sYi-63o-15@gated-at.bofh.it> <q7t7Y-6eG-19@gated-at.bofh.it> <q7thE-6pR-23@gated-at.bofh.it> <q7trk-6Qv-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Sep 11, 2015 at 03:39:16PM +0530, Viresh Kumar wrote:
> On 11-09-15, 10:58, Russell King - ARM Linux wrote:
> > Not module "unplug" (I've never heard it called that before).  A module
> > with a module_init() but no module_exit() can only be added to a running
> > kernel, and never removed.  That's intentional behaviour.
> 
> Ah, I see. I wasn't sure that a module with no module_exit() can't be
> removed.

Yes, but it's not that simple.

A module with no module_init() and no module_exit() is what's called a
library module, which can be inserted, and later removed provided no
other module depends on anything the library module exports.

A module with a module_init() but no module_exit() is one which can be
inserted, but never removed.

A module with a module_init() and a module_exit() can be inserted, and
later removed in much the same way as the library module mentioned above.

See kernel/module.c:

        /* If it has an init func, it must have an exit func to unload */
        if (mod->init && !mod->exit) {
                forced = try_force_unload(flags);
                if (!forced) {
                        /* This module can't be removed */
                        ret = -EBUSY;
                        goto out;
                }
        }

and

        if (mod->init != NULL && mod->exit == NULL) {
                printed_something = 1;
                seq_puts(m, "[permanent],");
        }


-- 
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

cpufreq: mediatek: allow modular build Arnd Bergmann <arnd@arndb.de> - 2015-09-11 10:20 +0200
  Re: cpufreq: mediatek: allow modular build Viresh Kumar <viresh.kumar@linaro.org> - 2015-09-11 10:20 +0200
    Re: cpufreq: mediatek: allow modular build Viresh Kumar <viresh.kumar@linaro.org> - 2015-09-11 10:30 +0200
      Re: cpufreq: mediatek: allow modular build Arnd Bergmann <arnd@arndb.de> - 2015-09-11 10:40 +0200
        Re: cpufreq: mediatek: allow modular build Viresh Kumar <viresh.kumar@linaro.org> - 2015-09-11 10:40 +0200
          Re: cpufreq: mediatek: allow modular build Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-09-11 11:40 +0200
            Re: cpufreq: mediatek: allow modular build Viresh Kumar <viresh.kumar@linaro.org> - 2015-09-11 11:50 +0200
              Re: cpufreq: mediatek: allow modular build Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-09-11 12:00 +0200
                Re: cpufreq: mediatek: allow modular build Viresh Kumar <viresh.kumar@linaro.org> - 2015-09-11 12:10 +0200
                Re: cpufreq: mediatek: allow modular build Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-09-11 12:20 +0200
                Re: cpufreq: mediatek: allow modular build Viresh Kumar <viresh.kumar@linaro.org> - 2015-09-11 12:20 +0200
    Re: cpufreq: mediatek: allow modular build Arnd Bergmann <arnd@arndb.de> - 2015-09-11 10:30 +0200

csiph-web