bulk.c (818b26588994d9d95743fca0a427f08ec6c1c41d) | bulk.c (2fcfa72fc13f0203bb676bd1ec30ec85e17855be) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2 3#include <linux/interconnect-provider.h> 4#include <linux/device.h> 5#include <linux/export.h> 6 7/** 8 * of_icc_bulk_get() - get interconnect paths --- 101 unchanged lines hidden (view full) --- 110 * @paths: the icc_bulk_data table containing the paths and bandwidth 111 */ 112void icc_bulk_disable(int num_paths, const struct icc_bulk_data *paths) 113{ 114 while (--num_paths >= 0) 115 icc_disable(paths[num_paths].path); 116} 117EXPORT_SYMBOL_GPL(icc_bulk_disable); | 1// SPDX-License-Identifier: GPL-2.0 2 3#include <linux/interconnect-provider.h> 4#include <linux/device.h> 5#include <linux/export.h> 6 7/** 8 * of_icc_bulk_get() - get interconnect paths --- 101 unchanged lines hidden (view full) --- 110 * @paths: the icc_bulk_data table containing the paths and bandwidth 111 */ 112void icc_bulk_disable(int num_paths, const struct icc_bulk_data *paths) 113{ 114 while (--num_paths >= 0) 115 icc_disable(paths[num_paths].path); 116} 117EXPORT_SYMBOL_GPL(icc_bulk_disable); |
118 119struct icc_bulk_devres { 120 struct icc_bulk_data *paths; 121 int num_paths; 122}; 123 124static void devm_icc_bulk_release(struct device *dev, void *res) 125{ 126 struct icc_bulk_devres *devres = res; 127 128 icc_bulk_put(devres->num_paths, devres->paths); 129} 130 131/** 132 * devm_of_icc_bulk_get() - resource managed of_icc_bulk_get 133 * @dev: the device requesting the path 134 * @num_paths: the number of icc_bulk_data 135 * @paths: the table with the paths we want to get 136 * 137 * Returns 0 on success or negative errno otherwise. 138 */ 139int devm_of_icc_bulk_get(struct device *dev, int num_paths, struct icc_bulk_data *paths) 140{ 141 struct icc_bulk_devres *devres; 142 int ret; 143 144 devres = devres_alloc(devm_icc_bulk_release, sizeof(*devres), GFP_KERNEL); 145 if (!devres) 146 return -ENOMEM; 147 148 ret = of_icc_bulk_get(dev, num_paths, paths); 149 if (!ret) { 150 devres->paths = paths; 151 devres->num_paths = num_paths; 152 devres_add(dev, devres); 153 } else { 154 devres_free(devres); 155 } 156 157 return ret; 158} 159EXPORT_SYMBOL_GPL(devm_of_icc_bulk_get); |
|