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=-6.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 B29F6C433FE for ; Fri, 4 Dec 2020 22:46:20 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6CCFE22287 for ; Fri, 4 Dec 2020 22:46:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6CCFE22287 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=mess.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ThLJXTvyvLFr5eZACg6IyiIPcyw625Fzup6ibh/JQ70=; b=omMKRc6uCoepPOrkwcTrjQE8k KbtD46u9IKWP9WbTsGxsYVSdLwZnnQkMHozhMNz8yXkn64+cE7x3r2eN7YQqHh89OqKSl3ZgEUgMG /uCKM1ANHXg7w/+m2LHkNiC0PtqcfOl7MtP/XXXmzdim3sVWZX9dHkGDZba0Ju3/pdhDcpnDAAl2W dMpFGw0KYCPkGbPPIorWK44Q0ZMp4QHgNdJtd4HafkA6akSGwxDdLladgHLSG7BisAfow4O/CAIB3 fwW/F3lqX672JmZ1pUBgZpcfrzLo4pAkh2NpOASFvV3HXymlP5my4QVpjWL53VVYCWiZSqkg0GGdh CwXXJH2OQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1klJp3-0002gR-FB; Fri, 04 Dec 2020 22:45:05 +0000 Received: from gofer.mess.org ([88.97.38.141]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1klJp0-0002fq-E4; Fri, 04 Dec 2020 22:45:03 +0000 Received: by gofer.mess.org (Postfix, from userid 1000) id 8F2F8C63F3; Fri, 4 Dec 2020 22:44:58 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mess.org; s=2020; t=1607121898; bh=PYH8ww1xg7JJTR9yV5V04QIPlPtwuoeubNCoR6ffAlo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SOU4hQfIGHnzuYrHWcRjab1uQ0fVMy/3s/r8IjYVXz2h02cPZUmubrdovi8MbRDlE bHb7/3pxfeh7AFUthUsi95Zd9+m5K2YM6qS0cU+b5zQ1oYERTt8r7XZ6GgbZs3ItPS M8dM7uJqtyF/XPm2Bcwiz7hvizQTfWFIaOo0osQGKeq3PjntFVXqOpwQXtzwelGpB/ cS/LvisM55v9yKB4spqMwd7cIdq4EXQg0u5IxnF3rzFfKvLsav9hpY/gLcgcnncPye EAQFBXdQVe/da5YPSLpHvavRDJZ/gt42IysVJMORk5tuMWDn6/EMraYCh3YOEZhs9Q a2eYr9/zZJ28g== Date: Fri, 4 Dec 2020 22:44:58 +0000 From: Sean Young To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Subject: Re: [PATCH v2] pwm: bcm2835: Support apply function for atomic configuration Message-ID: <20201204224458.GA15986@gofer.mess.org> References: <202011281128.54eLfMWr-lkp@intel.com> <1606564926-19555-1-git-send-email-LinoSanfilippo@gmx.de> <20201129181050.p6rkif5vjoumvafm@pengutronix.de> <4683237c-7b40-11ab-b3c0-f94a5dd39b4d@gmx.de> <20201204112115.wopx5p5elgte7gad@pengutronix.de> <20201204114036.GB6547@gofer.mess.org> <20201204215525.uvjxlebth457aoj5@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201204215525.uvjxlebth457aoj5@pengutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201204_174502_716609_3988C01D X-CRM114-Status: GOOD ( 19.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, f.fainelli@gmail.com, sbranden@broadcom.com, rjui@broadcom.com, linux-kernel@vger.kernel.org, Lino Sanfilippo , thierry.reding@gmail.com, linux-rpi-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, lee.jones@linaro.org, nsaenzjulienne@suse.de Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Uwe, On Fri, Dec 04, 2020 at 10:55:25PM +0100, Uwe Kleine-K=F6nig wrote: > On Fri, Dec 04, 2020 at 11:40:36AM +0000, Sean Young wrote: > > On Fri, Dec 04, 2020 at 12:21:15PM +0100, Uwe Kleine-K=F6nig wrote: > > > On Fri, Dec 04, 2020 at 12:42:15AM +0100, Lino Sanfilippo wrote: > > > > On 29.11.20 at 19:10, Uwe Kleine-K=F6nig wrote: > > > > > You're storing an unsigned long long (i.e. 64 bits) in an u32. If > > > > > you are sure that this won't discard relevant bits, please explain > > > > > this in a comment for the cursory reader. > > > > = > > > > What about an extra check then to make sure that the period has not= been truncated, > > > > e.g: > > > > = > > > > value =3D DIV_ROUND_CLOSEST_ULL(state->period, scaler); > > > > = > > > > /* dont accept a period that is too small or has been truncated */ > > > > if ((value < PERIOD_MIN) || > > > > (value !=3D DIV_ROUND_CLOSEST_ULL(state->period, scaler))) > > > > return -EINVAL; > > > = > > > I'd make value an unsigned long long and check for > 0xffffffff inste= ad > > > of repeating the (expensive) division. (Hmm, maybe the compiler is sm= art > > > enough to not actually repeat it, but still.) > > = > > I wonder where you got that idea from. > = > I don't know how to honestly answer your question. > Which idea do you mean? That divisions are expensive? Or that compilers > might be smart? And do you consider it a good idea? Or do you disagree? I had already made this exact suggestion -- and you had replied to my email making that suggestion -- before you emailed this. Granted, I said u64 and U32_MAX rather than unsigned long long and 0xffffffff. However, I should not have sent that snotty email. It's irrelevant. My apologies. Sean _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel