diff mbox

[13/20] regmap: regmap max_raw_io getter function

Message ID 1439374365-20623-14-git-send-email-mpa@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Markus Pargmann Aug. 12, 2015, 10:12 a.m. UTC
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 drivers/base/regmap/regmap.c | 22 ++++++++++++++++++++++
 include/linux/regmap.h       |  2 ++
 2 files changed, 24 insertions(+)

Comments

Mark Brown Aug. 12, 2015, 11:51 a.m. UTC | #1
On Wed, Aug 12, 2015 at 12:12:38PM +0200, Markus Pargmann wrote:
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>

Your changelog doesn't mention why anything would reasonably want to use
this and...

> +size_t regmap_get_raw_io_max(struct regmap *map)
> +{
> +	return map->max_raw_io;
> +}
> +EXPORT_SYMBOL_GPL(regmap_get_raw_io_max);
> +
> +/**
> + * regmap_get_raw_read_max - Get the maximum size we can read
> + *
> + * @map: Map to check.
> + */

...it is adding two functions which don't seem very symmetrically named.

> @@ -441,6 +441,8 @@ int regmap_get_max_register(struct regmap *map);
>  int regmap_get_reg_stride(struct regmap *map);
>  int regmap_async_complete(struct regmap *map);
>  bool regmap_can_raw_write(struct regmap *map);
> +size_t regmap_get_raw_write_max(struct regmap *map);
> +size_t regmap_get_raw_io_max(struct regmap *map);

Do we want stubs here?
Markus Pargmann Aug. 12, 2015, 12:51 p.m. UTC | #2
On Wed, Aug 12, 2015 at 12:51:36PM +0100, Mark Brown wrote:
> On Wed, Aug 12, 2015 at 12:12:38PM +0200, Markus Pargmann wrote:
> > Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> 
> Your changelog doesn't mention why anything would reasonably want to use
> this and...

Right, this is used later in the driver code of bmc150 to find out how
much we can read from the sensor in one run.

> 
> > +size_t regmap_get_raw_io_max(struct regmap *map)
> > +{
> > +	return map->max_raw_io;
> > +}
> > +EXPORT_SYMBOL_GPL(regmap_get_raw_io_max);
> > +
> > +/**
> > + * regmap_get_raw_read_max - Get the maximum size we can read
> > + *
> > + * @map: Map to check.
> > + */
> 
> ...it is adding two functions which don't seem very symmetrically named.

Oh, this is half of my previous version where raw_read_max and
raw_write_max where separate. Will fix it along with your comment that
these should be different values for read and write.

Thanks,

Markus

> 
> > @@ -441,6 +441,8 @@ int regmap_get_max_register(struct regmap *map);
> >  int regmap_get_reg_stride(struct regmap *map);
> >  int regmap_async_complete(struct regmap *map);
> >  bool regmap_can_raw_write(struct regmap *map);
> > +size_t regmap_get_raw_write_max(struct regmap *map);
> > +size_t regmap_get_raw_io_max(struct regmap *map);
> 
> Do we want stubs here?
diff mbox

Patch

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 6ad4ca849055..8c2be516a100 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1393,6 +1393,28 @@  bool regmap_can_raw_write(struct regmap *map)
 }
 EXPORT_SYMBOL_GPL(regmap_can_raw_write);
 
+/**
+ * regmap_get_raw_io_max - Get the maximum size we can read/write
+ *
+ * @map: Map to check.
+ */
+size_t regmap_get_raw_io_max(struct regmap *map)
+{
+	return map->max_raw_io;
+}
+EXPORT_SYMBOL_GPL(regmap_get_raw_io_max);
+
+/**
+ * regmap_get_raw_read_max - Get the maximum size we can read
+ *
+ * @map: Map to check.
+ */
+size_t regmap_get_raw_read_max(struct regmap *map)
+{
+	return map->max_raw_io;
+}
+EXPORT_SYMBOL_GPL(regmap_get_raw_read_max);
+
 static int _regmap_bus_formatted_write(void *context, unsigned int reg,
 				       unsigned int val)
 {
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 2cb62d141761..b236f884f642 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -441,6 +441,8 @@  int regmap_get_max_register(struct regmap *map);
 int regmap_get_reg_stride(struct regmap *map);
 int regmap_async_complete(struct regmap *map);
 bool regmap_can_raw_write(struct regmap *map);
+size_t regmap_get_raw_write_max(struct regmap *map);
+size_t regmap_get_raw_io_max(struct regmap *map);
 
 int regcache_sync(struct regmap *map);
 int regcache_sync_region(struct regmap *map, unsigned int min,