From patchwork Mon May 16 09:42:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 573583 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02BD4C433F5 for ; Mon, 16 May 2022 09:42:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240904AbiEPJmc (ORCPT ); Mon, 16 May 2022 05:42:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236645AbiEPJmb (ORCPT ); Mon, 16 May 2022 05:42:31 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3AA932041; Mon, 16 May 2022 02:42:30 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 0DD0B1F427D0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1652694149; bh=4mIF+ychqwYJm8NY5gdtpfE5cKMCOU+a1wS2818V+qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eYgTkNrcd4N5IVPGgb1LKWPB9xap3fAhms20vvS9IXta7ijFxGyBuMOD5Sn7uD2i8 kK9eOJtgRQDs7rKaFCTHR2jCoazmuyKhUC1/TFvnw9JOCQWwISlh6islxLaKyEE5nL ns6tqtXyTQKHTurEL7Ad70sRt44a0PV2SdNTfvc7h3jXC0hI1GOABzSoDgS5y7il9e z0pMd5fOvX15fyGr5WB3m/BO9+NuJwwzZmZfL+ytmm09ORGtU/Z+st3YcZaSiYq3zS Zq6TSRlEBoPAFntG3f6EcvE7hLJSp7LfKTsS3xg9IMCMrwfyTltjIxtRLAIsMWyDfz SuBJeBY05BYlg== From: AngeloGioacchino Del Regno To: sean.wang@mediatek.com Cc: pavel@ucw.cz, matthias.bgg@gmail.com, linux-leds@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com, AngeloGioacchino Del Regno Subject: [PATCH 2/3] leds: leds-mt6323: Open code and drop MT6323_CAL_HW_DUTY macro Date: Mon, 16 May 2022 11:42:21 +0200 Message-Id: <20220516094222.30414-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220516094222.30414-1-angelogioacchino.delregno@collabora.com> References: <20220516094222.30414-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org 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 --- 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)