Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754656AbdLFJjb (ORCPT ); Wed, 6 Dec 2017 04:39:31 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:40265 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754265AbdLFJj0 (ORCPT ); Wed, 6 Dec 2017 04:39:26 -0500 Date: Wed, 6 Dec 2017 12:37:03 +0300 From: Dan Carpenter To: Marcus Wolf Cc: Simon =?iso-8859-1?Q?Sandstr=F6m?= , gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux@Wolf-Entwicklungen.de, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 06/11] staging: pi433: Split rf69_set_crc_enabled into two functions Message-ID: <20171206093703.bgs32doff7svvdf5@mwanda> References: <20171205220849.5486-1-simon@nikanor.nu> <20171205220849.5486-7-simon@nikanor.nu> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8736 signatures=668641 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712060141 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2637 Lines: 76 On Wed, Dec 06, 2017 at 11:05:22AM +0200, Marcus Wolf wrote: > > > Am 06.12.2017 um 00:08 schrieb Simon Sandstr?m: > > Splits rf69_set_crc_enabled(dev, enabled) into > > rf69_enable_crc(dev) and rf69_disable_crc(dev). > > > > Signed-off-by: Simon Sandstr?m > > --- > > drivers/staging/pi433/pi433_if.c | 22 ++++++++++++++++++++-- > > drivers/staging/pi433/rf69.c | 18 ++++++------------ > > drivers/staging/pi433/rf69.h | 4 ++-- > > 3 files changed, 28 insertions(+), 16 deletions(-) > > > > diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c > > index 2ae19ac565d1..614eec7dd904 100644 > > --- a/drivers/staging/pi433/pi433_if.c > > +++ b/drivers/staging/pi433/pi433_if.c > > @@ -216,7 +216,16 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct pi433_rx_cfg *rx_cfg) > > return ret; > > } > > SET_CHECKED(rf69_set_adressFiltering(dev->spi, rx_cfg->enable_address_filtering)); > > - SET_CHECKED(rf69_set_crc_enable (dev->spi, rx_cfg->enable_crc)); > > + > > + if (rx_cfg->enable_crc == OPTION_ON) { > > + ret = rf69_enable_crc(dev->spi); > > + if (ret < 0) > > + return ret; > > + } else { > > + ret = rf69_disable_crc(dev->spi); > > + if (ret < 0) > > + return ret; > > + } > > Why don't you use SET_CHECKED(...)? > Marcus, please don't introduce new uses of SET_CHECKED(). It has a hidden return in it which is against kernel style and introduces very predictable and avoidable bugs. For example, in probe(). > I stil don't like this kind of changes - and not using SET_CHECKED makes it > even worse, since that further increases code length. > > The idea was to have the configuration as compact, as you can see in the > receiver config section. It's a pitty that the packet config already needs > such a huge number of exceptions due to technical reasons. We shouldn't > further extend the numbers of exceptions and shouldn't extend the number of > lines for setting a reg. > > Initially this function was just like > set_rx_cfg() > { > SET_CHECKED(...) > SET_CHECKED(...) > SET_CHECKED(...) > SET_CHECKED(...) > } > > It should be easy, > * to survey, which chip settings are touched, if set_rx_cfg is called. > * to survey, that all params of the rx_cfg struct are taken care of. > > The longer the function gets, the harder it is, to service it. > I really would be happy, if we don't go this way. > > > Anyway, please keep the naming convention of rf69.c: > > rf69 -set/get - action > -> rf69_set_crc_enable No... Simon's name is better. His is shorter and makes more sense. :( regards, dan carpenter