From owner-svn-src-all@freebsd.org Wed Oct 16 15:10:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A342F167480; Wed, 16 Oct 2019 15:10:20 +0000 (UTC) (envelope-from br@bsdpad.com) Received: from sc1.bsdpad.com (sc1.bsdpad.com [163.172.212.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46tbMH4Krkz3NFK; Wed, 16 Oct 2019 15:10:19 +0000 (UTC) (envelope-from br@bsdpad.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bsdpad.com; s=20190317; h=Subject:To:From; bh=T+zbIgwfCI2Piytl61W4zeSfdGvTw0M8BEcvOeotNKU=; b=JtcD5H1PdbTQVc2ut+o0Iu7PFi wcsutts6rlKuXwB3cUCve4fs/BNjZtyDZEFDU3rxqPSn0vDxyFvIZXIBqdL5wjMEvuKa3ZcHfaDwi VZ9BPyi1BUITPrZecZ/sn7UICnfjPNc227ZaAGPmSnVVxptAJxzL6/qgs+1DNVaYMq9GSVxh3rt5h Y8e61n3piefE16+GAQcsEN6n5v3qTIm/QIOuw4vQ03TrFdJ9OubIT6iZImyAvvmPfN4pANC6aXSHi vytzG8Zmg0deNKu7SA+eJRsg1xhEHLVPn6YQveH2g5JNHLUGP0dMgVz5bVLrtXYuKeK8qmLhJtwSx VP44Yovg==; Received: from localhost ([127.0.0.1] helo=bsdpad.com) by sc1.bsdpad.com with smtp (Exim 4.91 (FreeBSD)) (envelope-from ) id 1iKksk-0004bX-Li; Wed, 16 Oct 2019 16:06:34 +0100 Received: by bsdpad.com (nbSMTP-1.00) for uid 1001 br@bsdpad.com; Wed, 16 Oct 2019 16:06:34 +0100 (BST) Date: Wed, 16 Oct 2019 16:06:34 +0100 From: Ruslan Bukin To: Emmanuel Vadot Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353493 - head/sys/dev/mmc/host Message-ID: <20191016150634.GA17444@bsdpad.com> References: <201910141553.x9EFr0Zb010167@repo.freebsd.org> <20191014181051.bd8c7a3dbb7b07a636d81ed9@bidouilliste.com> <20191014162751.GA30496@bsdpad.com> <20191014184526.e5f3798fd4d4f9c744f4a491@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191014184526.e5f3798fd4d4f9c744f4a491@bidouilliste.com> User-Agent: Mutt/1.11.2 (2019-01-07) X-Rspamd-Queue-Id: 46tbMH4Krkz3NFK X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdpad.com header.s=20190317 header.b=JtcD5H1P; dmarc=none; spf=pass (mx1.freebsd.org: domain of br@bsdpad.com designates 163.172.212.18 as permitted sender) smtp.mailfrom=br@bsdpad.com X-Spamd-Result: default: False [-5.01 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdpad.com:s=20190317]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdpad.com:+]; IP_SCORE(-2.81)[ip: (-9.43), ipnet: 163.172.208.0/20(-4.73), asn: 12876(0.11), country: FR(-0.00)]; FORGED_SENDER(0.30)[br@freebsd.org,br@bsdpad.com]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:12876, ipnet:163.172.208.0/20, country:FR]; FROM_NEQ_ENVFROM(0.00)[br@freebsd.org,br@bsdpad.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Oct 2019 15:10:20 -0000 On Mon, Oct 14, 2019 at 06:45:26PM +0200, Emmanuel Vadot wrote: > On Mon, 14 Oct 2019 17:27:51 +0100 > Ruslan Bukin wrote: > > > On Mon, Oct 14, 2019 at 06:10:51PM +0200, Emmanuel Vadot wrote: > > > > > > On Mon, 14 Oct 2019 15:53:00 +0000 (UTC) > > > Ruslan Bukin wrote: > > > > > > > Author: br > > > > Date: Mon Oct 14 15:52:59 2019 > > > > New Revision: 353493 > > > > URL: https://svnweb.freebsd.org/changeset/base/353493 > > > > > > > > Log: > > > > Fix the driver attachment in cases when the external resource devices > > > > (resets, regulators, clocks) are not available. > > > > > > > > Rely on a system initialization done by a bootloader in that cases. > > > > > > > > This fixes operation on Terasic DE10-Pro (an Intel Stratix 10 > > > > development kit). > > > > > > > > Sponsored by: DARPA, AFRL > > > > > > > > Modified: > > > > head/sys/dev/mmc/host/dwmmc.c > > > > > > > > Modified: head/sys/dev/mmc/host/dwmmc.c > > > > ============================================================================== > > > > --- head/sys/dev/mmc/host/dwmmc.c Mon Oct 14 15:33:53 2019 (r353492) > > > > +++ head/sys/dev/mmc/host/dwmmc.c Mon Oct 14 15:52:59 2019 (r353493) > > > > @@ -1,5 +1,5 @@ > > > > /*- > > > > - * Copyright (c) 2014 Ruslan Bukin > > > > + * Copyright (c) 2014-2019 Ruslan Bukin > > > > * All rights reserved. > > > > * > > > > * This software was developed by SRI International and the University of > > > > @@ -457,26 +457,20 @@ parse_fdt(struct dwmmc_softc *sc) > > > > > > > > /* IP block reset is optional */ > > > > error = hwreset_get_by_ofw_name(sc->dev, 0, "reset", &sc->hwreset); > > > > - if (error != 0 && error != ENOENT) { > > > > + if (error != 0 && error != ENOENT) > > > > device_printf(sc->dev, "Cannot get reset\n"); > > > > - goto fail; > > > > - } > > > > > > This is not correct, on a system without reset/clock/regulator support > > > you will get ENODEV as the phandle is present but no device is > > > associated with it. This is the case that you want to test. Currently > > > this hide all errors. > > > > The change means that the driver will be attached regardless of the return value from ext resources. > > Yes and this is a problem. > > > Why it is not correct? > > Because if a reset/clock/regulator is present but we failed to parse > the node (bad #clock-cell for example) this just assume that the > resource isn't present which is not correct. Or worse the underlying > gpio cannot be mapped, you now have a non functional driver because you > cannot switch the regulator. > Could an error in DTS convert a device from being optional to become mandatory? It is still not clear if any support present on a stage of parsing. Since the knowledge of registered support is at extres, then it should be mandatory from a driver perspective (if enabled in kernel config). And then the framework should make a decision based on any support present. What do you think ? Ruslan