Skip to content

Commit 962d5ec

Browse files
committed
Merge tag 'regmap-v5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap
Pull regmap updates from Mark Brown: "A larger than usual set of changes, though mainly small: - An optimization to the debugfs code to greatly improve performance when dumping extremely sparse register maps from Lucas Tanure. - Stricter enforcement of writability checks from Han Nandor. - A fix for default interrupt mode configuration from Srinivas Kandagatla. - SPDX header conversion from Greg Kroah-Hartman" * tag 'regmap-v5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap: regmap: add proper SPDX identifiers on files that did not have them. regmap: verify if register is writeable before writing operations regmap: regmap-irq: fix getting type default values regmap: debugfs: Jump to the next readable register regmap: debugfs: Replace code by already existing function
2 parents 71ae5fc + 615c4d9 commit 962d5ec

14 files changed

+118
-180
lines changed

drivers/base/regmap/internal.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
12
/*
23
* Register map access API internal header
34
*
45
* Copyright 2011 Wolfson Microelectronics plc
56
*
67
* Author: Mark Brown <[email protected]>
7-
*
8-
* This program is free software; you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License version 2 as
10-
* published by the Free Software Foundation.
118
*/
129

1310
#ifndef _REGMAP_INTERNAL_H

drivers/base/regmap/regcache-flat.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
/*
2-
* Register cache access API - flat caching support
3-
*
4-
* Copyright 2012 Wolfson Microelectronics plc
5-
*
6-
* Author: Mark Brown <[email protected]>
7-
*
8-
* This program is free software; you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License version 2 as
10-
* published by the Free Software Foundation.
11-
*/
1+
// SPDX-License-Identifier: GPL-2.0
2+
//
3+
// Register cache access API - flat caching support
4+
//
5+
// Copyright 2012 Wolfson Microelectronics plc
6+
//
7+
// Author: Mark Brown <[email protected]>
128

139
#include <linux/device.h>
1410
#include <linux/seq_file.h>

drivers/base/regmap/regcache-lzo.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
/*
2-
* Register cache access API - LZO caching support
3-
*
4-
* Copyright 2011 Wolfson Microelectronics plc
5-
*
6-
* Author: Dimitris Papastamos <[email protected]>
7-
*
8-
* This program is free software; you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License version 2 as
10-
* published by the Free Software Foundation.
11-
*/
1+
// SPDX-License-Identifier: GPL-2.0
2+
//
3+
// Register cache access API - LZO caching support
4+
//
5+
// Copyright 2011 Wolfson Microelectronics plc
6+
//
7+
// Author: Dimitris Papastamos <[email protected]>
128

139
#include <linux/device.h>
1410
#include <linux/lzo.h>

drivers/base/regmap/regcache-rbtree.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
/*
2-
* Register cache access API - rbtree caching support
3-
*
4-
* Copyright 2011 Wolfson Microelectronics plc
5-
*
6-
* Author: Dimitris Papastamos <[email protected]>
7-
*
8-
* This program is free software; you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License version 2 as
10-
* published by the Free Software Foundation.
11-
*/
1+
// SPDX-License-Identifier: GPL-2.0
2+
//
3+
// Register cache access API - rbtree caching support
4+
//
5+
// Copyright 2011 Wolfson Microelectronics plc
6+
//
7+
// Author: Dimitris Papastamos <[email protected]>
128

139
#include <linux/debugfs.h>
1410
#include <linux/device.h>

drivers/base/regmap/regcache.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
/*
2-
* Register cache access API
3-
*
4-
* Copyright 2011 Wolfson Microelectronics plc
5-
*
6-
* Author: Dimitris Papastamos <[email protected]>
7-
*
8-
* This program is free software; you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License version 2 as
10-
* published by the Free Software Foundation.
11-
*/
1+
// SPDX-License-Identifier: GPL-2.0
2+
//
3+
// Register cache access API
4+
//
5+
// Copyright 2011 Wolfson Microelectronics plc
6+
//
7+
// Author: Dimitris Papastamos <[email protected]>
128

139
#include <linux/bsearch.h>
1410
#include <linux/device.h>

drivers/base/regmap/regmap-ac97.c

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
/*
2-
* Register map access API - AC'97 support
3-
*
4-
* Copyright 2013 Linaro Ltd. All rights reserved.
5-
*
6-
* This program is free software; you can redistribute it and/or modify it
7-
* under the terms and conditions of the GNU General Public License,
8-
* version 2, as published by the Free Software Foundation.
9-
*
10-
* This program is distributed in the hope it will be useful, but WITHOUT
11-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13-
* more details.
14-
*
15-
* You should have received a copy of the GNU General Public License
16-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17-
*/
1+
// SPDX-License-Identifier: GPL-2.0
2+
//
3+
// Register map access API - AC'97 support
4+
//
5+
// Copyright 2013 Linaro Ltd. All rights reserved.
186

