Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3374241imm; Thu, 17 May 2018 07:49:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoq76HECFagdf260JjVJf//YmP4nwcOi6F5VCc2AroZAoDlhVU0ncQ/UvvXotzruPGXoppt X-Received: by 2002:a65:47c8:: with SMTP id f8-v6mr4319223pgs.430.1526568577779; Thu, 17 May 2018 07:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526568577; cv=none; d=google.com; s=arc-20160816; b=nMsRATOodMsGhWTlR4BzRqNlB9gsN413CrpRsNIvPIQF9ZhgZx1rGMq9xd8x09YaoJ d2Q4C/ODVJSLGQF5ZbwH4JgJuKgaaDQxeNou/+cLe1ZZ+FD3KIaCPPaxf1bn+1YHxW+a UnkHoA7dnl9xtfS6n2TyYk6uz2Kz0PsDZQH37jcE1Q20ZCtZFAKPd2vRtWQbllHbeMRY vI86q9kpEM0aPCRfNXJzNRF8abBu3uyelRjWwvNNHjwRky+/Kf1Hx4wkAYup2uHhY3FG RhARiG/74WM0feS3odpPnMKIXLUyRpn+mxf+QMpBpn/fxU8Ul4zDCZFW4h9xAOFmXL4y QSow== 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:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=Zv1XqdoXo5yTQ+ewkrGfGAWh1pRvSF7SuDmpEZ8Jby8=; b=Pjvsv1e9qqVtJeYPh63Nxn1K2bSS416Uh+ulWT2QCCBvqFSfQbODnp8MUBgwbCtykD CDMhNc6/Fl/NiwH9uAOihYf+aOwVSbgMYYOc84FX5cxzLqxblanj5gEmou5vE8e2DdtL ikzS4NSgBhfi3Prqqfsu8pje4vsm2dcTYAUxzBD20IaORytKG74DWIS/SpkQbRefViUD y1P2IDWLb/0rh7XB38zz8+pKMZ8DZKdZ0INasF4fRHNUlqAmtWyaGONfGOJbBytEDBhz txWWJBvSdb0tjaeLb5+jD6aJbnnLqTfOZvhVHcIoXoFwPJg/OOlxh3jOPFCbeqctApHn +zWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AIhYe71z; 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=QUARANTINE 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 j3-v6si5090590pld.300.2018.05.17.07.49.23; Thu, 17 May 2018 07:49:37 -0700 (PDT) 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=AIhYe71z; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752245AbeEQOtC (ORCPT + 99 others); Thu, 17 May 2018 10:49:02 -0400 Received: from mail-vk0-f68.google.com ([209.85.213.68]:35585 "EHLO mail-vk0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751293AbeEQOtA (ORCPT ); Thu, 17 May 2018 10:49:00 -0400 Received: by mail-vk0-f68.google.com with SMTP id g72-v6so2855193vke.2; Thu, 17 May 2018 07:48:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Zv1XqdoXo5yTQ+ewkrGfGAWh1pRvSF7SuDmpEZ8Jby8=; b=AIhYe71zWtwewKQmJWuqUNAlJbsiRAGaDlQO7LN+DjsvN8I1SyXlQiN6uK1knj+CXj F1Vkn7dETTWSEQSQaD01NzmGfKFQqfFDlSp+vkayaZBTaXxLJUMdDhx3OH1bKrCu22Vt xWSc1b7EGou9zDn/z810HX65gXiTIN5zWsUSfEtzkXyGPBP8YeXMkMwXJf/76DozJEIk gwnZFBhnV5RaGSqPoWLITyqGHn/wDuLOCtEBfnm9ZGSLXoB2d3BLA9sH3lp6/E7kjsL2 PkUj4M4ixWlko8oxAGOL/kxyjV1bJkjJXf+G+9vd8atXk4bCFPF5lDc6U9+DKBFiH+iY t6kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Zv1XqdoXo5yTQ+ewkrGfGAWh1pRvSF7SuDmpEZ8Jby8=; b=T7E86uIoiR5oxG2S3FqcB+jVRjOEFQQdiiOTx1e1gMpndcpG9zDfd19+rwfqLKlgRe 4vSb92nn9S6SJ0TisVdPuSHKBWQkXjwyp0nHQQ7/ihFDabW82HamV16rQQBERkVUEQda rzHbowDLAb656F8/EaK3GGVazBBVboz9r28eDd0/04G/a/Yq2hHjNGxxL7qA4Yr9MUXa X/tG2LioSo0hBdSsEDEpG8Xg70ChV21TWBKfTP7urAdfFUY5hBr2pQsvYYSgP34ZIDbX tVyha+2h99LlrF2nHXVXsmrJZTeyyeYA5f+INbxwGuNSkOTtP2lqjSfg85JhvOantZN9 VCnA== X-Gm-Message-State: ALKqPwdJ1yAsQ96ZIxRo5oBXjcv2jK++ztas0SKu+vM6az+UKmfZCyYj PW4m2uN2Sx7ixQIfMdFlq1sTa4Xvorw8b5mNCnM= X-Received: by 2002:a1f:c2c7:: with SMTP id s190-v6mr4247872vkf.86.1526568539037; Thu, 17 May 2018 07:48:59 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:5f0c:0:0:0:0:0 with HTTP; Thu, 17 May 2018 07:48:58 -0700 (PDT) In-Reply-To: <20180515111711.l2g4vgsal7yr6dbr@flea> References: <20180225135308.GA14561@arx-s1> <20180226090038.etk5q4pd4rl5dvf6@flea.lan> <20180515111711.l2g4vgsal7yr6dbr@flea> From: Hao Zhang Date: Thu, 17 May 2018 22:48:58 +0800 Message-ID: Subject: Re: [PATCH v2 4/4] ARM: PWM: add allwinner sun8i pwm support. To: Maxime Ripard Cc: Thierry Reding , robh+dt@kernel.org, Mark Rutland , linux@armlinux.org.uk, Chen-Yu Tsai , Claudiu Beznea , linux-gpio@vger.kernel.org, open list , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "moderated list:ARM/Allwinner sunXi SoC support" , linux-pwm@vger.kernel.org, linux-sunxi@googlegroups.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-05-15 19:17 GMT+08:00 Maxime Ripard : > Hi, > > On Mon, May 14, 2018 at 10:45:44PM +0800, Hao Zhang wrote: >> 2018-02-26 17:00 GMT+08:00 Maxime Ripard : >> > Thanks for respinning this serie. It looks mostly good, but you still >> > have a quite significant number of checkpatch (--strict) warnings that >> > you should address. >> >> Thanks for reviews :) ,i'm sorry for that, it will be fixed next >> time. and, besides, in what situation were the checkpatch warning >> can be ignore=EF=BC=9F > > The only one that can be reasonably be ignored is the long line > warning, and only if complying to the limit would make it less easy to > understand. > >> > >> > On Sun, Feb 25, 2018 at 09:53:08PM +0800, hao_zhang wrote: >> >> +#define CAPTURE_IRQ_ENABLE_REG 0x0010 >> >> +#define CFIE(ch) BIT(ch << 1 + 1) >> >> +#define CRIE(ch) BIT(ch << 1) >> > >> > You should also put your argument between parentheses here (and in all >> > your other macros). >> >> Do you mean like this ? >> #define CFIE(ch) BIT((ch) << 1 + 1) >> #define CRIE(ch) BIT((ch) << 1) > > Yep, exactly. Otherwise, if you do something like CRIE(1 + 1), the > result will be BIT(1 + 1 << 1), which will expand to 3, instead of 4. > > Also, CFIE looks a bit weird here, is it the offset that is > incremented, or the value? You should probably have parentheses to > make it explicit. The vallue, BIT(((ch) << 1) + 1) It seem not very nice... uhmm... In CAPTURE_IRQ_ENABLE_REG odd number is CFIE, even number is CRIE each channel has one CFIE and CRIE. we can also describe like this: #define CFIE(ch) BIT((ch) * 2 + 1) #define CRIE(ch) BIT((ch) * 2) > >> > >> >> +static const u16 div_m_table[] =3D { >> >> + 1, >> >> + 2, >> >> + 4, >> >> + 8, >> >> + 16, >> >> + 32, >> >> + 64, >> >> + 128, >> >> + 256 >> >> +}; >> > >> > If this is just a power of two, you can use either the power of two / >> > ilog2 to switch back and forth, instead of using that table. >> >> I think using table is more explicit and extended... > > If you didn't have a simple mapping between the register values and > the divider value, then yeah, sure. But it's not the case here. > > Thanks! > Maxime > > -- > Maxime Ripard, Bootlin (formerly Free Electrons) > Embedded Linux and Kernel engineering > https://bootlin.com