File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -350,6 +350,31 @@ static struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)
350350 return node ;
351351}
352352
353+ static void devm_icc_release (struct device * dev , void * res )
354+ {
355+ icc_put (* (struct icc_path * * )res );
356+ }
357+
358+ struct icc_path * devm_of_icc_get (struct device * dev , const char * name )
359+ {
360+ struct icc_path * * ptr , * path ;
361+
362+ ptr = devres_alloc (devm_icc_release , sizeof (* * ptr ), GFP_KERNEL );
363+ if (!ptr )
364+ return ERR_PTR (- ENOMEM );
365+
366+ path = of_icc_get (dev , name );
367+ if (!IS_ERR (path )) {
368+ * ptr = path ;
369+ devres_add (dev , ptr );
370+ } else {
371+ devres_free (ptr );
372+ }
373+
374+ return path ;
375+ }
376+ EXPORT_SYMBOL_GPL (devm_of_icc_get );
377+
353378/**
354379 * of_icc_get() - get a path handle from a DT node based on name
355380 * @dev: device pointer for the consumer device
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ struct device;
2828struct icc_path * icc_get (struct device * dev , const int src_id ,
2929 const int dst_id );
3030struct icc_path * of_icc_get (struct device * dev , const char * name );
31+ struct icc_path * devm_of_icc_get (struct device * dev , const char * name );
3132void icc_put (struct icc_path * path );
3233int icc_set_bw (struct icc_path * path , u32 avg_bw , u32 peak_bw );
3334void icc_set_tag (struct icc_path * path , u32 tag );
@@ -46,6 +47,12 @@ static inline struct icc_path *of_icc_get(struct device *dev,
4647 return NULL ;
4748}
4849
50+ static inline struct icc_path * devm_of_icc_get (struct device * dev ,
51+ const char * name )
52+ {
53+ return NULL ;
54+ }
55+
4956static inline void icc_put (struct icc_path * path )
5057{
5158}
You can’t perform that action at this time.
0 commit comments