Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2835554rdb; Tue, 12 Sep 2023 13:42:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFD4xJ5mwqIkRRZMfdHr1IDN14blDUB/iAWaTQ9hEPCYNxS96INAZFrsrENBq6YX7cXUztm X-Received: by 2002:a05:6a20:12cc:b0:137:2f8c:fab0 with SMTP id v12-20020a056a2012cc00b001372f8cfab0mr686200pzg.49.1694551329857; Tue, 12 Sep 2023 13:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694551329; cv=none; d=google.com; s=arc-20160816; b=alz9GnzgpMOamqCeOXXdpc6a03iIn1OvJlm2+6VHz9q50L15A9yy6OjQ/K6dT4awmT keC83g789tW9FNbGMDiQedp9zp1Q4a9xVzPh9SluSS9Z0JW9Zg49AFIoTpSP6Ue6+jsM MHjV9Z5ELXeJdPQLZBqeqLjeXYFo1CLHyLVKnIxLUPUOPdSyw6vM+QCWpRw2DDZhkIIZ lxhKVgIM31zFhsRc8BD3I+11HfDkWEWvgW7wnfbEDIyfR9W8k6brGTEw4WBMLro15k/n Q20n2rDR4wfGg4WdnxY0iqhiby9dhaNviy6igjMlsYS0RsXh6FavCzCtU+g4a9B8I/Kz c9jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=BwabbmNDfoIMMoHR0PGecCbV9RImTYt/EdYJHgvIvUQ=; fh=EFw0U173UrUb2GPBKtQ9bkzm5+gfHG+C9io7QRnsx8M=; b=dq17oJeDCN6GxnPH8tiwh4vCQv20+J085J/+WBO83GFLTHUbgDwQ/cOG9X+vRfEBrA WKf+TSYcYByS0uTvhv/XrWhDloM74WXpdpK+ek+CqTFU5G6kmZK0rYG+abE6mW3cP5JZ kgYmdQKsrsafeBT07rWVBxXyC0oX49EPHb4kHxMbtL0shXqzNYL4LtL9w6cAR3q1FOzm vW/kpWB5EuPYl2Brs6oD/QyGKO+gu4Jvqya47Re0ZoN2XSPz3hwU0mh7Pva1wnG7Sg/J 5TvHBaj65m25HWASSkMhQaXjtqEs1uYMx1R5BfE6KRI59NHPhbc57HAdNpK6mWeM6Mph CXZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=OX266sJk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id r20-20020a6560d4000000b0057744d09d15si6614588pgv.63.2023.09.12.13.42.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 13:42:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=OX266sJk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 0D4CC823CA26; Tue, 12 Sep 2023 11:24:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237399AbjILSYQ (ORCPT + 99 others); Tue, 12 Sep 2023 14:24:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237394AbjILSYN (ORCPT ); Tue, 12 Sep 2023 14:24:13 -0400 Received: from smtp.smtpout.orange.fr (smtp-29.smtpout.orange.fr [80.12.242.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BA1110EF for ; Tue, 12 Sep 2023 11:24:09 -0700 (PDT) Received: from [192.168.1.18] ([86.243.2.178]) by smtp.orange.fr with ESMTPA id g83RqRmrEiBkug83RqO2gs; Tue, 12 Sep 2023 20:24:07 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1694543048; bh=BwabbmNDfoIMMoHR0PGecCbV9RImTYt/EdYJHgvIvUQ=; h=Date:Subject:From:To:References:In-Reply-To; b=OX266sJkHDWwgsJE5jCRB/QTRp50ddmqYY9P8Ul1ifjJBVPIxR4PPvO2+5UeejbxO mZmBNovtlnpkwro8LTEixZeQcqDYt3KlaH5rguQcmSnJSswX4B7vWyIjRdbI/FsxTE PJz5/a4gpD7QYUInCrAGGHKPNgqxYfDaxy0dLXgPspYNIwVRQlbuv1TaNSsq+3IaNS GGpr7heMMJ4G93QQ1SjuBDVCdzixU7vyr9WhecfI19T9kkmakyxeJzUEpv0ShVloC1 IEZWX9woPVmVwgs+T8/cT5WuPo+BBDvm6fYMENko4biUvv3oEHGSp3Vzne7/BAjbsu TYSBRyEpgnGVg== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 12 Sep 2023 20:24:07 +0200 X-ME-IP: 86.243.2.178 Message-ID: Date: Tue, 12 Sep 2023 20:24:05 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH v3 4/5] clk: twl: add clock driver for TWL6032 Content-Language: fr From: Marion & Christophe JAILLET To: Andreas Kemnade , dmitry.torokhov@gmail.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, lee@kernel.org, bcousson@baylibre.com, tony@atomide.com, mturquette@baylibre.com, sboyd@kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-clk@vger.kernel.org References: <20230911221346.1484543-1-andreas@kemnade.info> <20230911221346.1484543-5-andreas@kemnade.info> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 12 Sep 2023 11:24:27 -0700 (PDT) X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Le 12/09/2023 à 19:15, Christophe JAILLET a écrit : > Le 12/09/2023 à 00:13, Andreas Kemnade a écrit : >> The TWL6032 has some clock outputs which are controlled like >> fixed-voltage regulators, in some drivers for these chips >> found in the wild, just the regulator api is abused for controlling >> them, so simply use something similar to the regulator functions. >> Due to a lack of hardware available for testing, leave out the >> TWL6030-specific part of those functions. >> >> Signed-off-by: Andreas Kemnade >> --- >>   drivers/clk/Kconfig   |   9 ++ >>   drivers/clk/Makefile  |   1 + >>   drivers/clk/clk-twl.c | 197 ++++++++++++++++++++++++++++++++++++++++++ >>   3 files changed, 207 insertions(+) >>   create mode 100644 drivers/clk/clk-twl.c >> > > ... > >> +static int twl_clks_probe(struct platform_device *pdev) >> +{ >> +    struct clk_hw_onecell_data *clk_data; >> +    const struct twl_clks_data *hw_data; >> + >> +    struct twl_clock_info *cinfo; >> +    int ret; >> +    int i; >> +    int count; >> + >> +    hw_data = twl6032_clks; >> +    for (count = 0; hw_data[count].init.name; count++) >> +        ; > > Nit: does removing the /* sentinel */ and using > ARRAY_SIZE(twl_clks_data) would make sense and be simpler? > > CJ > >> + >> +    clk_data = devm_kzalloc(&pdev->dev, >> +                struct_size(clk_data, hws, count), >> +                GFP_KERNEL); >> +    if (!clk_data) >> +        return -ENOMEM; >> + >> +    clk_data->num = count; >> +    cinfo = devm_kcalloc(&pdev->dev, count, sizeof(*cinfo), GFP_KERNEL); >> +    if (!cinfo) >> +        return -ENOMEM; >> + >> +    for (i = 0; i < count; i++) { >> +        cinfo[i].base = hw_data[i].base; >> +        cinfo[i].dev = &pdev->dev; >> +        cinfo[i].hw.init = &hw_data[i].init; >> +        ret = devm_clk_hw_register(&pdev->dev, &cinfo[i].hw); >> +        if (ret) { >> +            dev_err(&pdev->dev, "Fail to register clock %s, %d\n", >> +                hw_data[i].init.name, ret); >> +            return ret; >> +        } >> +        clk_data->hws[i] = &cinfo[i].hw; >> +    } >> + >> +    ret = devm_of_clk_add_hw_provider(&pdev->dev, >> +                      of_clk_hw_onecell_get, clk_data); >> +    if (ret < 0) >> +        dev_err(&pdev->dev, "Fail to add clock driver, %d\n", ret); >> + >> +    return ret; > > Nit: should there be a V4, some prefer return 0 to be more explicit. Oops, no, or a "return ret;" should be added as well a few lines above (it would more future proof, so) > >> +} > > ... > >