Skip to content

Commit 603ac53

Browse files
committed
Merge tag 'regmap-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap
Pull regmap updates from Mark Brown: "A quiet release for regmap: we've seen several cleanups, an update for a change in the MDIO APIs and one small fix" * tag 'regmap-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap: regmap-irq: Remove unused mask_invert flag regmap-irq: Remove unused type_invert flag regmap: Reorder fields in 'struct regmap_bus' to save some memory regmap: apply reg_base and reg_downshift for single register ops
2 parents 064d7dc + 40f4b05 commit 603ac53

File tree

3 files changed

+10
-32
lines changed

3 files changed

+10
-32
lines changed

drivers/base/regmap/regmap-irq.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,8 @@ static void regmap_irq_sync_unlock(struct irq_data *data)
189189
if (!d->type_buf_def[i])
190190
continue;
191191
reg = d->get_irq_reg(d, d->chip->type_base, i);
192-
if (d->chip->type_invert)
193-
ret = regmap_update_bits(d->map, reg,
194-
d->type_buf_def[i], ~d->type_buf[i]);
195-
else
196-
ret = regmap_update_bits(d->map, reg,
197-
d->type_buf_def[i], d->type_buf[i]);
192+
ret = regmap_update_bits(d->map, reg,
193+
d->type_buf_def[i], d->type_buf[i]);
198194
if (ret != 0)
199195
dev_err(d->map->dev, "Failed to sync type in %x\n",
200196
reg);
@@ -882,20 +878,6 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
882878
*/
883879
dev_warn(map->dev, "mask_base and unmask_base are inverted, please fix it");
884880

885-
/* Might as well warn about mask_invert while we're at it... */
886-
if (chip->mask_invert)
887-
dev_warn(map->dev, "mask_invert=true ignored");
888-
889-
d->mask_base = chip->unmask_base;
890-
d->unmask_base = chip->mask_base;
891-
} else if (chip->mask_invert) {
892-
/*
893-
* Swap the roles of mask_base and unmask_base if the bits are
894-
* inverted. This is deprecated, drivers should use unmask_base
895-
* directly.
896-
*/
897-
dev_warn(map->dev, "mask_invert=true is deprecated; please switch to unmask_base");
898-
899881
d->mask_base = chip->unmask_base;
900882
d->unmask_base = chip->mask_base;
901883
} else {
@@ -1028,9 +1010,6 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
10281010

10291011
ret = regmap_read(map, reg, &d->type_buf_def[i]);
10301012

1031-
if (d->chip->type_invert)
1032-
d->type_buf_def[i] = ~d->type_buf_def[i];
1033-
10341013
if (ret) {
10351014
dev_err(map->dev, "Failed to get type defaults at 0x%x: %d\n",
10361015
reg, ret);

drivers/base/regmap/regmap.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,6 +1942,8 @@ static int _regmap_bus_reg_write(void *context, unsigned int reg,
19421942
{
19431943
struct regmap *map = context;
19441944

1945+
reg += map->reg_base;
1946+
reg >>= map->format.reg_downshift;
19451947
return map->bus->reg_write(map->bus_context, reg, val);
19461948
}
19471949

@@ -2840,6 +2842,8 @@ static int _regmap_bus_reg_read(void *context, unsigned int reg,
28402842
{
28412843
struct regmap *map = context;
28422844

2845+
reg += map->reg_base;
2846+
reg >>= map->format.reg_downshift;
28432847
return map->bus->reg_read(map->bus_context, reg, val);
28442848
}
28452849

@@ -3231,6 +3235,8 @@ static int _regmap_update_bits(struct regmap *map, unsigned int reg,
32313235
*change = false;
32323236

32333237
if (regmap_volatile(map, reg) && map->reg_update_bits) {
3238+
reg += map->reg_base;
3239+
reg >>= map->format.reg_downshift;
32343240
ret = map->reg_update_bits(map->bus_context, reg, mask, val);
32353241
if (ret == 0 && change)
32363242
*change = true;

include/linux/regmap.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ typedef void (*regmap_hw_free_context)(void *context);
520520
* to perform locking. This field is ignored if custom lock/unlock
521521
* functions are used (see fields lock/unlock of
522522
* struct regmap_config).
523+
* @free_on_exit: kfree this on exit of regmap
523524
* @write: Write operation.
524525
* @gather_write: Write operation with split register/value, return -ENOTSUPP
525526
* if not implemented on a given device.
@@ -548,10 +549,10 @@ typedef void (*regmap_hw_free_context)(void *context);
548549
* DEFAULT, BIG is assumed.
549550
* @max_raw_read: Max raw read size that can be used on the bus.
550551
* @max_raw_write: Max raw write size that can be used on the bus.
551-
* @free_on_exit: kfree this on exit of regmap
552552
*/
553553
struct regmap_bus {
554554
bool fast_io;
555+
bool free_on_exit;
555556
regmap_hw_write write;
556557
regmap_hw_gather_write gather_write;
557558
regmap_hw_async_write async_write;
@@ -568,7 +569,6 @@ struct regmap_bus {
568569
enum regmap_endian val_format_endian_default;
569570
size_t max_raw_read;
570571
size_t max_raw_write;
571-
bool free_on_exit;
572572
};
573573

574574
/*
@@ -1540,9 +1540,6 @@ struct regmap_irq_chip_data;
15401540
* @config_base: Base address for IRQ type config regs. If null unsupported.
15411541
* @irq_reg_stride: Stride to use for chips where registers are not contiguous.
15421542
* @init_ack_masked: Ack all masked interrupts once during initalization.
1543-
* @mask_invert: Inverted mask register: cleared bits are masked out.
1544-
* Deprecated; prefer describing an inverted mask register as
1545-
* an unmask register.
15461543
* @mask_unmask_non_inverted: Controls mask bit inversion for chips that set
15471544
* both @mask_base and @unmask_base. If false, mask and unmask bits are
15481545
* inverted (which is deprecated behavior); if true, bits will not be
@@ -1555,8 +1552,6 @@ struct regmap_irq_chip_data;
15551552
* @ack_invert: Inverted ack register: cleared bits for ack.
15561553
* @clear_ack: Use this to set 1 and 0 or vice-versa to clear interrupts.
15571554
* @wake_invert: Inverted wake register: cleared bits are wake enabled.
1558-
* @type_invert: Invert the type flags. Deprecated, use config registers
1559-
* instead.
15601555
* @type_in_mask: Use the mask registers for controlling irq type. Use this if
15611556
* the hardware provides separate bits for rising/falling edge
15621557
* or low/high level interrupts and they should be combined into
@@ -1626,14 +1621,12 @@ struct regmap_irq_chip {
16261621
const unsigned int *config_base;
16271622
unsigned int irq_reg_stride;
16281623
unsigned int init_ack_masked:1;
1629-
unsigned int mask_invert:1;
16301624
unsigned int mask_unmask_non_inverted:1;
16311625
unsigned int use_ack:1;
16321626
unsigned int ack_invert:1;
16331627
unsigned int clear_ack:1;
16341628
unsigned int wake_invert:1;
16351629
unsigned int runtime_pm:1;
1636-
unsigned int type_invert:1;
16371630
unsigned int type_in_mask:1;
16381631
unsigned int clear_on_unmask:1;
16391632
unsigned int not_fixed_stride:1;

0 commit comments

Comments
 (0)