Received: by 10.223.164.202 with SMTP id h10csp1597072wrb; Wed, 8 Nov 2017 06:47:00 -0800 (PST) X-Google-Smtp-Source: ABhQp+QpSBRyQybomy0wfngqfwz7E7HPdAqi0Ha9+pw2jbz3QxC9/irU6m6fLjdoUzLBX9O3e8ru X-Received: by 10.99.56.19 with SMTP id f19mr710173pga.328.1510152420837; Wed, 08 Nov 2017 06:47:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510152420; cv=none; d=google.com; s=arc-20160816; b=SFvqVaWUBVJi0CDJ1K57Ljm9zLejWXVxu5g9VSYM/AzBa7KHSMbaADipFOYpTxvaJ+ PJNaywsZ1NzjjQlygCR+O5ikENWBCnU0kJZ8uT7VGuj+2KZyFT95SUcIjf/KS8eAc7/X XXUp/YRzbOe1V0nhCI6TQ3Ga7u3vTAjM3M3FHyS6x2THdL089LruqvqLKASzo1qixe/i jWE1H9VyP18uCuXvOv0Y+r07yd03ntVeNbIkCkk23qZgzZorciTb0BvHGhDiG8nBwfyz 5mz8AUgS9FfxxM3SVtbBpcqJQP/PyE0lXEM2F5/s7bi5MhF6a0lgaQ0TOFH6B4JfNNBm Dm+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=QNUspboZEXNpEgwcoSkVOVEtO8zWYq6vsYV78fWLGLg=; b=Dg31xxcwnEg7VVT2ekrp4G4/9qW0KyjjDxJQX9iwp2I3MWLaafeEZVIdWTmI8SzFZU Xtd/qf36p9+DikyrAPOrAdujNklOG6SJkWbrl8VjAqWSAhXXUsBoW1KECmYeo4ZsOeKF tgAS45WZ2DMpoBz5haaWdcTeFL4q76mJKfr2l6YWiBDIx+pa2Dq2sgN7Wc1vPaGoegUV cTAo/tozwAPq7IHvTDshJ4aBZ0Q3DzVUyZlUNmhn80U6BEiLgwBtIgWqtDsQFlYFGDAi n4Dtdy6P2OA55qUF/89F9hiRdJ3wI+UUA9Vd9V4Y6ZFvqgaN/La0vXHp+eolCi9u4oMD io0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KflS158a; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c41si4050142plj.293.2017.11.08.06.46.49; Wed, 08 Nov 2017 06:47:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KflS158a; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752563AbdKHOqL (ORCPT + 82 others); Wed, 8 Nov 2017 09:46:11 -0500 Received: from mail-yw0-f194.google.com ([209.85.161.194]:43377 "EHLO mail-yw0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750818AbdKHOqJ (ORCPT ); Wed, 8 Nov 2017 09:46:09 -0500 Received: by mail-yw0-f194.google.com with SMTP id y75so2484691ywg.0 for ; Wed, 08 Nov 2017 06:46:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=QNUspboZEXNpEgwcoSkVOVEtO8zWYq6vsYV78fWLGLg=; b=KflS158aNpuOsM8N/eJ9eYxuVug9BWl9bL3WrPFAW2hNs7+TkHROqc0sDyHACGUuKl n0kbaK9iyqmM3Rw6nwHdNVnlqO02NeiHOYIWFG8r6CCZOT8z9zqgjeL28oR/Mg0SKqTb GPZvpftbe8pws8l/pmMXXGhDC8yJmKwIgIIuFt5OfS4CZ4r+wmgZiOW8soAZbZoztwDB Uy1n7L9uvtqAnPDKxed2JBH25/lcAt1RDxcy6r+1+fxCFkHjQIIhl75VZpajnzZkfO41 xKhqk6bSZbGN7Juby5uoKzDn/e76yq7LsTuV0ue1CcyFjMTVQPLhAZ+VX9He+9xy5c/J axHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=QNUspboZEXNpEgwcoSkVOVEtO8zWYq6vsYV78fWLGLg=; b=Jpc2MahXsX+zQnn/95tXyJhYt3tXTrhp6WxhM9vrf06harZsZT8WH8JmHaR0fYJrW0 qjHqGZnRIzLj8D8QsRd1tsGwCKwEG4Fg4TssmX/LSFdncCFDdH84aUKag8WZQWbpxVAA 7mGbTXNL+nOaWFAQFoJkfBRTdqTF4Dfd27WljFANiFlMPj4JHGaYvQhqoVnHl/PqQZOC QeObvWiyamqbrVUOL5Ic7yif9Erftv/psHXrKuHPrcEH94TOWAn8DgGIzVpkkIQGa0Sk K4h0FFRa9Mr+SjlnEHWpEC9O1UuJlDuPcdgaNuzlr5cwnXfmKLWgp4xdO5MosuVz//o8 6gqQ== X-Gm-Message-State: AJaThX4S+odjiMC1jDii5GUGhk+GGRIeppz7wf2TkkiOAXAEe51teg+x V+80I+3qhA+Jv3w6q7H1yu8= X-Received: by 10.129.118.11 with SMTP id r11mr505578ywc.320.1510152369070; Wed, 08 Nov 2017 06:46:09 -0800 (PST) Received: from josharch ([64.53.114.237]) by smtp.gmail.com with ESMTPSA id t64sm2107716ywd.68.2017.11.08.06.46.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Nov 2017 06:46:08 -0800 (PST) Date: Wed, 8 Nov 2017 09:46:06 -0500 From: Josh Abraham To: Dan Carpenter Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, robsonde@gmail.com, dudebrobro179@gmail.com, linux-kernel@vger.kernel.org, marcin.s.ciupak@gmail.com, linux@Wolf-Entwicklungen.de, colin.king@canonical.com Subject: Re: [PATCH] staging: pi433: #define shift constants in rf69.c Message-ID: <20171108144606.GA5075@josharch> References: <20171108112506.GA1654@josharch> <20171108115230.khywgqgypxrnkryv@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171108115230.khywgqgypxrnkryv@mwanda> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 08, 2017 at 02:52:30PM +0300, Dan Carpenter wrote: > On Wed, Nov 08, 2017 at 06:25:06AM -0500, Joshua Abraham wrote: > > This patch completes TODO improvements in rf69.c to change shift > > constants to a define. > > > > Signed-off-by: Joshua Abraham > > --- > > drivers/staging/pi433/rf69.c | 4 ++-- > > drivers/staging/pi433/rf69_registers.h | 4 ++++ > > 2 files changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c > > index e69a2153c999..cfcace195be9 100644 > > --- a/drivers/staging/pi433/rf69.c > > +++ b/drivers/staging/pi433/rf69.c > > @@ -102,7 +102,7 @@ enum modulation rf69_get_modulation(struct spi_device *spi) > > > > currentValue = READ_REG(REG_DATAMODUL); > > > > - switch (currentValue & MASK_DATAMODUL_MODULATION_TYPE >> 3) { // TODO improvement: change 3 to define > > + switch (currentValue & MASK_DATAMODUL_MODULATION_TYPE >> SHIFT_DATAMODUL_MODE) { > > You've send a few of mechanical patches without waiting for feedback and > you should probably slow down... > Understood. I am just excited about submitting patches. > The first thing to notice is that the original code is probably buggy > and needs parenthesis. > > switch ((currentValue & MASK_DATAMODUL_MODULATION_TYPE) >> 3) { > > But that still doesn't fix the problem that x18 >> 3 is never going to > equal to DATAMODUL_MODULATION_TYPE_OOK which is 0x8... So there are a > couple bugs here. > > The line is over 80 characters, so checkpatch will complain about your > patch. Please run checkpatch.pl on all your patches. Really, I hate > all the naming here... Surely we can think of a better name than > MASK_DATAMODUL_MODULATION_TYPE? Normally the "MASK" and "SHIFT" part of > the name go at the end instead of the start. > I named the define to be consistent with the extant code, but I agree that the names could be better. > > /* RegDataModul */ > > +#define SHIFT_DATAMODUL_MODE 0x03 > > + > > #define MASK_DATAMODUL_MODE 0x06 > > Why did you add a blank line? Don't use hex values for shifting, use > normal numbers. The 0x3 is indented too far. > I added the blank line to separate shifts from masks, but since the shift will only be performed on the mask I supposed it isn't needed. > Anyway, take your time and really think about patches before you send > them. Normally, I write a patch, then wait overnight, then review it > and again in the morning before I send it. > > regards, > dan carpenter > Thanks for the criticism. I will be better. From 1583508566600975745@xxx Wed Nov 08 14:30:49 +0000 2017 X-GM-THRID: 1583497016233571628 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread