[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220915091214.59673-3-angelogioacchino.delregno@collabora.com>
Date: Thu, 15 Sep 2022 11:12:09 +0200
From: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
To: sean.wang@...iatek.com
Cc: pavel@....cz, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, matthias.bgg@...il.com,
linux-leds@...r.kernel.org, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
Subject: [PATCH 2/7] leds: leds-mt6323: Open code and drop MT6323_CAL_HW_DUTY macro
There is only one instance of using this macro and it's anyway not
simplifying the flow, or increasing the readability of this driver.
Drop this macro by open coding it in mt6323_led_set_blink().
No functional changes.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
---
drivers/leds/leds-mt6323.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/leds/leds-mt6323.c b/drivers/leds/leds-mt6323.c
index a7d1ed370969..fa9d251e9efa 100644
--- a/drivers/leds/leds-mt6323.c
+++ b/drivers/leds/leds-mt6323.c
@@ -62,8 +62,6 @@
#define MT6323_ISINK_CH_EN(i) BIT(i)
#define MAX_SUPPORTED_LEDS 8
-#define MT6323_CAL_HW_DUTY(o, p, u) DIV_ROUND_CLOSEST((o) * 100000ul,\
- (p) * (u))
struct mt6323_leds;
@@ -321,7 +319,7 @@ static int mt6323_led_set_blink(struct led_classdev *cdev,
* Calculate duty_hw based on the percentage of period during
* which the led is ON.
*/
- duty_hw = MT6323_CAL_HW_DUTY(*delay_on, period, spec->unit_duty);
+ duty_hw = DIV_ROUND_CLOSEST(*delay_on * 100000ul, period * spec->unit_duty);
/* hardware doesn't support zero duty cycle. */
if (!duty_hw)
--
2.37.2
Powered by blists - more mailing lists