diff options
| author | Uwe Kleine-König <u.kleine-koenig@baylibre.com> | 2025-04-17 21:16:11 +0300 | 
|---|---|---|
| committer | Uwe Kleine-König <ukleinek@kernel.org> | 2025-04-24 17:43:54 +0300 | 
| commit | 7f8ce4d88b42fcbd3350370ec4d02e00979fc5a9 (patch) | |
| tree | 82b93c4c0d1f8bd569b9981468ea7daca26c1a1c | |
| parent | 061f087f5d0bcae9f43ae0101121fcaa999d2809 (diff) | |
| download | linux-7f8ce4d88b42fcbd3350370ec4d02e00979fc5a9.tar.xz | |
pwm: Fix various formatting issues in kernel-doc
Add Return and (where interesting) Context sections, fix some formatting
and drop documenting the internal function __pwm_apply().
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/20250417181611.2693599-2-u.kleine-koenig@baylibre.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
| -rw-r--r-- | drivers/pwm/core.c | 42 | ||||
| -rw-r--r-- | include/linux/pwm.h | 8 | 
2 files changed, 32 insertions, 18 deletions
| diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 079964961bd8..e0a90c4cd723 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -216,14 +216,14 @@ static int __pwm_write_waveform(struct pwm_chip *chip, struct pwm_device *pwm, c   *   * Typically a given waveform cannot be implemented exactly by hardware, e.g.   * because hardware only supports coarse period resolution or no duty_offset. - * This function returns the actually implemented waveform if you pass wf to - * pwm_set_waveform_might_sleep now. + * This function returns the actually implemented waveform if you pass @wf to + * pwm_set_waveform_might_sleep() now.   *   * Note however that the world doesn't stop turning when you call it, so when - * doing + * doing::   * - * 	pwm_round_waveform_might_sleep(mypwm, &wf); - * 	pwm_set_waveform_might_sleep(mypwm, &wf, true); + *   pwm_round_waveform_might_sleep(mypwm, &wf); + *   pwm_set_waveform_might_sleep(mypwm, &wf, true);   *   * the latter might fail, e.g. because an input clock changed its rate between   * these two calls and the waveform determined by @@ -233,8 +233,9 @@ static int __pwm_write_waveform(struct pwm_chip *chip, struct pwm_device *pwm, c   * value (in the order period_length_ns, duty_length_ns and then   * duty_offset_ns). Only if this isn't possible, a value might grow.   * - * Returns 0 on success, 1 if at least one value had to be rounded up or a + * Returns: 0 on success, 1 if at least one value had to be rounded up or a   * negative errno. + * Context: May sleep.   */  int pwm_round_waveform_might_sleep(struct pwm_device *pwm, struct pwm_waveform *wf)  { @@ -291,6 +292,9 @@ EXPORT_SYMBOL_GPL(pwm_round_waveform_might_sleep);   *   * Stores the current configuration of the PWM in @wf. Note this is the   * equivalent of pwm_get_state_hw() (and not pwm_get_state()) for pwm_waveform. + * + * Returns: 0 on success or a negative errno + * Context: May sleep.   */  int pwm_get_waveform_might_sleep(struct pwm_device *pwm, struct pwm_waveform *wf)  { @@ -399,13 +403,17 @@ static int __pwm_set_waveform(struct pwm_device *pwm,   *   * Typically a requested waveform cannot be implemented exactly, e.g. because   * you requested .period_length_ns = 100 ns, but the hardware can only set - * periods that are a multiple of 8.5 ns. With that hardware passing exact = + * periods that are a multiple of 8.5 ns. With that hardware passing @exact =   * true results in pwm_set_waveform_might_sleep() failing and returning 1. If - * exact = false you get a period of 93.5 ns (i.e. the biggest period not bigger + * @exact = false you get a period of 93.5 ns (i.e. the biggest period not bigger   * than the requested value). - * Note that even with exact = true, some rounding by less than 1 is + * Note that even with @exact = true, some rounding by less than 1 ns is   * possible/needed. In the above example requesting .period_length_ns = 94 and - * exact = true, you get the hardware configured with period = 93.5 ns. + * @exact = true, you get the hardware configured with period = 93.5 ns. + * + * Returns: 0 on success, 1 if was rounded up (if !@exact) or no perfect match was + * possible (if @exact), or a negative errno + * Context: May sleep.   */  int pwm_set_waveform_might_sleep(struct pwm_device *pwm,  				 const struct pwm_waveform *wf, bool exact) @@ -565,11 +573,6 @@ static bool pwm_state_valid(const struct pwm_state *state)  	return true;  } -/** - * __pwm_apply() - atomically apply a new state to a PWM device - * @pwm: PWM device - * @state: new state to apply - */  static int __pwm_apply(struct pwm_device *pwm, const struct pwm_state *state)  {  	struct pwm_chip *chip; @@ -678,6 +681,9 @@ static int __pwm_apply(struct pwm_device *pwm, const struct pwm_state *state)   * Cannot be used in atomic context.   * @pwm: PWM device   * @state: new state to apply + * + * Returns: 0 on success, or a negative errno + * Context: May sleep.   */  int pwm_apply_might_sleep(struct pwm_device *pwm, const struct pwm_state *state)  { @@ -719,6 +725,9 @@ EXPORT_SYMBOL_GPL(pwm_apply_might_sleep);   * Not all PWM devices support this function, check with pwm_might_sleep().   * @pwm: PWM device   * @state: new state to apply + * + * Returns: 0 on success, or a negative errno + * Context: Any   */  int pwm_apply_atomic(struct pwm_device *pwm, const struct pwm_state *state)  { @@ -792,6 +801,9 @@ EXPORT_SYMBOL_GPL(pwm_get_state_hw);   * This function will adjust the PWM config to the PWM arguments provided   * by the DT or PWM lookup table. This is particularly useful to adapt   * the bootloader config to the Linux one. + * + * Returns: 0 on success or a negative error code on failure. + * Context: May sleep.   */  int pwm_adjust_config(struct pwm_device *pwm)  { diff --git a/include/linux/pwm.h b/include/linux/pwm.h index bf0469b2201d..63a17d2b4ec8 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -218,6 +218,8 @@ static inline void pwm_init_state(const struct pwm_device *pwm,   *   * pwm_get_state(pwm, &state);   * duty = pwm_get_relative_duty_cycle(&state, 100); + * + * Returns: rounded relative duty cycle multiplied by @scale   */  static inline unsigned int  pwm_get_relative_duty_cycle(const struct pwm_state *state, unsigned int scale) @@ -244,8 +246,8 @@ pwm_get_relative_duty_cycle(const struct pwm_state *state, unsigned int scale)   * pwm_set_relative_duty_cycle(&state, 50, 100);   * pwm_apply_might_sleep(pwm, &state);   * - * This functions returns -EINVAL if @duty_cycle and/or @scale are - * inconsistent (@scale == 0 or @duty_cycle > @scale). + * Returns: 0 on success or ``-EINVAL`` if @duty_cycle and/or @scale are + * inconsistent (@scale == 0 or @duty_cycle > @scale)   */  static inline int  pwm_set_relative_duty_cycle(struct pwm_state *state, unsigned int duty_cycle, @@ -351,7 +353,7 @@ struct pwm_chip {   * pwmchip_supports_waveform() - checks if the given chip supports waveform callbacks   * @chip: The pwm_chip to test   * - * Returns true iff the pwm chip support the waveform functions like + * Returns: true iff the pwm chip support the waveform functions like   * pwm_set_waveform_might_sleep() and pwm_round_waveform_might_sleep()   */  static inline bool pwmchip_supports_waveform(struct pwm_chip *chip) | 
