Skip to content

Commit

Permalink
pwm: Add might_sleep() annotations for !CONFIG_PWM API functions
Browse files Browse the repository at this point in the history
The normal implementations of these functions make use of mutexes. To
make it obvious that these functions might sleep also add annotations to
the dummy implementations in the !CONFIG_PWM case.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
  • Loading branch information
Uwe Kleine-König authored and Thierry Reding committed Nov 5, 2021
1 parent 6f897a1 commit 27d9a4d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/linux/pwm.h
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,13 @@ struct pwm_device *devm_fwnode_pwm_get(struct device *dev,
#else
static inline struct pwm_device *pwm_request(int pwm_id, const char *label)
{
might_sleep();
return ERR_PTR(-ENODEV);
}

static inline void pwm_free(struct pwm_device *pwm)
{
might_sleep();
}

static inline int pwm_apply_state(struct pwm_device *pwm,
Expand Down Expand Up @@ -493,43 +495,50 @@ static inline struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
unsigned int index,
const char *label)
{
might_sleep();
return ERR_PTR(-ENODEV);
}

static inline struct pwm_device *pwm_get(struct device *dev,
const char *consumer)
{
might_sleep();
return ERR_PTR(-ENODEV);
}

static inline struct pwm_device *of_pwm_get(struct device *dev,
struct device_node *np,
const char *con_id)
{
might_sleep();
return ERR_PTR(-ENODEV);
}

static inline void pwm_put(struct pwm_device *pwm)
{
might_sleep();
}

static inline struct pwm_device *devm_pwm_get(struct device *dev,
const char *consumer)
{
might_sleep();
return ERR_PTR(-ENODEV);
}

static inline struct pwm_device *devm_of_pwm_get(struct device *dev,
struct device_node *np,
const char *con_id)
{
might_sleep();
return ERR_PTR(-ENODEV);
}

static inline struct pwm_device *
devm_fwnode_pwm_get(struct device *dev, struct fwnode_handle *fwnode,
const char *con_id)
{
might_sleep();
return ERR_PTR(-ENODEV);
}
#endif
Expand Down

0 comments on commit 27d9a4d

Please sign in to comment.