Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1064255rdb; Fri, 20 Oct 2023 07:32:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF4Iz/WNjQROj+pXBvqU20gMkWosxKWhqlIFO+l6xxZ90/DXSprjWTqpQHQ4MWptDcT+TTo X-Received: by 2002:a05:6a21:47ca:b0:15d:5f9a:3921 with SMTP id as10-20020a056a2147ca00b0015d5f9a3921mr1876554pzc.27.1697812333733; Fri, 20 Oct 2023 07:32:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697812333; cv=none; d=google.com; s=arc-20160816; b=WG7ee87u0CP4zQS/AYhPbJ/WD1F57cVw7fsAn9yBGnwHEEDIMnZaHfsWjTWbxLP4MZ 8gWy+7mcjw8JsC6yb6ruGV+ePsHT+LpmtflTHiCpnNBTwUlmkP/PV8R0LaPbHXuR8FqN /9er2N5jLyGphdIltj2tBhFglVD1a6aMDg2vzR1Un6vERazOXPSRPEP0IHcPo5WUMWKg 58LtFia+yJtpm+JeMULIgcPBJZYDnVao3wvKVxaa/e2U/DseujaD8wVNV2cstYzxFbTE U6c3/nMhiYJy4T5cyr8mKp8KBUUWCrHMuD7htMntBv0XxhdvS6xVZDrD6CzCis1wAIe/ 2Y3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DTbLMCwQk6sw/5Fwgb8BymyZg9CNEqWEe+7P7NSS/Hc=; fh=zek7UAf/gC8HYYEjDRVWqmoEUKhvKoIxsqilaPFFvss=; b=FYED6i3Nf7fZL5ZAIcBAOOPrXpwW2IdtQCDzwSvvLPjnZgaqU4XF7KW4DRitx4TxVW Nf68PgOYG+FZg7T4LH6n9gvfOT0oidgn12TZhX3A6D2Q686OWC57bmoE7Zm+yYLwu3y8 41T0Fnz+WR7VQ98EuQBLAm5teLPaPmaWWlzwEgOWK1mMi4lmCUd98IEXdfdbGsIiLf31 JjkMv87QITdw2qY/TEge83uo1bqNmWDFTF9gM+lRk+o/esmzsrz9FzoJaGptMtdhAQzo or1pNLnBiMlTRi884+nGs4oJQpxRSFt254OwA+YJlXNXlPK/JVw+BgdioRIYa7PGaMpd LCGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GRIir2VB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id s7-20020a625e07000000b006bdfb718e16si1955406pfb.80.2023.10.20.07.32.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 07:32:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GRIir2VB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 4477882C21A3; Fri, 20 Oct 2023 07:32:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377527AbjJTOb5 (ORCPT + 99 others); Fri, 20 Oct 2023 10:31:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377496AbjJTOb4 (ORCPT ); Fri, 20 Oct 2023 10:31:56 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D724A19E for ; Fri, 20 Oct 2023 07:31:54 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E65A3C433C8; Fri, 20 Oct 2023 14:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1697812314; bh=WEpjgFcPeQJKLQYrLLB7W0sYAU1Nex9t/YsX/jHg8kg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GRIir2VB2uCvTMinb4tslLmOW2YakhXGfBsVmKz1btlcpi6XXOs0oQ6pRNg4+5Yzs lEETxsx3SqDEBRcRGqaRiK6Aq4JQo6hSk8Fyxusgj15xBTEFpmLDiX4gdquo5UhhqA dObczVTLNytqnwe4LJn92N1lxwORHsmVM9ibEVxA= Date: Fri, 20 Oct 2023 16:31:50 +0200 From: Greg Kroah-Hartman To: "Balas, Eliza" Cc: "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Derek Kiernan , Dragan Cvetic , Arnd Bergmann Subject: Re: [PATCH v3 2/2] drivers: misc: adi-axi-tdd: Add TDD engine Message-ID: <2023102030-resort-glance-57ef@gregkh> References: <20231019125646.14236-1-eliza.balas@analog.com> <20231019125646.14236-3-eliza.balas@analog.com> <2023101917-cork-numeric-dab8@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Fri, 20 Oct 2023 07:32:11 -0700 (PDT) On Fri, Oct 20, 2023 at 11:18:44AM +0000, Balas, Eliza wrote: > > > +static int adi_axi_tdd_parse_ms(struct adi_axi_tdd_state *st, > > > + const char *buf, > > > + u64 *res) > > > +{ > > > + u64 clk_rate = READ_ONCE(st->clk.rate); > > > + char *orig_str, *modf_str, *int_part, frac_part[7]; > > > + long ival, frac; > > > + int ret; > > > + > > > + orig_str = kstrdup(buf, GFP_KERNEL); > > > + int_part = strsep(&orig_str, "."); > > > > Why are we parsing floating point in the kernel? Please just keep the > > api simple so that we don't have to try to do any type of parsing other > > than turning a single text number into a value. > > > > The adi_axi_tdd_parse_ms function does almost the same thing as the > iio_str_to_fixpoint() function which already exists in kernel. That does not mean that this is a valid api for your device as you are not an iio driver (why aren't you an iio driver?) > It parses a fixed-point number from a string. And as such, you shouldn't duplicate existing logic. > The __iio_str_to_fixpoint is used in a similar way, as I intend to use adi_axi_tdd_parse_ms. > It writes to a channel the corresponding scale (micro,nano) for a value. Why not just have the api accept values in nanoseconds and then no parsing is needed? > Since the device is not an iio device, using an iio function would be confusing. Why isn't this an iio device? thanks, greg k-h