core.c (25419de1b8dda24f3e02478b12b724a9b0cc4e78) | core.c (878ec1a9f0e5a6b344c12fdc349ec7cb036c2a42) |
---|---|
1/* 2 * Generic OPP Interface 3 * 4 * Copyright (C) 2009-2010 Texas Instruments Incorporated. 5 * Nishanth Menon 6 * Romit Dasgupta 7 * Kevin Hilman 8 * --- 1202 unchanged lines hidden (view full) --- 1211 * This is required only for the V2 bindings, and it enables a platform to 1212 * specify the extn to be used for certain property names. The properties to 1213 * which the extension will apply are opp-microvolt and opp-microamp. OPP core 1214 * should postfix the property name with -<name> while looking for them. 1215 */ 1216struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name) 1217{ 1218 struct opp_table *opp_table; | 1/* 2 * Generic OPP Interface 3 * 4 * Copyright (C) 2009-2010 Texas Instruments Incorporated. 5 * Nishanth Menon 6 * Romit Dasgupta 7 * Kevin Hilman 8 * --- 1202 unchanged lines hidden (view full) --- 1211 * This is required only for the V2 bindings, and it enables a platform to 1212 * specify the extn to be used for certain property names. The properties to 1213 * which the extension will apply are opp-microvolt and opp-microamp. OPP core 1214 * should postfix the property name with -<name> while looking for them. 1215 */ 1216struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name) 1217{ 1218 struct opp_table *opp_table; |
1219 int ret; | |
1220 1221 opp_table = dev_pm_opp_get_opp_table(dev); 1222 if (!opp_table) 1223 return ERR_PTR(-ENOMEM); 1224 1225 /* Make sure there are no concurrent readers while updating opp_table */ 1226 WARN_ON(!list_empty(&opp_table->opp_list)); 1227 | 1219 1220 opp_table = dev_pm_opp_get_opp_table(dev); 1221 if (!opp_table) 1222 return ERR_PTR(-ENOMEM); 1223 1224 /* Make sure there are no concurrent readers while updating opp_table */ 1225 WARN_ON(!list_empty(&opp_table->opp_list)); 1226 |
1228 /* Do we already have a prop-name associated with opp_table? */ 1229 if (opp_table->prop_name) { 1230 dev_err(dev, "%s: Already have prop-name %s\n", __func__, 1231 opp_table->prop_name); 1232 ret = -EBUSY; 1233 goto err; 1234 } | 1227 /* Another CPU that shares the OPP table has set the property ? */ 1228 if (opp_table->prop_name) 1229 return opp_table; |
1235 1236 opp_table->prop_name = kstrdup(name, GFP_KERNEL); 1237 if (!opp_table->prop_name) { | 1230 1231 opp_table->prop_name = kstrdup(name, GFP_KERNEL); 1232 if (!opp_table->prop_name) { |
1238 ret = -ENOMEM; 1239 goto err; | 1233 dev_pm_opp_put_opp_table(opp_table); 1234 return ERR_PTR(-ENOMEM); |
1240 } 1241 1242 return opp_table; | 1235 } 1236 1237 return opp_table; |
1243 1244err: 1245 dev_pm_opp_put_opp_table(opp_table); 1246 1247 return ERR_PTR(ret); | |
1248} 1249EXPORT_SYMBOL_GPL(dev_pm_opp_set_prop_name); 1250 1251/** 1252 * dev_pm_opp_put_prop_name() - Releases resources blocked for prop-name 1253 * @opp_table: OPP table returned by dev_pm_opp_set_prop_name(). 1254 * 1255 * This is required only for the V2 bindings, and is called for a matching 1256 * dev_pm_opp_set_prop_name(). Until this is called, the opp_table structure 1257 * will not be freed. 1258 */ 1259void dev_pm_opp_put_prop_name(struct opp_table *opp_table) 1260{ 1261 /* Make sure there are no concurrent readers while updating opp_table */ 1262 WARN_ON(!list_empty(&opp_table->opp_list)); 1263 | 1238} 1239EXPORT_SYMBOL_GPL(dev_pm_opp_set_prop_name); 1240 1241/** 1242 * dev_pm_opp_put_prop_name() - Releases resources blocked for prop-name 1243 * @opp_table: OPP table returned by dev_pm_opp_set_prop_name(). 1244 * 1245 * This is required only for the V2 bindings, and is called for a matching 1246 * dev_pm_opp_set_prop_name(). Until this is called, the opp_table structure 1247 * will not be freed. 1248 */ 1249void dev_pm_opp_put_prop_name(struct opp_table *opp_table) 1250{ 1251 /* Make sure there are no concurrent readers while updating opp_table */ 1252 WARN_ON(!list_empty(&opp_table->opp_list)); 1253 |
1264 if (!opp_table->prop_name) { 1265 pr_err("%s: Doesn't have a prop-name\n", __func__); 1266 return; 1267 } 1268 | |
1269 kfree(opp_table->prop_name); 1270 opp_table->prop_name = NULL; 1271 1272 dev_pm_opp_put_opp_table(opp_table); 1273} 1274EXPORT_SYMBOL_GPL(dev_pm_opp_put_prop_name); 1275 1276static int _allocate_set_opp_data(struct opp_table *opp_table) --- 530 unchanged lines hidden --- | 1254 kfree(opp_table->prop_name); 1255 opp_table->prop_name = NULL; 1256 1257 dev_pm_opp_put_opp_table(opp_table); 1258} 1259EXPORT_SYMBOL_GPL(dev_pm_opp_put_prop_name); 1260 1261static int _allocate_set_opp_data(struct opp_table *opp_table) --- 530 unchanged lines hidden --- |