197
#include <linux/clk.h>
208
#include <linux/err.h>

drivers/base/regmap/regmap-debugfs.c

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
/*
2-
* Register map access API - debugfs
3-
*
4-
* Copyright 2011 Wolfson Microelectronics plc
5-
*
6-
* Author: Mark Brown <[email protected]>
7-
*
8-
* This program is free software; you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License version 2 as
10-
* published by the Free Software Foundation.
11-
*/
1+
// SPDX-License-Identifier: GPL-2.0
2+
//
3+
// Register map access API - debugfs
4+
//
5+
// Copyright 2011 Wolfson Microelectronics plc
6+
//
7+
// Author: Mark Brown <[email protected]>
128

139
#include <linux/slab.h>
1410
#include <linux/mutex.h>
@@ -195,6 +191,28 @@ static inline void regmap_calc_tot_len(struct regmap *map,
195191
}
196192
}
197193

194+
static int regmap_next_readable_reg(struct regmap *map, int reg)
195+
{
196+
struct regmap_debugfs_off_cache *c;
197+
int ret = -EINVAL;
198+
199+
if (regmap_printable(map, reg + map->reg_stride)) {
200+
ret = reg + map->reg_stride;
201+
} else {
202+
mutex_lock(&map->cache_lock);
203+
list_for_each_entry(c, &map->debugfs_off_cache, list) {
204+
if (reg > c->max_reg)
205+
continue;
206+
if (reg < c->base_reg) {
207+
ret = c->base_reg;
208+
break;
209+
}
210+
}
211+
mutex_unlock(&map->cache_lock);
212+
}
213+
return ret;
214+
}
215+
198216
static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from,
199217
unsigned int to, char __user *user_buf,
200218
size_t count, loff_t *ppos)
@@ -218,12 +236,8 @@ static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from,
218236
/* Work out which register we're starting at */
219237
start_reg = regmap_debugfs_get_dump_start(map, from, *ppos, &p);
220238

221-
for (i = start_reg; i <= to; i += map->reg_stride) {
222-
if (!regmap_readable(map, i) && !regmap_cached(map, i))
223-
continue;
224-
225-
if (regmap_precious(map, i))
226-
continue;
239+
for (i = start_reg; i >= 0 && i <= to;
240+
i = regmap_next_readable_reg(map, i)) {
227241

228242
/* If we're in the region the user is trying to read */
229243
if (p >= *ppos) {

drivers/base/regmap/regmap-i2c.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
/*
2-
* Register map access API - I2C support
3-
*
4-
* Copyright 2011 Wolfson Microelectronics plc
5-
*
6-
* Author: Mark Brown <[email protected]>
7-
*
8-
* This program is free software; you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License version 2 as
10-
* published by the Free Software Foundation.
11-
*/
1+
// SPDX-License-Identifier: GPL-2.0
2+
//
3+
// Register map access API - I2C support
4+
//
5+
// Copyright 2011 Wolfson Microelectronics plc
6+
//
7+
// Author: Mark Brown <[email protected]>
128

139
#include <linux/regmap.h>
1410
#include <linux/i2c.h>

drivers/base/regmap/regmap-irq.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
/*
2-
* regmap based irq_chip
3-
*
4-
* Copyright 2011 Wolfson Microelectronics plc
5-
*
6-
* Author: Mark Brown <[email protected]>
7-
*
8-
* This program is free software; you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License version 2 as
10-
* published by the Free Software Foundation.
11-
*/
1+
// SPDX-License-Identifier: GPL-2.0
2+
//
3+
// regmap based irq_chip
4+
//
5+
// Copyright 2011 Wolfson Microelectronics plc
6+
//
7+
// Author: Mark Brown <[email protected]>
128

139
#include <linux/device.h>
1410
#include <linux/export.h>
@@ -761,9 +757,6 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
761757

762758
if (chip->num_type_reg && !chip->type_in_mask) {
763759
for (i = 0; i < chip->num_type_reg; ++i) {
764-
if (!d->type_buf_def[i])
765-
continue;
766-
767760
reg = chip->type_base +
768761
(i * map->reg_stride * d->type_reg_stride);
769762

drivers/base/regmap/regmap-mmio.c

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
1-
/*
2-
* Register map access API - MMIO support
3-
*
4-
* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
5-
*
6-
* This program is free software; you can redistribute it and/or modify it
7-
* under the terms and conditions of the GNU General Public License,
8-
* version 2, as published by the Free Software Foundation.
9-
*
10-
* This program is distributed in the hope it will be useful, but WITHOUT
11-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13-
* more details.
14-
*
15-
* You should have received a copy of the GNU General Public License
16-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17-
*/
1+
// SPDX-License-Identifier: GPL-2.0
2+
//
3+
// Register map access API - MMIO support
4+
//
5+
// Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
186

197
#include <linux/clk.h>
208
#include <linux/err.h>

0 commit comments

Comments
 (0)