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 X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.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=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98428C4332E for ; Mon, 23 Mar 2020 00:50:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5A3A8206C3 for ; Mon, 23 Mar 2020 00:50:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Izq+6922" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726936AbgCWAuA (ORCPT ); Sun, 22 Mar 2020 20:50:00 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:46727 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726925AbgCWAuA (ORCPT ); Sun, 22 Mar 2020 20:50:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584924599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4WJG8kX5wGWaQ/wYthBFIkeuh/CAXA1gW5ZNSHD9JAs=; b=Izq+6922QyCIgdq2L9llerOP/yWBZJmeR3V0QaE8QOSa1ZiMhtlt7Lm+3yIvliijEKcyuT KNoxMaNVlvY4KaG5cZcGAaOuC2GFviuo6KViye8D2tmridP8ZjWw8UW6FMJZLW0FuZb3z6 or+o/6FdPbiJy3MjdvQyc9uEe+B3kFE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-338-y4Xmhf-lNJSBUqIv0LtY0Q-1; Sun, 22 Mar 2020 20:49:55 -0400 X-MC-Unique: y4Xmhf-lNJSBUqIv0LtY0Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DD6E98017CC; Mon, 23 Mar 2020 00:49:52 +0000 (UTC) Received: from elisabeth (unknown [10.40.208.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D9159B927; Mon, 23 Mar 2020 00:49:42 +0000 (UTC) Date: Mon, 23 Mar 2020 01:49:35 +0100 From: Stefano Brivio To: Andy Shevchenko Cc: Deepak R Varma , outreachy-kernel@googlegroups.com, Greg Kroah-Hartman , Daniel Baluta , kieran.bingham@ideasonboard.com, Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald , linux-iio Subject: Re: [Outreachy kernel] Re: [PATCH v3 3/4] staging: iio: adc: ad7192: get_filter_freq code optimization Message-ID: <20200323014935.48048405@elisabeth> In-Reply-To: References: Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Andy, On Mon, 23 Mar 2020 01:44:20 +0200 Andy Shevchenko wrote: > On Sun, Mar 22, 2020 at 9:57 PM Deepak R Varma wrote: > > > > Current implementation of the function ad7192_get_available_filter_freq > > repeats calculation of output data rate a few times. We can simplify > > these steps by refactoring out the calculation of fADC. This would also > > addresses the checkpatch warning of line exceeding 80 character. > > I'm not sure you did an equivalent changes. I believe in the original > code precision is better. Consider low clock frequencies when 10 bit > right shift may hide some bits of the division. Note that those bits are eventually "hidden" in the same way later, despite the different sequence, due to DIV_ROUND_CLOSEST() being used at every step (both before and after the change) without other operations occurring. Anyway, > Care to write a python script to check the precision between old and new code? yes, that would be nice no matter what. -- Stefano