Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge remote-tracking branches 'regmap/topic/irq', 'regmap/topic/le', 'regmap/topic/mmio' and 'regmap/topic/rbtree' into regmap-next

+86 -12
+4 -4
drivers/base/regmap/regcache-rbtree.c
··· 23 23 static int regcache_rbtree_exit(struct regmap *map); 24 24 25 25 struct regcache_rbtree_node { 26 - /* the actual rbtree node holding this block */ 27 - struct rb_node node; 28 - /* base register handled by this block */ 29 - unsigned int base_reg; 30 26 /* block of adjacent registers */ 31 27 void *block; 32 28 /* Which registers are present */ 33 29 long *cache_present; 30 + /* base register handled by this block */ 31 + unsigned int base_reg; 34 32 /* number of registers available in the block */ 35 33 unsigned int blklen; 34 + /* the actual rbtree node holding this block */ 35 + struct rb_node node; 36 36 } __attribute__ ((packed)); 37 37 38 38 struct regcache_rbtree_ctx {
+6 -3
drivers/base/regmap/regmap-irq.c
··· 10 10 * published by the Free Software Foundation. 11 11 */ 12 12 13 - #include <linux/export.h> 14 13 #include <linux/device.h> 15 - #include <linux/regmap.h> 16 - #include <linux/irq.h> 14 + #include <linux/export.h> 17 15 #include <linux/interrupt.h> 16 + #include <linux/irq.h> 18 17 #include <linux/irqdomain.h> 19 18 #include <linux/pm_runtime.h> 19 + #include <linux/regmap.h> 20 20 #include <linux/slab.h> 21 21 22 22 #include "internal.h" ··· 346 346 int i; 347 347 int ret = -ENOMEM; 348 348 u32 reg; 349 + 350 + if (chip->num_regs <= 0) 351 + return -EINVAL; 349 352 350 353 for (i = 0; i < chip->num_irqs; i++) { 351 354 if (chip->irqs[i].reg_offset % map->reg_stride)
+24 -5
drivers/base/regmap/regmap-mmio.c
··· 66 66 BUG_ON(count <= offset); 67 67 } 68 68 69 + static inline unsigned int 70 + regmap_mmio_get_offset(const void *reg, size_t reg_size) 71 + { 72 + switch (reg_size) { 73 + case 1: 74 + return *(u8 *)reg; 75 + case 2: 76 + return *(u16 *)reg; 77 + case 4: 78 + return *(u32 *)reg; 79 + #ifdef CONFIG_64BIT 80 + case 8: 81 + return *(u64 *)reg; 82 + #endif 83 + default: 84 + BUG(); 85 + } 86 + } 87 + 69 88 static int regmap_mmio_gather_write(void *context, 70 89 const void *reg, size_t reg_size, 71 90 const void *val, size_t val_size) 72 91 { 73 92 struct regmap_mmio_context *ctx = context; 74 - u32 offset; 93 + unsigned int offset; 75 94 int ret; 76 95 77 96 regmap_mmio_regsize_check(reg_size); ··· 101 82 return ret; 102 83 } 103 84 104 - offset = *(u32 *)reg; 85 + offset = regmap_mmio_get_offset(reg, reg_size); 105 86 106 87 while (val_size) { 107 88 switch (ctx->val_bytes) { ··· 137 118 static int regmap_mmio_write(void *context, const void *data, size_t count) 138 119 { 139 120 struct regmap_mmio_context *ctx = context; 140 - u32 offset = ctx->reg_bytes + ctx->pad_bytes; 121 + unsigned int offset = ctx->reg_bytes + ctx->pad_bytes; 141 122 142 123 regmap_mmio_count_check(count, offset); 143 124 ··· 150 131 void *val, size_t val_size) 151 132 { 152 133 struct regmap_mmio_context *ctx = context; 153 - u32 offset; 134 + unsigned int offset; 154 135 int ret; 155 136 156 137 regmap_mmio_regsize_check(reg_size); ··· 161 142 return ret; 162 143 } 163 144 164 - offset = *(u32 *)reg; 145 + offset = regmap_mmio_get_offset(reg, reg_size); 165 146 166 147 while (val_size) { 167 148 switch (ctx->val_bytes) {
+52
drivers/base/regmap/regmap.c
··· 192 192 b[0] = cpu_to_be16(val << shift); 193 193 } 194 194 195 + static void regmap_format_16_le(void *buf, unsigned int val, unsigned int shift) 196 + { 197 + __le16 *b = buf; 198 + 199 + b[0] = cpu_to_le16(val << shift); 200 + } 201 + 195 202 static void regmap_format_16_native(void *buf, unsigned int val, 196 203 unsigned int shift) 197 204 { ··· 221 214 __be32 *b = buf; 222 215 223 216 b[0] = cpu_to_be32(val << shift); 217 + } 218 + 219 + static void regmap_format_32_le(void *buf, unsigned int val, unsigned int shift) 220 + { 221 + __le32 *b = buf; 222 + 223 + b[0] = cpu_to_le32(val << shift); 224 224 } 225 225 226 226 static void regmap_format_32_native(void *buf, unsigned int val, ··· 254 240 return be16_to_cpu(b[0]); 255 241 } 256 242 243 + static unsigned int regmap_parse_16_le(const void *buf) 244 + { 245 + const __le16 *b = buf; 246 + 247 + return le16_to_cpu(b[0]); 248 + } 249 + 257 250 static void regmap_parse_16_be_inplace(void *buf) 258 251 { 259 252 __be16 *b = buf; 260 253 261 254 b[0] = be16_to_cpu(b[0]); 255 + } 256 + 257 + static void regmap_parse_16_le_inplace(void *buf) 258 + { 259 + __le16 *b = buf; 260 + 261 + b[0] = le16_to_cpu(b[0]); 262 262 } 263 263 264 264 static unsigned int regmap_parse_16_native(const void *buf) ··· 297 269 return be32_to_cpu(b[0]); 298 270 } 299 271 272 + static unsigned int regmap_parse_32_le(const void *buf) 273 + { 274 + const __le32 *b = buf; 275 + 276 + return le32_to_cpu(b[0]); 277 + } 278 + 300 279 static void regmap_parse_32_be_inplace(void *buf) 301 280 { 302 281 __be32 *b = buf; 303 282 304 283 b[0] = be32_to_cpu(b[0]); 284 + } 285 + 286 + static void regmap_parse_32_le_inplace(void *buf) 287 + { 288 + __le32 *b = buf; 289 + 290 + b[0] = le32_to_cpu(b[0]); 305 291 } 306 292 307 293 static unsigned int regmap_parse_32_native(const void *buf) ··· 650 608 map->format.parse_val = regmap_parse_16_be; 651 609 map->format.parse_inplace = regmap_parse_16_be_inplace; 652 610 break; 611 + case REGMAP_ENDIAN_LITTLE: 612 + map->format.format_val = regmap_format_16_le; 613 + map->format.parse_val = regmap_parse_16_le; 614 + map->format.parse_inplace = regmap_parse_16_le_inplace; 615 + break; 653 616 case REGMAP_ENDIAN_NATIVE: 654 617 map->format.format_val = regmap_format_16_native; 655 618 map->format.parse_val = regmap_parse_16_native; ··· 675 628 map->format.format_val = regmap_format_32_be; 676 629 map->format.parse_val = regmap_parse_32_be; 677 630 map->format.parse_inplace = regmap_parse_32_be_inplace; 631 + break; 632 + case REGMAP_ENDIAN_LITTLE: 633 + map->format.format_val = regmap_format_32_le; 634 + map->format.parse_val = regmap_parse_32_le; 635 + map->format.parse_inplace = regmap_parse_32_le_inplace; 678 636 break; 679 637 case REGMAP_ENDIAN_NATIVE: 680 638 map->format.format_val = regmap_format_32_native;