mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 02:36:21 +00:00
pwm: iqs620a: Create a wrapper for converting a pwm_chip to driver data
There is no semantic change. The new function just implements what was open-coded twice in the driver before. Link: https://lore.kernel.org/r/cc7ab547b4c4b79456b548aa72205bcf4476db8c.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
This commit is contained in:
parent
a1d81abc03
commit
8a18b97332
@ -40,6 +40,11 @@ struct iqs620_pwm_private {
|
|||||||
unsigned int duty_scale;
|
unsigned int duty_scale;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline struct iqs620_pwm_private *iqs620_pwm_from_chip(struct pwm_chip *chip)
|
||||||
|
{
|
||||||
|
return container_of(chip, struct iqs620_pwm_private, chip);
|
||||||
|
}
|
||||||
|
|
||||||
static int iqs620_pwm_init(struct iqs620_pwm_private *iqs620_pwm,
|
static int iqs620_pwm_init(struct iqs620_pwm_private *iqs620_pwm,
|
||||||
unsigned int duty_scale)
|
unsigned int duty_scale)
|
||||||
{
|
{
|
||||||
@ -73,7 +78,7 @@ static int iqs620_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
|
|||||||
if (state->period < IQS620_PWM_PERIOD_NS)
|
if (state->period < IQS620_PWM_PERIOD_NS)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
iqs620_pwm = container_of(chip, struct iqs620_pwm_private, chip);
|
iqs620_pwm = iqs620_pwm_from_chip(chip);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The duty cycle generated by the device is calculated as follows:
|
* The duty cycle generated by the device is calculated as follows:
|
||||||
@ -109,7 +114,7 @@ static int iqs620_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
|
|||||||
{
|
{
|
||||||
struct iqs620_pwm_private *iqs620_pwm;
|
struct iqs620_pwm_private *iqs620_pwm;
|
||||||
|
|
||||||
iqs620_pwm = container_of(chip, struct iqs620_pwm_private, chip);
|
iqs620_pwm = iqs620_pwm_from_chip(chip);
|
||||||
|
|
||||||
mutex_lock(&iqs620_pwm->lock);
|
mutex_lock(&iqs620_pwm->lock);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user