From mboxrd@z Thu Jan 1 00:00:00 1970 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 1D11DC433EF for ; Thu, 28 Apr 2022 11:51:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235256AbiD1LyV (ORCPT ); Thu, 28 Apr 2022 07:54:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235128AbiD1LyU (ORCPT ); Thu, 28 Apr 2022 07:54:20 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E38B871DA7; Thu, 28 Apr 2022 04:51:05 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id gh6so9129835ejb.0; Thu, 28 Apr 2022 04:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=egD9TWiQgZ00ABqrlpVUqX07Bqzo15fCup+voob9j6g=; b=WL1Az0l4M71t6wH3bpologdHI+2TTcuoscgjnsBJKMEICZric1CBnR4C+iqFz40wp2 WduxOA3DY68wKKncU5lIgYNo3SNSThAyo7vsLzBPYwn90G7eAkr+t2XUGZAoEIvL3XXl ONaIN7YHpPSW3nloam1m74lWGBzKVTCkfJ7C7Vzfs89uM5mllkCSsiNClcUaos4lvRtS 288uNt0JBuhVd9u4Wc70I6n9QqasFOhbZbGnut7fp6kl34H0ZJwMLWrpcF9Of1kHY2eF CDcaFvF98+zajvfK2GhQf5AR+uNasFZ0WElVRW1r7LER7Viun70c9lwZbOjsnUIKowOK 9Ijg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=egD9TWiQgZ00ABqrlpVUqX07Bqzo15fCup+voob9j6g=; b=Cup4COTLQBOEOxRKI0HPRaKIciT+QFf7ZYnHmzhUZhTWWVhSEensOweN87ORE3XmAQ Cuq9M+B8o1J624lphAy+Y7jDt5B2O0Z0YdxpuwjwWjFkUwoQtg3CwnAD2URLUgVkiirN QcLL4vdnxOCBJVdwL+18gBVU+7v0xXpmnaKxyg1OLDjFo6+UxGls95OfEmoWkcSWYYxS 9+nMb+zUQ4Z1jPiDMQkhG4DHMFaRorFfEZjYC4eq9GVBSZ/1QfwxJHyWnOBgPgNn+5wh hWs0i9d/Cj9tzkYBifRuzCPYgcDgOhgzJ2IKcjtTsEPZf4XkYVL3AvSpnKYMjBHLkBsX VaBw== X-Gm-Message-State: AOAM530BdOaU5YoJXKsWa76aKRa+hCJltrDuktYMJzMeEL2uK+cNemGd ii5TMakQD2n4Q5lFNhnBXSgEDZgC8pUVYY668vg= X-Google-Smtp-Source: ABdhPJz7sphZYsAcSHkuYWOXutg/BiHeCdlfJ7IswfBYScK2TZOjRTZA+jBvaIFK4z2tXF9uaATwhh/UhZCbUQlMNqY= X-Received: by 2002:a17:906:c147:b0:6df:f047:1677 with SMTP id dp7-20020a170906c14700b006dff0471677mr30824800ejc.4.1651146664432; Thu, 28 Apr 2022 04:51:04 -0700 (PDT) MIME-Version: 1.0 References: <1651138365-17362-1-git-send-email-u0084500@gmail.com> <1651138365-17362-5-git-send-email-u0084500@gmail.com> In-Reply-To: <1651138365-17362-5-git-send-email-u0084500@gmail.com> From: Matti Vaittinen Date: Thu, 28 Apr 2022 14:50:53 +0300 Message-ID: Subject: Re: [PATCH 4/4] leds: flash: mt6360: Add mt6360 isnk channel hardwre breath mode support To: cy_huang Cc: Pavel Machek , Matthias Brugger , ChiYuan Huang , Jacek Anaszewski , Gene Chen , linux-leds@vger.kernel.org, linux-arm Mailing List , "moderated list:ARM/Mediatek SoC support" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Hi ChiYuan! On Thu, Apr 28, 2022 at 1:03 PM cy_huang wrote: > From: ChiYuan Huang > > Add mt6360 isnk channel hardware breath mode support. > > Signed-off-by: ChiYuan Huang > > +static int mt6360_gen_breath_reg_config(struct led_pattern *pattern, u32 len, > + u8 *vals, int val_len) > +{ > + static const struct linear_range tranges[MT6360_ILED_RANGE_MAX] = { > + { 125, 0, 15, 250 }, /* tr/f12 and ton, unit: millisecond */ > + { 250, 0, 15, 500 }, /* toff, unit: millisecond */ > + }; It's nice to see you are using the linear_ranges helpers here! Just a minor remark - do you think you could use field names in linear_ranges initializations? That would make it less likely the driver breaks if someone changes the struct linear_range definition. Eg, use something like: static const struct linear_range tranges[MT6360_ILED_RANGE_MAX] = { /* tr/f12 and ton, unit: millisecond */ { .min = 125, .min_sel = 0, .max_sel = 15, .step = 250 }, /* toff, unit: millisecond */ { .min = 250, .min_sel = 0, .max_sel = 15, .step = 500 }, }; Do you think that would work? Best Regards -- Matti -- Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~ Discuss - Estimate - Plan - Report and finally accomplish this: void do_work(int time) __attribute__ ((const));