* [PATCH 2/3] regmap: Remove redundant owner field from the bus type struct
2011-09-05 17:54 [PATCH 1/3] regmap: Remove bitrotted module_put()s Mark Brown
@ 2011-09-05 17:54 ` Mark Brown
2011-09-05 17:54 ` [PATCH 3/3] regmap: Include the last register in debugfs output Mark Brown
2011-09-05 21:03 ` [PATCH 1/3] regmap: Remove bitrotted module_put()s J.I. Cameron
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2011-09-05 17:54 UTC (permalink / raw)
To: linux-kernel; +Cc: Jonathan Cameron, patches, Mark Brown
No longer used as users link directly with the bus types so the core
module infrastructure does refcounting for us.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/base/regmap/regmap-i2c.c | 1 -
drivers/base/regmap/regmap-spi.c | 1 -
include/linux/regmap.h | 3 ---
3 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/drivers/base/regmap/regmap-i2c.c b/drivers/base/regmap/regmap-i2c.c
index e7d916d..38621ec 100644
--- a/drivers/base/regmap/regmap-i2c.c
+++ b/drivers/base/regmap/regmap-i2c.c
@@ -93,7 +93,6 @@ static struct regmap_bus regmap_i2c = {
.write = regmap_i2c_write,
.gather_write = regmap_i2c_gather_write,
.read = regmap_i2c_read,
- .owner = THIS_MODULE,
};
/**
diff --git a/drivers/base/regmap/regmap-spi.c b/drivers/base/regmap/regmap-spi.c
index fe831e3..2560658 100644
--- a/drivers/base/regmap/regmap-spi.c
+++ b/drivers/base/regmap/regmap-spi.c
@@ -51,7 +51,6 @@ static struct regmap_bus regmap_spi = {
.write = regmap_spi_write,
.gather_write = regmap_spi_gather_write,
.read = regmap_spi_read,
- .owner = THIS_MODULE,
.read_flag_mask = 0x80,
};
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 449e264..9438a89e 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -85,8 +85,6 @@ typedef int (*regmap_hw_read)(struct device *dev,
* if not implemented on a given device.
* @read: Read operation. Data is returned in the buffer used to transmit
* data.
- * @owner: Module with the bus implementation, used to pin the implementation
- * in memory.
* @read_flag_mask: Mask to be set in the top byte of the register when doing
* a read.
*/
@@ -94,7 +92,6 @@ struct regmap_bus {
regmap_hw_write write;
regmap_hw_gather_write gather_write;
regmap_hw_read read;
- struct module *owner;
u8 read_flag_mask;
};
--
1.7.5.4
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 3/3] regmap: Include the last register in debugfs output
2011-09-05 17:54 [PATCH 1/3] regmap: Remove bitrotted module_put()s Mark Brown
2011-09-05 17:54 ` [PATCH 2/3] regmap: Remove redundant owner field from the bus type struct Mark Brown
@ 2011-09-05 17:54 ` Mark Brown
2011-09-05 21:03 ` [PATCH 1/3] regmap: Remove bitrotted module_put()s J.I. Cameron
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2011-09-05 17:54 UTC (permalink / raw)
To: linux-kernel; +Cc: Jonathan Cameron, patches, Mark Brown
Off by one in the array iteration.
Reported-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/base/regmap/regmap-debugfs.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 7a8d675..6f39747 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -57,7 +57,7 @@ static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf,
val_len = 2 * map->format.val_bytes;
tot_len = reg_len + val_len + 3; /* : \n */
- for (i = 0; i < map->max_register; i++) {
+ for (i = 0; i < map->max_register + 1; i++) {
if (!regmap_readable(map, i))
continue;
@@ -132,7 +132,7 @@ static ssize_t regmap_access_read_file(struct file *file,
reg_len = regmap_calc_reg_len(map->max_register, buf, count);
tot_len = reg_len + 10; /* ': R W V P\n' */
- for (i = 0; i < map->max_register; i++) {
+ for (i = 0; i < map->max_register + 1; i++) {
/* Ignore registers which are neither readable nor writable */
if (!regmap_readable(map, i) && !regmap_writeable(map, i))
continue;
--
1.7.5.4
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 1/3] regmap: Remove bitrotted module_put()s
2011-09-05 17:54 [PATCH 1/3] regmap: Remove bitrotted module_put()s Mark Brown
2011-09-05 17:54 ` [PATCH 2/3] regmap: Remove redundant owner field from the bus type struct Mark Brown
2011-09-05 17:54 ` [PATCH 3/3] regmap: Include the last register in debugfs output Mark Brown
@ 2011-09-05 21:03 ` J.I. Cameron
2 siblings, 0 replies; 4+ messages in thread
From: J.I. Cameron @ 2011-09-05 21:03 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel, patches
On Sep 5 2011, Mark Brown wrote:
>The conversion to per bus type registration functions means we don't need
>to do module_get()s to hold the bus types in memory (their users will link
>to them) so we removed all those calls. This left module_put() calls in
>the cleanup paths which aren't needed and which cause unbalanced puts if
>we ever try to unload anything.
>
Thanks Mark, all three look good to me. Thanks also for your comments
on my driver changes, I'll clean it up and repost tomorrow.
>Reported-by: Jonathan Cameron <jic23@cam.ac.uk>
>Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> drivers/base/regmap/regmap.c | 5 +----
> 1 files changed, 1 insertions(+), 4 deletions(-)
>
>diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
>index fa2bd89..86b1847 100644
>--- a/drivers/base/regmap/regmap.c
>+++ b/drivers/base/regmap/regmap.c
>@@ -198,15 +198,13 @@ struct regmap *regmap_init(struct device *dev,
> map->work_buf = kmalloc(map->format.buf_size, GFP_KERNEL);
> if (map->work_buf == NULL) {
> ret = -ENOMEM;
>- goto err_bus;
>+ goto err_map;
> }
>
> regmap_debugfs_init(map);
>
> return map;
>
>-err_bus:
>- module_put(map->bus->owner);
> err_map:
> kfree(map);
> err:
>@@ -221,7 +219,6 @@ void regmap_exit(struct regmap *map)
> {
> regmap_debugfs_exit(map);
> kfree(map->work_buf);
>- module_put(map->bus->owner);
> kfree(map);
> }
> EXPORT_SYMBOL_GPL(regmap_exit);
>
^ permalink raw reply [flat|nested] 4+ messages in thread