clk: Consolidate some clock functions
These functions are exactly the same as their "nodev" varients, except they accept a device and not an ofnode. Rewrite them to just call the other function. Signed-off-by: Sean Anderson <seanga2@gmail.com> Link: https://lore.kernel.org/r/20220227190113.1617498-1-seanga2@gmail.com
This commit is contained in:
		
							parent
							
								
									ac15e789ca
								
							
						
					
					
						commit
						e7075ff7b3
					
				| 
						 | 
					@ -138,14 +138,7 @@ static int clk_get_by_indexed_prop(struct udevice *dev, const char *prop_name,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int clk_get_by_index(struct udevice *dev, int index, struct clk *clk)
 | 
					int clk_get_by_index(struct udevice *dev, int index, struct clk *clk)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct ofnode_phandle_args args;
 | 
						return clk_get_by_index_nodev(dev_ofnode(dev), index, clk);
 | 
				
			||||||
	int ret;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ret = dev_read_phandle_with_args(dev, "clocks", "#clock-cells", 0,
 | 
					 | 
				
			||||||
					 index, &args);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return clk_get_by_index_tail(ret, dev_ofnode(dev), &args, "clocks",
 | 
					 | 
				
			||||||
				     index, clk);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int clk_get_by_index_nodev(ofnode node, int index, struct clk *clk)
 | 
					int clk_get_by_index_nodev(ofnode node, int index, struct clk *clk)
 | 
				
			||||||
| 
						 | 
					@ -400,18 +393,7 @@ int clk_set_defaults(struct udevice *dev, enum clk_defaults_stage stage)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk)
 | 
					int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int index;
 | 
						return clk_get_by_name_nodev(dev_ofnode(dev), name, clk);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	debug("%s(dev=%p, name=%s, clk=%p)\n", __func__, dev, name, clk);
 | 
					 | 
				
			||||||
	clk->dev = NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	index = dev_read_stringlist_search(dev, "clock-names", name);
 | 
					 | 
				
			||||||
	if (index < 0) {
 | 
					 | 
				
			||||||
		debug("fdt_stringlist_search() failed: %d\n", index);
 | 
					 | 
				
			||||||
		return index;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return clk_get_by_index(dev, index, clk);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif /* OF_REAL */
 | 
					#endif /* OF_REAL */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue