Commit 38ae7142 authored by Uwe Kleine-König's avatar Uwe Kleine-König
Browse files

pwm: Make pwmchip_[sg]et_drvdata() a wrapper around dev_set_drvdata()

Now that a pwm_chip has a dedicated struct device, pwmchip_set_drvdata()
and pwmchip_get_drvdata() can be made thin wrappers around
dev_set_drvdata() and dev_get_drvdata() respectively and the previously
needed pointer can be dropped from struct pwm_chip.

Link: https://lore.kernel.org/r/a5e05bd2d83421a26fdef6a87d69253c0f98becf.1710670958.git.u.kleine-koenig@pengutronix.de


Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent c6837aa1
Loading
Loading
Loading
Loading
+2 −12
Original line number Diff line number Diff line
@@ -274,7 +274,6 @@ struct pwm_ops {
 * @of_xlate: request a PWM device given a device tree PWM specifier
 * @atomic: can the driver's ->apply() be called in atomic context
 * @uses_pwmchip_alloc: signals if pwmchip_allow was used to allocate this chip
 * @driver_data: Private pointer for driver specific info
 * @pwms: array of PWM devices allocated by the framework
 */
struct pwm_chip {
@@ -290,7 +289,6 @@ struct pwm_chip {

	/* only used internally by the PWM framework */
	bool uses_pwmchip_alloc;
	void *driver_data;
	struct pwm_device pwms[] __counted_by(npwm);
};

@@ -301,20 +299,12 @@ static inline struct device *pwmchip_parent(const struct pwm_chip *chip)

static inline void *pwmchip_get_drvdata(struct pwm_chip *chip)
{
	/*
	 * After pwm_chip got a dedicated struct device, this can be replaced by
	 * dev_get_drvdata(&chip->dev);
	 */
	return chip->driver_data;
	return dev_get_drvdata(&chip->dev);
}

static inline void pwmchip_set_drvdata(struct pwm_chip *chip, void *data)
{
	/*
	 * After pwm_chip got a dedicated struct device, this can be replaced by
	 * dev_set_drvdata(&chip->dev, data);
	 */
	chip->driver_data = data;
	dev_set_drvdata(&chip->dev, data);
}

#if IS_ENABLED(CONFIG_PWM)