Received: by 10.223.164.202 with SMTP id h10csp1579405wrb; Wed, 8 Nov 2017 06:30:49 -0800 (PST) X-Google-Smtp-Source: ABhQp+QHIXYsihcnXVmE1MEUen9asmxI6GdwZ3UNqOMM6BVz/UOrImpPdPPC6Dr9VPC8MFH1VZyi X-Received: by 10.98.147.23 with SMTP id b23mr727995pfe.5.1510151449844; Wed, 08 Nov 2017 06:30:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510151449; cv=none; d=google.com; s=arc-20160816; b=MstKELx6n7vI0Ra0vm2rSzo5EpiFEVa6+wXVna71KLLYQo1RpLfX/czF25T50smjYi otvWrquOQIgEUdtGERCskNiJoSZTtbuccgQsWyOVEfdKhY0gfakl3qDkgmzPlVD85WJk amb1oEUVjmnekn9Sqk+b0Ly2p5PzHHapuvTr5QegN2roJVEDCHsmciLNEsmfAYYAp44G Ux921arfkFM6c8bshrM50/zSphyrvFhR6rGirNjFX1xVuCQUGaNVPiQei2oM02K7b3Kz MF1Emsyx9eyN8A4o7n8Yxjx1teM4Vc9tmFXav5tMndVYA/5YiY/zYyjEMhAleAv7XpBQ JTiA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=776S+R+rVWNnQbUNHrXHHi3rBlwNTfXjtWvnDJsyU0I=; b=GOkNMGkQD2HHnS4JPFfvCv5UtKPLdynW5V886CQzmZymaL0v5LyMkNq+ljCcWAfqaD u9Yq/sPiGjptTgdK2h+F9/DvrOPdb3KvIlzlUbz4slZKxZzuTyXRjQQFsyogC1BNfvHU HT8CsWLACXQrkAraviMjhoDSnd5c1WkdfwR4UIHrKKLNaUCwBIZklNFomi5Df2F8I3Vu SMC5+7egJI/fIPECQtoR1zfzu3g/0Q/isoP+qz20jl+5fE8f9oAzYFBIHIJUOXCu/qrJ j7GX1jw8iIQ3oXc052zwByXFQZsywRqY4x/mhMy/y6ufI4NUKh0t+vTpPYrlwG1/9atJ le+g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z21si4022022pge.375.2017.11.08.06.30.37; Wed, 08 Nov 2017 06:30:49 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752649AbdKHO35 (ORCPT + 82 others); Wed, 8 Nov 2017 09:29:57 -0500 Received: from dd39320.kasserver.com ([85.13.155.146]:36852 "EHLO dd39320.kasserver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751495AbdKHO3z (ORCPT ); Wed, 8 Nov 2017 09:29:55 -0500 X-Greylist: delayed 509 seconds by postgrey-1.27 at vger.kernel.org; Wed, 08 Nov 2017 09:29:55 EST Received: from [192.168.0.31] (109.125.99.188.dynamic.cablesurf.de [109.125.99.188]) by dd39320.kasserver.com (Postfix) with ESMTPSA id 7D91E2CE0047; Wed, 8 Nov 2017 15:21:23 +0100 (CET) Subject: Re: [PATCH] staging: pi433: #define shift constants in rf69.c To: Dan Carpenter , Joshua Abraham 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 References: <20171108112506.GA1654@josharch> <20171108115230.khywgqgypxrnkryv@mwanda> From: Marcus Wolf Message-ID: <83aceb92-8f28-014c-9b03-a8b9d89119cd@smarthome-wolf.de> Date: Wed, 8 Nov 2017 16:21:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171108115230.khywgqgypxrnkryv@mwanda> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello everybody! Concerning the naming: ====================== When writing the rf69.c it wasn't intended to write a driver for Linux. This file was written at a time, where the complete controlling of Pi433 was implemented in the application. Therefore it is written in a completely different coding style. Never the less - except from MASK and SHIFT, these names 100% - or let's better say 97% comply with the naming of the registers and the bits you will find in the RFM69 data sheet. I imported the table from datasheet to start the reg.h file If you are maintaining the function/features of the code (working with the data sheet) that helps a lot. So in my opinion - if desired - we should change from MASK_registername_bit(s)name to registername_bit(s)name_MASK but we should keep register and bit(s)names untouched. Regarding the long line: ======================== If someone is fixing a bug on a certain line, I would strongly prefer not to touch the long line, just to please checkpatch. In general for sure we should fix the long lines everywhere, it can be done without reducing readability. But it should be done as a whole. In rf69.c there are constructions, that appear over and over again, because everything over there deals with register access, thus always doing the same stuff in a slightly different way. In my opinion there should be one kind of coding, that should be used for all similar lines. If the functionality needs service, I would hate to have the same functionality implemented in several different styles. At the moment I am recovering from a surgery of my back that was necessary due to a disease at my discs that started several months ago. So at the moment it stil is hard for me to sit at the desk for a longer time. Yesterday I started to review all driver mails I got in the last two months. There were several attempts to fix style problems as a whole. Up to now, I haven't checked, why those patches haven't been accepted. I'll proceed checking all that stuff within the next week(s). Regarding the bit shift: ======================== Indeed there is a bug. I already discussed that topic long time ago. Most probably I even sent a fix with a completly different implementation that time, but it was rejected due to missformated patch. I'll try to pass in a new patch today or tomorrow. By the way one question: ======================== If I for example want to send one patch per week and the patch of the third week impacts a line, that was already impacted in the patch of the first week, should the patch in week three be a diff to master or a diff to patch one? Cheers, Marcus Am 08.11.2017 um 13:52 schrieb Dan Carpenter: > 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... > > 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. > >> /* 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. > > 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 > From 1583498696989638517@xxx Wed Nov 08 11:53:57 +0000 2017 X-GM-THRID: 1583497016233571628 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread