Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1689026ybh; Thu, 23 Jul 2020 15:32:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMkW3dXB1TpobTTiQz9hrkKbM9VJ5lRKjnMT/yb5Hd/EPIMyyZBAHHVf85ffUf24fam3Es X-Received: by 2002:a05:6402:143c:: with SMTP id c28mr6547309edx.54.1595543536848; Thu, 23 Jul 2020 15:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595543536; cv=none; d=google.com; s=arc-20160816; b=PIMU9EgGueKYOc2ZRcrLFmb2tv/Rba5E1GVd21s6+9eNNgtgaBpMbVmc/boaNNFwBq YN7x+N+eV51PVuq0uNqklkExbyj3vd7vkh7TdDWLObf3r0MJMtcymGEu+H1MWNbW5e7R 6awf+YtBBkUTsvcVoES59CBO+MXad0N9mEpdShvwBRIbibuVs2lYGpShhM/qGYBBgVb1 hc4itCGzkU3hSelZ6fmV4NId268Ct8I0XFhYsM6OedRp9XHoEUb0EERN8xkGJVk2SStA +JHFj0nUtaI1liipkPwCNSB3p//mVvMP4SROesjm6O9W5CyTKY5p7KznutFWGdzlc9j5 5Ovg== 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; bh=vNUkjzRglYF3L6npDUYYr+tICqn7SiFYcdFjQa/wm4Q=; b=1EXkh6hri6bzFj6uokTZnI7OQeHNTK+B9nbhLKlvSchUZdtipVAhY6ROU4JZseDr2G ZL6bC3B2KbcEM0w+fSF8wMJI7gFt5DRxlh2uZOmqn8vKo3ZA9WyaOB1pjX/ev3pNWuR3 VESCo78b3MNVwURnkZVwxRW3zf0LrxyDxQrwS8UKoWaO+C5NjVdmlu5tvxcLQQjOj8zH oC6v3S2ITinpNwFQ0Zu6kkOIGIiGD9y3jrDX02SkK2jOsRWP8J0RNzDtWYy8s6DMh1K8 ecuYgGEs3tN9zE0nerYe8CnPkPrK3fD0rl445mCSxJAH3PT90tlJT/Iu6QPs0PCBALdk C6Vg== ARC-Authentication-Results: i=1; mx.google.com; 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 p4si2664881edq.201.2020.07.23.15.31.54; Thu, 23 Jul 2020 15:32:16 -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; 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 S1727808AbgGWW3H (ORCPT + 99 others); Thu, 23 Jul 2020 18:29:07 -0400 Received: from retiisi.org.uk ([95.216.213.190]:36640 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726922AbgGWW3F (ORCPT ); Thu, 23 Jul 2020 18:29:05 -0400 Received: from valkosipuli.localdomain (valkosipuli.retiisi.org.uk [IPv6:2a01:4f9:c010:4572::80:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hillosipuli.retiisi.org.uk (Postfix) with ESMTPS id 14EAF634C87; Fri, 24 Jul 2020 01:28:35 +0300 (EEST) Received: from sailus by valkosipuli.localdomain with local (Exim 4.92) (envelope-from ) id 1jyjha-0000Tg-Pi; Fri, 24 Jul 2020 01:28:34 +0300 Date: Fri, 24 Jul 2020 01:28:34 +0300 From: Sakari Ailus To: Kieran Bingham Cc: Kieran Bingham , linux-renesas-soc@vger.kernel.org, linux-media@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Laurent Pinchart , Jacopo Mondi , Niklas =?iso-8859-1?Q?S=F6derlund?= , Hans Verkuil , Hyun Kwon , Manivannan Sadhasivam , Rob Herring , Linus Walleij , Jacopo Mondi , Laurent Pinchart , Niklas =?iso-8859-1?Q?S=F6derlund?= Subject: Re: [PATCH v10 2/4] media: i2c: Add MAX9286 driver Message-ID: <20200723222834.GC829@valkosipuli.retiisi.org.uk> References: <20200612144713.502006-1-kieran.bingham+renesas@ideasonboard.com> <20200612144713.502006-3-kieran.bingham+renesas@ideasonboard.com> <1fb4a023-d177-744f-41f4-755aafbfa7f2@ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1fb4a023-d177-744f-41f4-755aafbfa7f2@ideasonboard.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kieran, On Thu, Jul 16, 2020 at 10:02:24AM +0100, Kieran Bingham wrote: > Hi Sakari, > > This is the output of checkpatch --strict on this driver. Sorry for not > detailing this in the commit or cover letter. No worries. > > > ./patches/gmsl/v10/v10-0001-dt-bindings-media-i2c-Add-bindings-for-Maxim-Int.patch has style problems, please review. > > -------------------------------------------------------------- > > ./patches/gmsl/v10/v10-0002-media-i2c-Add-MAX9286-driver.patch > > -------------------------------------------------------------- > > CHECK: Prefer using the BIT macro > > #246: FILE: drivers/media/i2c/max9286.c:40: > > +#define MAX9286_FSYNCMODE_INT_OUT (1 << 6) > > > > CHECK: Prefer using the BIT macro > > #251: FILE: drivers/media/i2c/max9286.c:45: > > +#define MAX9286_FSYNCMETH_SEMI_AUTO (1 << 0) > > > > CHECK: Prefer using the BIT macro > > #262: FILE: drivers/media/i2c/max9286.c:56: > > +#define MAX9286_EDC_6BIT_CRC (1 << 5) > > > > CHECK: Prefer using the BIT macro > > #268: FILE: drivers/media/i2c/max9286.c:62: > > +#define MAX9286_HVSRC_D14 (1 << 0) > > > > CHECK: Prefer using the BIT macro > > #286: FILE: drivers/media/i2c/max9286.c:80: > > +#define MAX9286_DATATYPE_RGB565 (1 << 0) > > > > CHECK: Prefer using the BIT macro > > #304: FILE: drivers/media/i2c/max9286.c:98: > > +#define MAX9286_I2CSLVSH_469NS_234NS (1 << 5) > > > > CHECK: Prefer using the BIT macro > > #312: FILE: drivers/media/i2c/max9286.c:106: > > +#define MAX9286_I2CMSTBT_28KBPS (1 << 2) > > > > CHECK: Prefer using the BIT macro > > #316: FILE: drivers/media/i2c/max9286.c:110: > > +#define MAX9286_I2CSLVTO_256US (1 << 0) > > None of those are appropriate to use the BIT() macro, as they are all > entries of a specific field with a shift, such as: > > #define MAX9286_FSYNCMODE_ECU (3 << 6) > #define MAX9286_FSYNCMODE_EXT (2 << 6) > #define MAX9286_FSYNCMODE_INT_OUT (1 << 6) > #define MAX9286_FSYNCMODE_INT_HIZ (0 << 6) > > Checkpatch is only picking up on the "1 << x" variant of each entry. Ideally you should use "1U << x" everywhere. If you happen to have a register with 31st bit signifying something, mayhem would follow. So the practice is to make all such definitions unsigned. > > > > CHECK: Macro argument reuse 'source' - possible side-effects? > > #399: FILE: drivers/media/i2c/max9286.c:193: > > +#define for_each_source(priv, source) \ > > + for ((source) = NULL; ((source) = next_source((priv), (source))); ) > > This warns against possible side effects, but the 're-use' effects are > desired ;-) > > If you'd prefer this macro to be re-written please let me know. Works for me. Some warnigns are just not useful. I bet quite a few macros elsewhere in the kernel would trigger this. > > > > CHECK: Lines should not end with a '(' > > #1372: FILE: drivers/media/i2c/max9286.c:1166: > > + ret = v4l2_fwnode_endpoint_parse( > > Full code block: > > > ret = v4l2_fwnode_endpoint_parse( > > of_fwnode_handle(node), &vep); > > if (ret) { > > of_node_put(node); > > return ret; > > } > > That one is awkward, and I chose to keep it as a lesser evil. > Of course now that we can officially go up to 120 chars, I could move > this line up. > > If you'd like this to be moved to a single line now we can go over 80 > chars, please confirm. I don't mind that. Mauro, any thoughts on this? -- Kind regards, Sakari Ailus