regmap: Updates for v5.2
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. -----BEGIN PGP SIGNATURE----- iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlzQQXoTHGJyb29uaWVA a2VybmVsLm9yZwAKCRAk1otyXVSH0JcpB/4yUhslI3KBrHQ6YWyzwVbec3wKC3/X L+bBvO/I2/PT66q6iMH2APB3wremr3onxtYXlZSuc4hbjzaB0ipBhQWsLFrhYJwE MQVx6e1+Jlnl+VvilsOsdcg4d4d8xQDR3oSlcKaDnyO9H26oH3Jrhtcks/wG4jfM gq7TtIsdZkeAS25ReAZsTRbbmWfMq0QwK/hSEj+1KzhLN01jRurE0Z2fMEUX9/Nt MxHlkQrIyTgWgHm6w75ri2NL6XY+9/G2WY93nZuA/rxpp3sm9RK/ndxXwnIvmDUp kn2PABVno1ZQIHFxEY+ECg8ZMRaFfG7A2wpTvRUadO7H7sSX2IYe8kGm =TA1l -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
962d5ecca1
|
@ -1,13 +1,10 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Register map access API internal header
|
||||
*
|
||||
* Copyright 2011 Wolfson Microelectronics plc
|
||||
*
|
||||
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef _REGMAP_INTERNAL_H
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
/*
|
||||
* Register cache access API - flat caching support
|
||||
*
|
||||
* Copyright 2012 Wolfson Microelectronics plc
|
||||
*
|
||||
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Register cache access API - flat caching support
|
||||
//
|
||||
// Copyright 2012 Wolfson Microelectronics plc
|
||||
//
|
||||
// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/seq_file.h>
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
/*
|
||||
* Register cache access API - LZO caching support
|
||||
*
|
||||
* Copyright 2011 Wolfson Microelectronics plc
|
||||
*
|
||||
* Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Register cache access API - LZO caching support
|
||||
//
|
||||
// Copyright 2011 Wolfson Microelectronics plc
|
||||
//
|
||||
// Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/lzo.h>
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
/*
|
||||
* Register cache access API - rbtree caching support
|
||||
*
|
||||
* Copyright 2011 Wolfson Microelectronics plc
|
||||
*
|
||||
* Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Register cache access API - rbtree caching support
|
||||
//
|
||||
// Copyright 2011 Wolfson Microelectronics plc
|
||||
//
|
||||
// Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/device.h>
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
/*
|
||||
* Register cache access API
|
||||
*
|
||||
* Copyright 2011 Wolfson Microelectronics plc
|
||||
*
|
||||
* Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Register cache access API
|
||||
//
|
||||
// Copyright 2011 Wolfson Microelectronics plc
|
||||
//
|
||||
// Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
|
||||
|
||||
#include <linux/bsearch.h>
|
||||
#include <linux/device.h>
|
||||
|
|
|
@ -1,20 +1,8 @@
|
|||
/*
|
||||
* Register map access API - AC'97 support
|
||||
*
|
||||
* Copyright 2013 Linaro Ltd. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Register map access API - AC'97 support
|
||||
//
|
||||
// Copyright 2013 Linaro Ltd. All rights reserved.
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/err.h>
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
/*
|
||||
* Register map access API - debugfs
|
||||
*
|
||||
* Copyright 2011 Wolfson Microelectronics plc
|
||||
*
|
||||
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Register map access API - debugfs
|
||||
//
|
||||
// Copyright 2011 Wolfson Microelectronics plc
|
||||
//
|
||||
// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mutex.h>
|
||||
|
@ -195,6 +191,28 @@ static inline void regmap_calc_tot_len(struct regmap *map,
|
|||
}
|
||||
}
|
||||
|
||||
static int regmap_next_readable_reg(struct regmap *map, int reg)
|
||||
{
|
||||
struct regmap_debugfs_off_cache *c;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (regmap_printable(map, reg + map->reg_stride)) {
|
||||
ret = reg + map->reg_stride;
|
||||
} else {
|
||||
mutex_lock(&map->cache_lock);
|
||||
list_for_each_entry(c, &map->debugfs_off_cache, list) {
|
||||
if (reg > c->max_reg)
|
||||
continue;
|
||||
if (reg < c->base_reg) {
|
||||
ret = c->base_reg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&map->cache_lock);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from,
|
||||
unsigned int to, char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
|
@ -218,12 +236,8 @@ static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from,
|
|||
/* Work out which register we're starting at */
|
||||
start_reg = regmap_debugfs_get_dump_start(map, from, *ppos, &p);
|
||||
|
||||
for (i = start_reg; i <= to; i += map->reg_stride) {
|
||||
if (!regmap_readable(map, i) && !regmap_cached(map, i))
|
||||
continue;
|
||||
|
||||
if (regmap_precious(map, i))
|
||||
continue;
|
||||
for (i = start_reg; i >= 0 && i <= to;
|
||||
i = regmap_next_readable_reg(map, i)) {
|
||||
|
||||
/* If we're in the region the user is trying to read */
|
||||
if (p >= *ppos) {
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
/*
|
||||
* Register map access API - I2C support
|
||||
*
|
||||
* Copyright 2011 Wolfson Microelectronics plc
|
||||
*
|
||||
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Register map access API - I2C support
|
||||
//
|
||||
// Copyright 2011 Wolfson Microelectronics plc
|
||||
//
|
||||
// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/i2c.h>
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
/*
|
||||
* regmap based irq_chip
|
||||
*
|
||||
* Copyright 2011 Wolfson Microelectronics plc
|
||||
*
|
||||
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// regmap based irq_chip
|
||||
//
|
||||
// Copyright 2011 Wolfson Microelectronics plc
|
||||
//
|
||||
// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/export.h>
|
||||
|
@ -761,9 +757,6 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
|
|||
|
||||
if (chip->num_type_reg && !chip->type_in_mask) {
|
||||
for (i = 0; i < chip->num_type_reg; ++i) {
|
||||
if (!d->type_buf_def[i])
|
||||
continue;
|
||||
|
||||
reg = chip->type_base +
|
||||
(i * map->reg_stride * d->type_reg_stride);
|
||||
|
||||
|
|
|
@ -1,20 +1,8 @@
|
|||
/*
|
||||
* Register map access API - MMIO support
|
||||
*
|
||||
* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Register map access API - MMIO support
|
||||
//
|
||||
// Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/err.h>
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
/*
|
||||
* Register map access API - SPI support
|
||||
*
|
||||
* Copyright 2011 Wolfson Microelectronics plc
|
||||
*
|
||||
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Register map access API - SPI support
|
||||
//
|
||||
// Copyright 2011 Wolfson Microelectronics plc
|
||||
//
|
||||
// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/spi/spi.h>
|
||||
|
|
|
@ -1,22 +1,13 @@
|
|||
/*
|
||||
* Register map access API - SPMI support
|
||||
*
|
||||
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Based on regmap-i2c.c:
|
||||
* Copyright 2011 Wolfson Microelectronics plc
|
||||
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Register map access API - SPMI support
|
||||
//
|
||||
// Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
|
||||
//
|
||||
// Based on regmap-i2c.c:
|
||||
// Copyright 2011 Wolfson Microelectronics plc
|
||||
// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/spmi.h>
|
||||
#include <linux/module.h>
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
/*
|
||||
* Register map access API - W1 (1-Wire) support
|
||||
*
|
||||
* Copyright (c) 2017 Radioavionica Corporation
|
||||
* Author: Alex A. Mihaylov <minimumlaw@rambler.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Register map access API - W1 (1-Wire) support
|
||||
//
|
||||
// Copyright (c) 2017 Radioavionica Corporation
|
||||
// Author: Alex A. Mihaylov <minimumlaw@rambler.ru>
|
||||
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/module.h>
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
/*
|
||||
* Register map access API
|
||||
*
|
||||
* Copyright 2011 Wolfson Microelectronics plc
|
||||
*
|
||||
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Register map access API
|
||||
//
|
||||
// Copyright 2011 Wolfson Microelectronics plc
|
||||
//
|
||||
// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/slab.h>
|
||||
|
@ -1493,11 +1489,10 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg,
|
|||
WARN_ON(!map->bus);
|
||||
|
||||
/* Check for unwritable registers before we start */
|
||||
if (map->writeable_reg)
|
||||
for (i = 0; i < val_len / map->format.val_bytes; i++)
|
||||
if (!map->writeable_reg(map->dev,
|
||||
reg + regmap_get_offset(map, i)))
|
||||
return -EINVAL;
|
||||
for (i = 0; i < val_len / map->format.val_bytes; i++)
|
||||
if (!regmap_writeable(map,
|
||||
reg + regmap_get_offset(map, i)))
|
||||
return -EINVAL;
|
||||
|
||||
if (!map->cache_bypass && map->format.parse_val) {
|
||||
unsigned int ival;
|
||||
|
|
Loading…
Reference in New Issue