Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp918695ybz; Sat, 25 Apr 2020 07:08:31 -0700 (PDT) X-Google-Smtp-Source: APiQypKtaHO7VoBUcxXwbbc0EH51SyllBxBd6UPnUPOpxbr4ZpMXFJfA8h4jL/bx9o6M3xCtkD82 X-Received: by 2002:aa7:c714:: with SMTP id i20mr11610943edq.230.1587823711328; Sat, 25 Apr 2020 07:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587823711; cv=none; d=google.com; s=arc-20160816; b=HohiBeXiCJBOUIk/XJvB9wyzzsEutzj/LSawZWQkAEvkQcQ4K6OV+O8eiFjgErmTuG ENpeWe8t8TUVZypJB0plQNw8cnoorB1TMKm80kYxeIvojH6DR/s1FitOCmiFibg0k5jZ 6LN5JqDOuirJGI60AZgDzXjEs969CzCcSleUlrHpR2Q+8id12Zy/8cDDWYZ7SDOaFcIj mojA5ugNcpeAJ5s11UQ3nQ6OK0VRAgKI4X+GD5i/NZiOIGPQfzq5sm/TyQFCWOvj25ev BBy34jglsyhVV0IUQ0nLWU4sOCkVlt8810Q7l8DVkjd79gwqGiXYPcf7bhvUmHISTFlz Vx2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:user-agent :in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:dkim-signature; bh=eVCVTbgBZ5mYcNhB8Kwo69dB55XhNN2Rw0P+xH1XRdw=; b=AA6RHXQqkIxDrTNoUjoGtb0rD4H6IemJFOLPEVzKk7k/cM5u+I3PpT34LXWlG1pIq0 pzx0W/4usXHGt64d9GnkyEWC6MCugtKuA3sIJbn9rj9n/NH71YQKZseHhYjh0JiVvgQR +dyJvQuThkD4BeGX5ofrGAJf1yNQaVwOhquns+jXjFaqFxx5EL2fmsx5W2OSgut294Wa p9k8jyNzu62wonm9WemEF4A+m2omURNHbBitXGvojWDfzeeqMMVm9m1UefojcgTTuM2a HD396iMuwlIjp9xpdG+Z8fk5daQKWUT4OJlXV1+LRpwAKI4CeamgdP1weWLE16F1qHsv VNsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="W01P/S7J"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f3si4690278edn.165.2020.04.25.07.08.07; Sat, 25 Apr 2020 07:08:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="W01P/S7J"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726117AbgDYOCu (ORCPT + 99 others); Sat, 25 Apr 2020 10:02:50 -0400 Received: from mout.gmx.net ([212.227.17.21]:51215 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726050AbgDYOCt (ORCPT ); Sat, 25 Apr 2020 10:02:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1587823359; bh=cbbVI1PGCNAqbeyhd0rn3+oxRl+wxXYseCxr5QBOBU0=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=W01P/S7JvlociG9FeQ4GrGUrkdfG1pKgbWIQDCeMEt3qaSoP15oRM3VwsiLdMrSzS PS0ZaJ1Ssryu3m4IJoNtoXc/iXxxeF5nxy+Is5ZSrLEkY4jNCRjAHl88GpL2gMeKfS MIcDgF7SVwkAYa7bCP3w7hSJAx3lhX1foFDXVRbw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from ubuntu ([83.52.229.196]) by mail.gmx.com (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MhlGq-1ixhSp2JcW-00dn93; Sat, 25 Apr 2020 16:02:39 +0200 Date: Sat, 25 Apr 2020 16:02:37 +0200 From: Oscar Carter To: Greg Kroah-Hartman Cc: Oscar Carter , Forest Bond , devel@driverdev.osuosl.org, Malcolm Priestley , linux-kernel@vger.kernel.org, Dan Carpenter Subject: Re: [PATCH v2] staging: vt6656: Add formula to the vnt_rf_addpower function Message-ID: <20200425140237.GB3213@ubuntu> References: <20200423170557.10401-1-oscar.carter@gmx.com> <20200425105714.GA2071664@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200425105714.GA2071664@kroah.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Provags-ID: V03:K1:Azk07uiBcDqWvl5IdR2SJ0a5orfygJTMkzEvVInPXE/rufeIZw7 +ONWWNso4Gqutk6/xuv2Boky+OMDG/cSxFy5e36//K2AuTFzmyCmRg6NvTvvwx3D2zgQGwN FfCxUsf7DERunEQ1miLQ7P76b3UfhleohSoxDZgdkiP1fUDLY8gwEyBBmDzj90edfJNacEK m8zZ7jf/Ixb9p1TdpUAhw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:nAjiWf6LWYs=:PG/MUaPGxZ06hcvjWN2f8U jBkRp0WLdpdYsP0b8IPRHiU0qq/xBcSq0yCLf2Bhd52dIQ/bWx7CXFiBDFNYjg7eikTZJAxG4 wQbjhlRWJcSRpdwMCptGL2vo+6LffaOqOcci3OhROj7juUL1gEXVLoNhOTdsXcjSu6zMMfGCp WiE0kLdYb57V44aZGB/vcMfThS5aRGxdxCxQJ+23gaGidW/IsgVOYENEsdmJZiDldymSvASS1 zFvIjhtxa1xHkKeI4holYEibNc4n9F1n0toTVMckCJ8yfji+dkt4t+3TiPm43REYQxLW/5zOJ 4KXrUpc1GMyvjYNC2TgpjlEZ1Mqnu3J1goqSSHQpnlWT27sh/PBKAUxnr9iwKEkGIafmD3+E5 wQO8GPFahn0IyBQMRZmATPB5vt2LriJk+gtjj5CIJJ1RUgytwiS/ZmORU1KNpwtuwh4LYo2KD JspDnhicXL0YLFvfL5WibN1kLh54DNu97rto+dEY3ToN4dYKPM+2eKdX2XAJFyszjyGCThVKC gJkvxN7QtyFqavIFUbKtU3GPAIiYe2Ch0JhycYBDc0qbSfRoXzYjHHi2NS0LdS0kfd6ApqRLn /4jIjaGhE/xl+M/+8MUEstvumpHzRlX0oBRe/l3n9teGalJTuOMMT9/dTSl4/t3uZvN73J1za ZrTU7JI0rS7mvNA/LyJnGeNWmDWWAW5iENJ5GO7H5jI3epH9sSNDtJzXyQ5rshOyp03290zQe J+i8pTPq8Jc6Zdj+Yp0u7JlMx782ZX04+Z8ven9+J3YxNjgRdjDE2rIitJogZpVAJ5hserVHa tGIa03QyWHi+6gCs9bXlJlWxOlmcYMXOwZEwNYdRgiv+yJhKxAC99CFJGgMEegWp3j0JGkTjR ADOSbLAQ4vQK1vDC7GiqulOSfdaCnPOQ1rGrPFJ7ETdYR3aoEBc4YUlObiONRbEcr4KJWE4od ivU5/AgeeIVem7Ipkd/wMuWFMuTWQ510pAfTjmosglKw4ERKsHK1dJyueTEEfdHp5E8HTMZKK itPcNDnr6aXaI8kWwwoCA0mpFzwfUW1PHRG+aealEpujwaJ7eKPg1xXJiCjd7DkBhDGGAEC6t By1o+gtnLlBLbaf2g4q53HnppZjFFw8d1BHsa5pu+0/MrJpoiWS9c16X0Vmmccgeq6PGJTn5x 5sChTGqEfFUs/XtR4vxrZjRKXuX3zi/boMvSrmabjrJ2FRtgEscSrdPKftHMNelaw+O2VKBCP 7w3Q24ZwGdkTsehrK Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 25, 2020 at 12:57:14PM +0200, Greg Kroah-Hartman wrote: > On Thu, Apr 23, 2020 at 07:05:57PM +0200, Oscar Carter wrote: > > Use a formula to calculate the return value of the vnt_rf_addpower > > function instead of the "if" statement with literal values for every > > case. > > > > Signed-off-by: Oscar Carter > > --- > > Changelog v1 -> v2 > > - Change the type of "base" variable from s32 to int as Dan Carpenter > > suggested. > > - Remove the "--" postoperator and replace with (base - 1) as Dan > > Carpenter suggested. Also, as this expression has a minus before the > > parenthesis, remove it an apply the minus operator changing the sign= of > > "base" and literal "1". > > > > drivers/staging/vt6656/rf.c | 20 +++----------------- > > 1 file changed, 3 insertions(+), 17 deletions(-) > > > > diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c > > index 06fa8867cfa3..612fd4a59f8a 100644 > > --- a/drivers/staging/vt6656/rf.c > > +++ b/drivers/staging/vt6656/rf.c > > @@ -538,28 +538,14 @@ int vnt_rf_write_embedded(struct vnt_private *pr= iv, u32 data) > > > > static u8 vnt_rf_addpower(struct vnt_private *priv) > > { > > + int base; > > s32 rssi =3D -priv->current_rssi; > > > > if (!rssi) > > return 7; > > > > - if (priv->rf_type =3D=3D RF_VT3226D0) { > > - if (rssi < -70) > > - return 9; > > - else if (rssi < -65) > > - return 7; > > - else if (rssi < -60) > > - return 5; > > - } else { > > - if (rssi < -80) > > - return 9; > > - else if (rssi < -75) > > - return 7; > > - else if (rssi < -70) > > - return 5; > > - } > > - > > - return 0; > > + base =3D (priv->rf_type =3D=3D RF_VT3226D0) ? -60 : -70; > > + return (rssi < base) ? ((rssi - base + 1) / -5) * 2 + 5 : 0; > > I _hate_ ? : functions, just spell this out please as a real if() > statement. > Ok, I will do the modification and I will resend a new version patch. > thanks, > > greg k-h thanks, oscar carter