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

Configure Feed

Select the types of activity you want to include in your feed.

pinctrl: pinconf-generic: Convert ..._parse_dt_pinmux() to fwnode API

Convert pinconf_generic_parse_dt_pinmux() to fwnode API. This makes code
cleaner and potentially reusable for some other types of fwnodes, such as
software nodes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>

authored by

Andy Shevchenko and committed by
Linus Walleij
e238fb21 1fc7de30

+14 -13
+14 -13
drivers/pinctrl/pinconf-generic.c
··· 312 312 unsigned int **pid, unsigned int **pmux, 313 313 unsigned int *npins) 314 314 { 315 + struct fwnode_handle *fwnode = of_fwnode_handle(np); 315 316 unsigned int *pid_t; 316 317 unsigned int *pmux_t; 317 - struct property *prop; 318 318 unsigned int npins_t, i; 319 - u32 value; 320 319 int ret; 321 320 322 - prop = of_find_property(np, "pinmux", NULL); 323 - if (!prop) { 321 + ret = fwnode_property_count_u32(fwnode, "pinmux"); 322 + if (ret < 0) { 324 323 dev_info(dev, "Missing pinmux property\n"); 325 - return -ENOENT; 324 + return ret; 326 325 } 327 326 328 - npins_t = prop->length / sizeof(u32); 327 + npins_t = ret; 329 328 if (npins_t == 0) { 330 329 dev_info(dev, "pinmux property doesn't have entries\n"); 331 330 return -ENODATA; ··· 341 342 dev_err(dev, "kalloc memory fail\n"); 342 343 return -ENOMEM; 343 344 } 345 + 346 + ret = fwnode_property_read_u32_array(fwnode, "pinmux", pmux_t, npins_t); 347 + if (ret) { 348 + dev_err(dev, "get pinmux value fail\n"); 349 + goto exit; 350 + } 351 + 344 352 for (i = 0; i < npins_t; i++) { 345 - ret = of_property_read_u32_index(np, "pinmux", i, &value); 346 - if (ret) { 347 - dev_err(dev, "get pinmux value fail\n"); 348 - goto exit; 349 - } 350 - pmux_t[i] = value & 0xff; 351 - pid_t[i] = (value >> 8) & 0xffffff; 353 + pid_t[i] = pmux_t[i] >> 8; 354 + pmux_t[i] = pmux_t[i] & 0xff; 352 355 } 353 356 *pid = pid_t; 354 357 *pmux = pmux_t;