Skip to content

Commit af89cd4

Browse files
Uwe Kleine-Königbebarino
authored andcommitted
clk: Improve documentation for devm_clk_get() and its optional variant
Make use of "Context:" and "Return:". Mention that the clk is not to be expected to be prepared, previously only not being enabled was mentioned which probably dates from the times when the concept of clk preparation wasn't invented yet. Also describe devm_clk_get_optional() fully instead of just referencing devm_clk_get(). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220520075737.758761-2-u.kleine-koenig@pengutronix.de Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent f2906aa commit af89cd4

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

include/linux/clk.h

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,15 +443,16 @@ int __must_check devm_clk_bulk_get_all(struct device *dev,
443443
* @dev: device for clock "consumer"
444444
* @id: clock consumer ID
445445
*
446-
* Returns a struct clk corresponding to the clock producer, or
446+
* Context: May sleep.
447+
*
448+
* Return: a struct clk corresponding to the clock producer, or
447449
* valid IS_ERR() condition containing errno. The implementation
448450
* uses @dev and @id to determine the clock consumer, and thereby
449451
* the clock producer. (IOW, @id may be identical strings, but
450452
* clk_get may return different clock producers depending on @dev.)
451453
*
452-
* Drivers must assume that the clock source is not enabled.
453-
*
454-
* devm_clk_get should not be called from within interrupt context.
454+
* Drivers must assume that the clock source is neither prepared nor
455+
* enabled.
455456
*
456457
* The clock will automatically be freed when the device is unbound
457458
* from the bus.
@@ -464,8 +465,20 @@ struct clk *devm_clk_get(struct device *dev, const char *id);
464465
* @dev: device for clock "consumer"
465466
* @id: clock consumer ID
466467
*
467-
* Behaves the same as devm_clk_get() except where there is no clock producer.
468-
* In this case, instead of returning -ENOENT, the function returns NULL.
468+
* Context: May sleep.
469+
*
470+
* Return: a struct clk corresponding to the clock producer, or
471+
* valid IS_ERR() condition containing errno. The implementation
472+
* uses @dev and @id to determine the clock consumer, and thereby
473+
* the clock producer. If no such clk is found, it returns NULL
474+
* which serves as a dummy clk. That's the only difference compared
475+
* to devm_clk_get().
476+
*
477+
* Drivers must assume that the clock source is neither prepared nor
478+
* enabled.
479+
*
480+
* The clock will automatically be freed when the device is unbound
481+
* from the bus.
469482
*/
470483
struct clk *devm_clk_get_optional(struct device *dev, const char *id);
471484

0 commit comments

Comments
 (0)