Skip to contentSkip to conversation

pwm: clps711x: Fix period calculation

PATCH Applied Alexander Shiyan 2 participants 4 messages Dec 19, 2018 – Dec 20, 2018 PWM

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 pwm: clps711x: Fix period calculation

Commit e39c0df1be5a ("pwm: Introduce the pwm_args concept") has changed the variable for the period for clps711x-pwm driver, so now pwm_get/set_period() works with pwm->state.period variable instead of pwm->args.period.
This patch changes the period variable in other places where it is used.

---
 drivers/pwm/pwm-clps711x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-clps711x.c +2 -2
index 26ec24e457b1..7e16b7def0dc 100644
@@ -48,7 +48,7 @@ static void clps711x_pwm_update_val(struct clps711x_chip *priv, u32 n, u32 v)
 static unsigned int clps711x_get_duty(struct pwm_device *pwm, unsigned int v)
 {
 	/* Duty cycle 0..15 max */
-	return DIV_ROUND_CLOSEST(v * 0xf, pwm_get_period(pwm));
+	return DIV_ROUND_CLOSEST(v * 0xf, pwm->args.period);
 }
 
 static int clps711x_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
@@ -71,7 +71,7 @@ static int clps711x_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
 	struct clps711x_chip *priv = to_clps711x_chip(chip);
 	unsigned int duty;
 
-	if (period_ns != pwm_get_period(pwm))
+	if (period_ns != pwm->args.period)
 		return -EINVAL;
 
 	duty = clps711x_get_duty(pwm, duty_ns);
Signature · 1 line
2.13.0
#1 lore raw

PATCH 2/2 pwm: clps711x: Switch to SPDX identifier

Adopt the SPDX license identifier headers to ease license compliance management.

---
 drivers/pwm/pwm-clps711x.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/pwm/pwm-clps711x.c +2 -7
index 7e16b7def0dc..924d39a797cf 100644
@@ -1,12 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Cirrus Logic CLPS711X PWM driver
- *
- * Copyright (C) 2014 Alexander Shiyan <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * Author: Alexander Shiyan <[email protected]>
  */
 
 #include <linux/clk.h>
Signature · 1 line
2.13.0
#2 lore raw

Re: [PATCH 2/2] pwm: clps711x: Switch to SPDX identifier

Quoted 29 lines · Alexander Shiyan

Adopt the SPDX license identifier headers to ease license compliance management.

---
 drivers/pwm/pwm-clps711x.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/pwm/pwm-clps711x.c +2 -7
index 7e16b7def0dc..924d39a797cf 100644
@@ -1,12 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Cirrus Logic CLPS711X PWM driver
- *
- * Copyright (C) 2014 Alexander Shiyan <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * Author: Alexander Shiyan <[email protected]>
  */
 
 #include <linux/clk.h>
Signature · 1 line
2.13.0

Applied, thanks.

Thierry

#3 lore raw
In reply to Alexander Shiyan
Quoted 25 lines · Alexander Shiyan

Commit e39c0df1be5a ("pwm: Introduce the pwm_args concept") has changed the variable for the period for clps711x-pwm driver, so now pwm_get/set_period() works with pwm->state.period variable instead of pwm->args.period.
This patch changes the period variable in other places where it is used.

---
 drivers/pwm/pwm-clps711x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-clps711x.c +1 -1
index 26ec24e457b1..7e16b7def0dc 100644
@@ -48,7 +48,7 @@ static void clps711x_pwm_update_val(struct clps711x_chip *priv, u32 n, u32 v)
 static unsigned int clps711x_get_duty(struct pwm_device *pwm, unsigned int v)
 {
 	/* Duty cycle 0..15 max */
-	return DIV_ROUND_CLOSEST(v * 0xf, pwm_get_period(pwm));
+	return DIV_ROUND_CLOSEST(v * 0xf, pwm->args.period);
 }
 
 static int clps711x_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)

drivers/pwm/pwm-clps711x.c static int clps711x_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, · line 77

Quoted 8 lines
drivers/pwm/pwm-clps711x.c +1 -1
@@ -71,7 +71,7 @@ static int clps711x_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
 	struct clps711x_chip *priv = to_clps711x_chip(chip);
 	unsigned int duty;
 
-	if (period_ns != pwm_get_period(pwm))
+	if (period_ns != pwm->args.period)
 		return -EINVAL;
 
 	duty = clps711x_get_duty(pwm, duty_ns);

Applied, thanks.

Thierry