···11+/* SPDX-License-Identifier: GPL-2.0 */12/*23 * Register map access API internal header34 *45 * Copyright 2011 Wolfson Microelectronics plc56 *67 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.118 */1291310#ifndef _REGMAP_INTERNAL_H
+7-11
drivers/base/regmap/regcache-flat.c
···11-/*22- * Register cache access API - flat caching support33- *44- * Copyright 2012 Wolfson Microelectronics plc55- *66- * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111- */11+// SPDX-License-Identifier: GPL-2.022+//33+// Register cache access API - flat caching support44+//55+// Copyright 2012 Wolfson Microelectronics plc66+//77+// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>128139#include <linux/device.h>1410#include <linux/seq_file.h>
+7-11
drivers/base/regmap/regcache-lzo.c
···11-/*22- * Register cache access API - LZO caching support33- *44- * Copyright 2011 Wolfson Microelectronics plc55- *66- * Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111- */11+// SPDX-License-Identifier: GPL-2.022+//33+// Register cache access API - LZO caching support44+//55+// Copyright 2011 Wolfson Microelectronics plc66+//77+// Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>128139#include <linux/device.h>1410#include <linux/lzo.h>
+7-11
drivers/base/regmap/regcache-rbtree.c
···11-/*22- * Register cache access API - rbtree caching support33- *44- * Copyright 2011 Wolfson Microelectronics plc55- *66- * Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111- */11+// SPDX-License-Identifier: GPL-2.022+//33+// Register cache access API - rbtree caching support44+//55+// Copyright 2011 Wolfson Microelectronics plc66+//77+// Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>128139#include <linux/debugfs.h>1410#include <linux/device.h>
+7-11
drivers/base/regmap/regcache.c
···11-/*22- * Register cache access API33- *44- * Copyright 2011 Wolfson Microelectronics plc55- *66- * Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111- */11+// SPDX-License-Identifier: GPL-2.022+//33+// Register cache access API44+//55+// Copyright 2011 Wolfson Microelectronics plc66+//77+// Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>128139#include <linux/bsearch.h>1410#include <linux/device.h>
+5-17
drivers/base/regmap/regmap-ac97.c
···11-/*22- * Register map access API - AC'97 support33- *44- * Copyright 2013 Linaro Ltd. All rights reserved.55- *66- * This program is free software; you can redistribute it and/or modify it77- * under the terms and conditions of the GNU General Public License,88- * version 2, as published by the Free Software Foundation.99- *1010- * This program is distributed in the hope it will be useful, but WITHOUT1111- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1212- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1313- * more details.1414- *1515- * You should have received a copy of the GNU General Public License1616- * along with this program. If not, see <http://www.gnu.org/licenses/>.1717- */11+// SPDX-License-Identifier: GPL-2.022+//33+// Register map access API - AC'97 support44+//55+// Copyright 2013 Linaro Ltd. All rights reserved.186197#include <linux/clk.h>208#include <linux/err.h>
+31-17
drivers/base/regmap/regmap-debugfs.c
···11-/*22- * Register map access API - debugfs33- *44- * Copyright 2011 Wolfson Microelectronics plc55- *66- * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111- */11+// SPDX-License-Identifier: GPL-2.022+//33+// Register map access API - debugfs44+//55+// Copyright 2011 Wolfson Microelectronics plc66+//77+// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>128139#include <linux/slab.h>1410#include <linux/mutex.h>···191195 }192196}193197198198+static int regmap_next_readable_reg(struct regmap *map, int reg)199199+{200200+ struct regmap_debugfs_off_cache *c;201201+ int ret = -EINVAL;202202+203203+ if (regmap_printable(map, reg + map->reg_stride)) {204204+ ret = reg + map->reg_stride;205205+ } else {206206+ mutex_lock(&map->cache_lock);207207+ list_for_each_entry(c, &map->debugfs_off_cache, list) {208208+ if (reg > c->max_reg)209209+ continue;210210+ if (reg < c->base_reg) {211211+ ret = c->base_reg;212212+ break;213213+ }214214+ }215215+ mutex_unlock(&map->cache_lock);216216+ }217217+ return ret;218218+}219219+194220static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from,195221 unsigned int to, char __user *user_buf,196222 size_t count, loff_t *ppos)···236218 /* Work out which register we're starting at */237219 start_reg = regmap_debugfs_get_dump_start(map, from, *ppos, &p);238220239239- for (i = start_reg; i <= to; i += map->reg_stride) {240240- if (!regmap_readable(map, i) && !regmap_cached(map, i))241241- continue;242242-243243- if (regmap_precious(map, i))244244- continue;221221+ for (i = start_reg; i >= 0 && i <= to;222222+ i = regmap_next_readable_reg(map, i)) {245223246224 /* If we're in the region the user is trying to read */247225 if (p >= *ppos) {
+7-11
drivers/base/regmap/regmap-i2c.c
···11-/*22- * Register map access API - I2C support33- *44- * Copyright 2011 Wolfson Microelectronics plc55- *66- * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111- */11+// SPDX-License-Identifier: GPL-2.022+//33+// Register map access API - I2C support44+//55+// Copyright 2011 Wolfson Microelectronics plc66+//77+// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>128139#include <linux/regmap.h>1410#include <linux/i2c.h>
+7-11
drivers/base/regmap/regmap-irq.c
···11-/*22- * regmap based irq_chip33- *44- * Copyright 2011 Wolfson Microelectronics plc55- *66- * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111- */11+// SPDX-License-Identifier: GPL-2.022+//33+// regmap based irq_chip44+//55+// Copyright 2011 Wolfson Microelectronics plc66+//77+// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>128139#include <linux/device.h>1410#include <linux/export.h>
+5-17
drivers/base/regmap/regmap-mmio.c
···11-/*22- * Register map access API - MMIO support33- *44- * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.55- *66- * This program is free software; you can redistribute it and/or modify it77- * under the terms and conditions of the GNU General Public License,88- * version 2, as published by the Free Software Foundation.99- *1010- * This program is distributed in the hope it will be useful, but WITHOUT1111- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1212- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1313- * more details.1414- *1515- * You should have received a copy of the GNU General Public License1616- * along with this program. If not, see <http://www.gnu.org/licenses/>.1717- */11+// SPDX-License-Identifier: GPL-2.022+//33+// Register map access API - MMIO support44+//55+// Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.186197#include <linux/clk.h>208#include <linux/err.h>
+7-11
drivers/base/regmap/regmap-spi.c
···11-/*22- * Register map access API - SPI support33- *44- * Copyright 2011 Wolfson Microelectronics plc55- *66- * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111- */11+// SPDX-License-Identifier: GPL-2.022+//33+// Register map access API - SPI support44+//55+// Copyright 2011 Wolfson Microelectronics plc66+//77+// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>128139#include <linux/regmap.h>1410#include <linux/spi/spi.h>
+10-19
drivers/base/regmap/regmap-spmi.c
···11-/*22- * Register map access API - SPMI support33- *44- * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.55- *66- * Based on regmap-i2c.c:77- * Copyright 2011 Wolfson Microelectronics plc88- * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>99- *1010- * This program is free software; you can redistribute it and/or modify1111- * it under the terms of the GNU General Public License version 2 and1212- * only version 2 as published by the Free Software Foundation.1313- *1414- * This program is distributed in the hope that it will be useful,1515- * but WITHOUT ANY WARRANTY; without even the implied warranty of1616- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1717- * GNU General Public License for more details.1818- *1919- */11+// SPDX-License-Identifier: GPL-2.022+//33+// Register map access API - SPMI support44+//55+// Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.66+//77+// Based on regmap-i2c.c:88+// Copyright 2011 Wolfson Microelectronics plc99+// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>1010+2011#include <linux/regmap.h>2112#include <linux/spmi.h>2213#include <linux/module.h>
+6-10
drivers/base/regmap/regmap-w1.c
···11-/*22- * Register map access API - W1 (1-Wire) support33- *44- * Copyright (c) 2017 Radioavionica Corporation55- * Author: Alex A. Mihaylov <minimumlaw@rambler.ru>66- *77- * This program is free software; you can redistribute it and/or modify88- * it under the terms of the GNU General Public License version 2 as99- * published by the Free Software Foundation1010- */11+// SPDX-License-Identifier: GPL-2.022+//33+// Register map access API - W1 (1-Wire) support44+//55+// Copyright (c) 2017 Radioavionica Corporation66+// Author: Alex A. Mihaylov <minimumlaw@rambler.ru>117128#include <linux/regmap.h>139#include <linux/module.h>
+11-16
drivers/base/regmap/regmap.c
···11-/*22- * Register map access API33- *44- * Copyright 2011 Wolfson Microelectronics plc55- *66- * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>77- *88- * This program is free software; you can redistribute it and/or modify99- * it under the terms of the GNU General Public License version 2 as1010- * published by the Free Software Foundation.1111- */11+// SPDX-License-Identifier: GPL-2.022+//33+// Register map access API44+//55+// Copyright 2011 Wolfson Microelectronics plc66+//77+// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>128139#include <linux/device.h>1410#include <linux/slab.h>···14891493 WARN_ON(!map->bus);1490149414911495 /* Check for unwritable registers before we start */14921492- if (map->writeable_reg)14931493- for (i = 0; i < val_len / map->format.val_bytes; i++)14941494- if (!map->writeable_reg(map->dev,14951495- reg + regmap_get_offset(map, i)))14961496- return -EINVAL;14961496+ for (i = 0; i < val_len / map->format.val_bytes; i++)14971497+ if (!regmap_writeable(map,14981498+ reg + regmap_get_offset(map, i)))14991499+ return -EINVAL;1497150014981501 if (!map->cache_bypass && map->format.parse_val) {14991502 unsigned int ival;