Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2869512ybv; Mon, 24 Feb 2020 13:18:51 -0800 (PST) X-Google-Smtp-Source: APXvYqyfkm00Yy1BkVVr5uhjhxrsl5Y30tRWT/Gqq1s/qAn7PoQRRTnELvvfuS34jS17+IiFyG6c X-Received: by 2002:aca:1a10:: with SMTP id a16mr865737oia.9.1582579131764; Mon, 24 Feb 2020 13:18:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582579131; cv=none; d=google.com; s=arc-20160816; b=x84vwbsufAu7vU8zK1Ah5StjROFyAwXFmUaleLmVfbFQNuxR640TTODY1YvIM7PBaG xAW3F9KnqPNnuCu8lRvBjNI+KPM1zDGtfJky+jDGP4o/Rz5NsRFsJ9mThFtQvFYUCGD8 EPwx8YN9FyhSxm/xiNbxPJYbRLK3nG8hLRUrUEN1K8fwT1QPnlF7JXAwtXv+9CrNfWcM murP7eY4wccjlNQFqJwS/HkL5lBFY4mZDNpp1Gr0GSBovmYe09MN3JfsN68tkO0lLDWc 0Z1XXM20lk9G9/+9NqtkvyDhmzuBRZAV5Lj+6l+QPvHYgeasm7ZJNPslPZmKzJQUvHbs mk/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=7ozCdUKIM4lsstdEi6Y0sz+ZC1feIgVEpsATc4308nk=; b=jDmopSZWYkR1PRm7EvXf54Kn6fKZyC62CKm7zJVQJmMaAnQFFvc1txDQQZkl3skU9U IKl96DK0MnI+oiOLAZ6YHhq/01a8lInN/v9pssLWSg7lQkeBTMx/GocHPk8x5w+u3qlV T6+82Fu+jpLgEZ5GQ2/pPya+HI9/2QnjMH+AkacJXCPyUeb/2n3Psmq2nD0JcCFtMGLp IushNSZezQ/awe/55sTZvEFkRrGOt4LyPDrCXr3zO2J76aZNyvPNyky79nf2q0AhaGCn 1u0uZSbo/E1DxYRSC0UHN8eYMtsoeJIHXUiWX3RbE3PmD3c2BwlHjcmLaJCIIoW4Ilgw rzSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IQ5Jg+rX; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h203si5765695oif.3.2020.02.24.13.18.38; Mon, 24 Feb 2020 13:18:51 -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=@kernel.org header.s=default header.b=IQ5Jg+rX; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727877AbgBXVSW (ORCPT + 99 others); Mon, 24 Feb 2020 16:18:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:34358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726980AbgBXVSW (ORCPT ); Mon, 24 Feb 2020 16:18:22 -0500 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BD04221D7E; Mon, 24 Feb 2020 21:18:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582579100; bh=t1eTliHoc2mPAZ5+cMY6XLRoRkBliWk7pQLe/PrJWQI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=IQ5Jg+rXkq7W86aSzgukHnRm7wF3TjjR/Jna466xzekRDyTwVhDBAT5AclTrdbD7T cNlGlb+F33za6e4LO7OgYC5Jk3lTGe6ZF0C8zGTww4lbv+gb/EderrWBWBmv307J4V jgMBqobB+3c4BmAybfSm8O6i6kTzYaBfqvbgLl+M= Received: by mail-qk1-f170.google.com with SMTP id h4so10067560qkm.0; Mon, 24 Feb 2020 13:18:20 -0800 (PST) X-Gm-Message-State: APjAAAWS8i+XGOFyVw+n+qQWilw9QKgIaSUxnNlne3iH+md9ZH55dglV CSNNZUP0A/8fCtrEfE9tAgw5Dk7PFV0ULauBjQ== X-Received: by 2002:ae9:f205:: with SMTP id m5mr52638795qkg.152.1582579099834; Mon, 24 Feb 2020 13:18:19 -0800 (PST) MIME-Version: 1.0 References: <20200221021002.18795-1-yamada.masahiro@socionext.com> <20200221021002.18795-2-yamada.masahiro@socionext.com> <20200221153215.GA9815@bogus> In-Reply-To: From: Rob Herring Date: Mon, 24 Feb 2020 15:18:08 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/3] dt-bindings: gpio: Convert UniPhier GPIO to json-schema To: Masahiro Yamada Cc: DTML , Frank Rowand , Bartosz Golaszewski , "David S. Miller" , Greg Kroah-Hartman , Jonathan Cameron , Linus Walleij , Mark Rutland , Mauro Carvalho Chehab , linux-arm-kernel , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 24, 2020 at 10:00 AM Masahiro Yamada wrote: > > Hi Rob, > > On Mon, Feb 24, 2020 at 11:52 PM Rob Herring wrote: > > > > On Fri, Feb 21, 2020 at 11:33 PM Masahiro Yamada wrote: > > > > > > Hi Rob, > > > > > > On Sat, Feb 22, 2020 at 12:32 AM Rob Herring wrote: > > > > > > > > On Fri, 21 Feb 2020 11:10:01 +0900, Masahiro Yamada wrote: > > > > > Convert the UniPhier GPIO controller binding to DT schema format. > > > > > > > > > > I omitted the 'gpio-ranges' property because it is defined in the > > > > > dt-schema project (/schemas/gpio/gpio.yaml). > > > > > > > > > > As of writing, the 'gpio-ranges-group-names' is not defined in that > > > > > file despite it is a common property described in > > > > > Documentation/devicetree/bindings/gpio/gpio.txt > > > > > So, I defined it in this schema. > > > > > > > > > > Signed-off-by: Masahiro Yamada > > > > > --- > > > > > > > > > > I have a question about the range about 'ngpio'. > > > > > > > > > > ngpios: > > > > > minimum: 0 > > > > > maximum: 512 > > > > > > > > > > The 'ngpio' property is already defined as 'uint32' in the dt-schema tool: > > > > > https://github.com/robherring/dt-schema/blob/master/schemas/gpio/gpio.yaml#L20 > > > > > > > > > > 'uint32' is unsigned, so 'minimum: 0' looks too obvious. > > > > > > > > > > I cannot omit the minimum because minimum and maximum depend on each other. > > > > > I just put a sensible number, 512, in maximum. > > > > > > > > > > If this range is entirely unneeded, I will delete it. > > > > > > > > This property is generally for when you can have some number less > > > > than a maximum number implied by the compatible string. > > > > > > > > If there is really no max (e.g. 2^32 - 1 is valid), then just do > > > > 'ngpios: true' > > > > > > > > > What does ': true' mean? > > > > It's a schema that always passes validation. It's purpose here is just > > to say you are using this common property for this binding. > > > > OK, I see two useful cases: > > [1] > Documenting purpose in order to clarify > that you are using this property > > [2] > You need to explicitly specify ': true' > if you have 'additionalProperties: false' . > Otherwise, the following warning is displayed: > ... do not match any of the regexes: 'pinctrl-[0-9]+' > > > > For [1], it is already clear that this binding > is using ngpios from 'require' > > > require: > - ngpios > > > > > > > > > If it is documented somewhere, > > > could you point me to the reference? > > > > https://github.com/devicetree-org/dt-schema/blob/master/schemas/gpio/gpio.yaml > > > > > > > > Even if I remove the 'ngpio' entirely > > > from my dt-schema, the 'ngpio' is checked > > > correctly. > > > > Yes, if you change it to a string value for example, it should fail. > > (Only if DT_SCHEMA_FILES is not set without my kbuild changes) > > > > You should also add 'additionalProperties: false' at the top level of > > your schema and then it will also fail if you don't list ngpios in > > properties. > > Hmm, I am confused. > > 'require: - ngpios' will warn if you don't list ngpios. > > 'additionalProperties: false' will warn if you list > other properties than what is explicitly specified. Yeah, that's a quirk of json-schema. We could probably ensure that anything listed in 'required' also has a property schema, but in this case I think it's better to be explicit. Without 'additionalProperties: false', then the validation will pass with a 'foo-bar' property. Or worse, typos like 'ngpio', 'nrgpios', '#gpios-cells', etc. will pass validation. > BTW, I will not add 'additionalProperties: false' > in this binding. > > > The real DT files have > > interrupt-parent = <&aidet>; > (arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi line 324) > > but, commit 791d3ef2e11100449837dc0b6fe884e60ca3a484 > removed interrupt-parent from bindings. interrupt-parent is automagically added by the tools for any node with 'interrupts'. Similarly, 'interrupts-extended' will also work. Rob > > > > > > -- > Best Regards > Masahiro Yamada