Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1383655 > unrolled thread
| Started by | Paul Gortmaker <paul.gortmaker@windriver.com> |
|---|---|
| First post | 2016-04-20 21:20 +0200 |
| Last post | 2016-04-21 06:30 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] lib: make sg_pool explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-04-20 21:20 +0200
Re: [PATCH] lib: make sg_pool explicitly non-modular Ming Lin <mlin@kernel.org> - 2016-04-20 22:30 +0200
Re: [PATCH] lib: make sg_pool explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-04-21 05:10 +0200
Re: [PATCH] lib: make sg_pool explicitly non-modular Ming Lin <mlin@kernel.org> - 2016-04-21 06:30 +0200
| From | Paul Gortmaker <paul.gortmaker@windriver.com> |
|---|---|
| Date | 2016-04-20 21:20 +0200 |
| Subject | [PATCH] lib: make sg_pool explicitly non-modular |
| Message-ID | <rq5Pk-4mv-7@gated-at.bofh.it> |
The recently added Kconfig controlling compilation of this code is:
lib/Kconfig:config SG_POOL
lib/Kconfig: def_bool n
...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.
Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit. However
one might want to consider moving it to subsys_initcall if it is to
be ready ahead of SCSI drivers wanting this and using device_initcall.
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lin <ming.l@ssi.samsung.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
lib/sg_pool.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/lib/sg_pool.c b/lib/sg_pool.c
index 6dd30615a201..e2cf548b9610 100644
--- a/lib/sg_pool.c
+++ b/lib/sg_pool.c
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/init.h>
#include <linux/scatterlist.h>
#include <linux/mempool.h>
#include <linux/slab.h>
@@ -156,17 +156,4 @@ cleanup_sdb:
return -ENOMEM;
}
-
-static __exit void sg_pool_exit(void)
-{
- int i;
-
- for (i = 0; i < SG_MEMPOOL_NR; i++) {
- struct sg_pool *sgp = sg_pools + i;
- mempool_destroy(sgp->pool);
- kmem_cache_destroy(sgp->slab);
- }
-}
-
-module_init(sg_pool_init);
-module_exit(sg_pool_exit);
+device_initcall(sg_pool_init);
--
2.8.0
[toc] | [next] | [standalone]
| From | Ming Lin <mlin@kernel.org> |
|---|---|
| Date | 2016-04-20 22:30 +0200 |
| Message-ID | <rq6V5-5pd-15@gated-at.bofh.it> |
| In reply to | #1383655 |
On Wed, 2016-04-20 at 15:13 -0400, Paul Gortmaker wrote:
> The recently added Kconfig controlling compilation of this code is:
>
> lib/Kconfig:config SG_POOL
> lib/Kconfig: def_bool n
>
> ...meaning that it currently is not being built as a module by anyone.
>
> Lets remove the modular code that is essentially orphaned, so that
> when reading the driver there is no doubt it is builtin-only.
>
> Since module_init translates to device_initcall in the non-modular
> case, the init ordering remains unchanged with this commit. However
> one might want to consider moving it to subsys_initcall if it is to
> be ready ahead of SCSI drivers wanting this and using device_initcall.
>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Ming Lin <ming.l@ssi.samsung.com>
> Cc: Sagi Grimberg <sagi@grimberg.me>
> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
> lib/sg_pool.c | 17 ++---------------
> 1 file changed, 2 insertions(+), 15 deletions(-)
>
> diff --git a/lib/sg_pool.c b/lib/sg_pool.c
> index 6dd30615a201..e2cf548b9610 100644
> --- a/lib/sg_pool.c
> +++ b/lib/sg_pool.c
> @@ -1,4 +1,4 @@
> -#include <linux/module.h>
> +#include <linux/init.h>
> #include <linux/scatterlist.h>
> #include <linux/mempool.h>
> #include <linux/slab.h>
> @@ -156,17 +156,4 @@ cleanup_sdb:
>
> return -ENOMEM;
> }
> -
> -static __exit void sg_pool_exit(void)
> -{
> - int i;
> -
> - for (i = 0; i < SG_MEMPOOL_NR; i++) {
> - struct sg_pool *sgp = sg_pools + i;
> - mempool_destroy(sgp->pool);
> - kmem_cache_destroy(sgp->slab);
> - }
> -}
> -
> -module_init(sg_pool_init);
> -module_exit(sg_pool_exit);
> +device_initcall(sg_pool_init);
For SCSI it's OK because always CONFIG_SCSI=y
But we may have a kernel .config with !CONFIG_SCSI and other
non-block-device driver may use this sg_pool.
So the .config will have CONFIG_SG_POOL=m
[toc] | [prev] | [next] | [standalone]
| From | Paul Gortmaker <paul.gortmaker@windriver.com> |
|---|---|
| Date | 2016-04-21 05:10 +0200 |
| Message-ID | <rqdaa-23G-15@gated-at.bofh.it> |
| In reply to | #1383726 |
[Re: [PATCH] lib: make sg_pool explicitly non-modular] On 20/04/2016 (Wed 13:28) Ming Lin wrote:
> On Wed, 2016-04-20 at 15:13 -0400, Paul Gortmaker wrote:
> > The recently added Kconfig controlling compilation of this code is:
> >
> > lib/Kconfig:config SG_POOL
> > lib/Kconfig: def_bool n
> >
> > ...meaning that it currently is not being built as a module by anyone.
> >
> > Lets remove the modular code that is essentially orphaned, so that
> > when reading the driver there is no doubt it is builtin-only.
> >
> > Since module_init translates to device_initcall in the non-modular
> > case, the init ordering remains unchanged with this commit. However
> > one might want to consider moving it to subsys_initcall if it is to
> > be ready ahead of SCSI drivers wanting this and using device_initcall.
> >
> > Cc: Christoph Hellwig <hch@lst.de>
> > Cc: Ming Lin <ming.l@ssi.samsung.com>
> > Cc: Sagi Grimberg <sagi@grimberg.me>
> > Cc: Martin K. Petersen <martin.petersen@oracle.com>
> > Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> > ---
> > lib/sg_pool.c | 17 ++---------------
> > 1 file changed, 2 insertions(+), 15 deletions(-)
> >
> > diff --git a/lib/sg_pool.c b/lib/sg_pool.c
> > index 6dd30615a201..e2cf548b9610 100644
> > --- a/lib/sg_pool.c
> > +++ b/lib/sg_pool.c
> > @@ -1,4 +1,4 @@
> > -#include <linux/module.h>
> > +#include <linux/init.h>
> > #include <linux/scatterlist.h>
> > #include <linux/mempool.h>
> > #include <linux/slab.h>
> > @@ -156,17 +156,4 @@ cleanup_sdb:
> >
> > return -ENOMEM;
> > }
> > -
> > -static __exit void sg_pool_exit(void)
> > -{
> > - int i;
> > -
> > - for (i = 0; i < SG_MEMPOOL_NR; i++) {
> > - struct sg_pool *sgp = sg_pools + i;
> > - mempool_destroy(sgp->pool);
> > - kmem_cache_destroy(sgp->slab);
> > - }
> > -}
> > -
> > -module_init(sg_pool_init);
> > -module_exit(sg_pool_exit);
> > +device_initcall(sg_pool_init);
>
> For SCSI it's OK because always CONFIG_SCSI=y
>
> But we may have a kernel .config with !CONFIG_SCSI and other
> non-block-device driver may use this sg_pool.
>
> So the .config will have CONFIG_SG_POOL=m
That is impossible currently, since as per above, the variable is bool
and not tristate. Did you mean to make it tristate?
Paul.
--
>
>
>
>
[toc] | [prev] | [next] | [standalone]
| From | Ming Lin <mlin@kernel.org> |
|---|---|
| Date | 2016-04-21 06:30 +0200 |
| Message-ID | <rqepA-31f-7@gated-at.bofh.it> |
| In reply to | #1383847 |
On Wed, 2016-04-20 at 23:02 -0400, Paul Gortmaker wrote: > > > > > So the .config will have CONFIG_SG_POOL=m > > That is impossible currently, since as per above, the variable is > bool > and not tristate. Did you mean to make it tristate? I didn't notice that. Yes, it should be tristate.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web