From patchwork Fri Jan 8 05:16:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1423653 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Iq9jiMr0; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBrvQ2VB1z9sWf for ; Fri, 8 Jan 2021 16:17:12 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 678DD8290B; Fri, 8 Jan 2021 06:16:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Iq9jiMr0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E355B82917; Fri, 8 Jan 2021 06:16:56 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1D78E828FA for ; Fri, 8 Jan 2021 06:16:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x136.google.com with SMTP id y13so1200175ilm.12 for ; Thu, 07 Jan 2021 21:16:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8f1tQ04HGENrsv2IOOxeNrDCiv6+7rkL1c5ANE/7AJA=; b=Iq9jiMr0EWDs7tYfZSbPtJ/CpB17U38joVtMFXVOjyWSZfMVdaXTCAMgk6HspynLtT jxrhQn4jCamt8kfL+J4xw1/ZoXUFSpMIQoUSRyRuHXHbIopw/NNYZxoRWSstjKYpdcqH N28v5BEBWupzdfuqGvSJMmSxbHo00s4X6PD7g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8f1tQ04HGENrsv2IOOxeNrDCiv6+7rkL1c5ANE/7AJA=; b=WjySL7Q48xLFAQVtnDTL9OFresmXjQagViF/wkF2GQPxzFs5S2yqJGsf1tls7FF/Ae VRnainPOxM99omBENlP1j9M3fNIntaqE84ZNTpJ9p+aT6gc899jtAJX2nFZFQZwvRY+m roPfCsd43GWb9kZtR0GTf81734eOvvAG7Dnv42RPWqfdHvyn3v2omDzQHjdaTfuU7uWs Dt8XGinebGN0IWSF+8DLUKUYg3Hc+DAUKnZjvpw5VLDPjSy0VwQtANQ+2VNavsWY7/A1 CnWBCGVlFzCo+r8NkeR6ZyYQ2Q1QF7DGiBCOmKWdrzgH0YhK6H99aIGyaTepM0k2K3Ty oT2g== X-Gm-Message-State: AOAM532FYZ0H4YR6nNBkfNh2v7EPxD/inVS71p6ESHI5dG2wSQ/ib6rM sBFDQ6RmjLAPknJd//Tkf/1Cuw== X-Google-Smtp-Source: ABdhPJyukXKPumKgo73phZyqqyaXjRctVHXXffBwu7zB9pOfoTG0bof1AWnc9AmPrMdlgCGitaRRyw== X-Received: by 2002:a92:c002:: with SMTP id q2mr2373772ild.186.1610083012939; Thu, 07 Jan 2021 21:16:52 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id y3sm6400138ilc.2.2021.01.07.21.16.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 21:16:52 -0800 (PST) From: Simon Glass To: Marek Vasut Cc: Tom Rini , Stefan Roese , Simon Glass , Ramon Fried , u-boot@lists.denx.de Subject: [RFC PATCH v4 1/8] smem: Don't use -EPROBE_DEFER Date: Thu, 7 Jan 2021 22:16:29 -0700 Message-Id: <20210108051636.2928002-2-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog In-Reply-To: <20210108051636.2928002-1-sjg@chromium.org> References: <20210108051636.2928002-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean This has no useful meaning in U-Boot. Use -ENOMEM since that appears to be what has gone wrong in this case. We want to reserve this flag for internal driver model use. Signed-off-by: Simon Glass --- (no changes since v1) drivers/smem/msm_smem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/smem/msm_smem.c b/drivers/smem/msm_smem.c index 597d425d11f..26462151b3a 100644 --- a/drivers/smem/msm_smem.c +++ b/drivers/smem/msm_smem.c @@ -437,7 +437,7 @@ static int qcom_smem_alloc(unsigned int host, unsigned int item, size_t size) int ret; if (!__smem) - return -EPROBE_DEFER; + return -ENOMEM; if (item < SMEM_ITEM_LAST_FIXED) { dev_err(__smem->dev, @@ -559,7 +559,7 @@ static void *qcom_smem_get(unsigned int host, unsigned int item, size_t *size) { struct smem_partition_header *phdr; size_t cacheln; - void *ptr = ERR_PTR(-EPROBE_DEFER); + void *ptr = ERR_PTR(-ENOMEM); if (!__smem) return ptr; @@ -597,7 +597,7 @@ static int qcom_smem_get_free_space(unsigned int host) unsigned int ret; if (!__smem) - return -EPROBE_DEFER; + return -ENOMEM; if (host < SMEM_HOST_COUNT && __smem->partitions[host]) { phdr = __smem->partitions[host]; From patchwork Fri Jan 8 05:16:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1423655 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=PfZjA6WV; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBrvY6r2xz9sWc for ; Fri, 8 Jan 2021 16:17:29 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A947F82926; Fri, 8 Jan 2021 06:17:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="PfZjA6WV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C8DC68291F; Fri, 8 Jan 2021 06:17:01 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0B727828F9 for ; Fri, 8 Jan 2021 06:16:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd35.google.com with SMTP id e22so8088939iom.5 for ; Thu, 07 Jan 2021 21:16:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8KbHdh/lxw4DmetLCbRu5D2Q4YqihC/JznTetsyyxRg=; b=PfZjA6WVPZCgOi9hx0/5K4Cf1g6njgq9unkU+LfpNOVg5F3+cwt4ARc+Vehn4MPOJy 7LiC41zlrHc3BDDm68aVmMebjXwrdaffliKZBqzhVQaOwLu1TDiB3VYUNyK5NfbB4jJZ v4sgPs3F765sCdJVnABMG8M5DbcVfu8yGXFS8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8KbHdh/lxw4DmetLCbRu5D2Q4YqihC/JznTetsyyxRg=; b=AbqFiX+tTRB8pn1dSnNLmCF2xhEXh5o8NJookH8faUxl/tBno9dX6COkhrFLboEYPh 6mdUHXsGIDrzAwm8XTyDMI9giaaNQiVxlPa+wwcdyACuuvQJI125x8DewRrCE+wwLBGk uY8yth3s12FpP859ZSX5qVO4Cih1zZP0kM9f2jvIt3rN6/8x87/bEug/FAw3h+Nai1+g rrqkUtDB8yHLrddDB5pLZOj9PY/aMTAPSJXjdiQU77C1PTf70Zythv7ZhyGc+gPhp7HF yH58JCGQ2Fy7T5dFbSqQlM/V8iD6/MPW23kwmOZM29sJVD6ZCjpvlkiItNX0t+x+Ze1/ oaZw== X-Gm-Message-State: AOAM531mL2RzXvPEAqd2pPUM2/Odz3qpkR3rnFmfQIa+tmi5ZGvziQta nHHjxBPdiK8EIEIhO8yzAgx0Hw== X-Google-Smtp-Source: ABdhPJyoo4PYaBOb50ovnqcaAMB9W0QwegQnt/+P3J/FoDKE2VyqcrC0Xy99lEIykrQSdYts9aEeZQ== X-Received: by 2002:a5d:83c8:: with SMTP id u8mr4144074ior.160.1610083016729; Thu, 07 Jan 2021 21:16:56 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id y3sm6400138ilc.2.2021.01.07.21.16.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 21:16:56 -0800 (PST) From: Simon Glass To: Marek Vasut Cc: Tom Rini , Stefan Roese , Simon Glass , Anatolij Gustschin , Daniel Schwierzeck , Sean Anderson , u-boot@lists.denx.de, =?utf-8?q?=C3=81lv?= =?utf-8?q?aro_Fern=C3=A1ndez_Rojas?= Subject: [RFC PATCH v4 2/8] nand: brcmnand: Don't use -EPROBE_DEFER Date: Thu, 7 Jan 2021 22:16:30 -0700 Message-Id: <20210108051636.2928002-3-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog In-Reply-To: <20210108051636.2928002-1-sjg@chromium.org> References: <20210108051636.2928002-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean This has no useful meaning in U-Boot and will never be returned. We want to reserve this flag for internal driver model use. Drop the code. Signed-off-by: Simon Glass --- (no changes since v1) drivers/mtd/nand/raw/brcmnand/brcmnand.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 7349a9bc99e..99a1c2e6e2e 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -2526,10 +2526,7 @@ int brcmnand_probe(struct udevice *dev, struct brcmnand_soc *soc) if (ret) return ret; } else { - ret = PTR_ERR(ctrl->clk); - if (ret == -EPROBE_DEFER) - return ret; - + /* Ignore PTR_ERR(ctrl->clk) */ ctrl->clk = NULL; } From patchwork Fri Jan 8 05:16:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1423656 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=IDSFtM80; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBrvn2DGBz9sWc for ; Fri, 8 Jan 2021 16:17:41 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8BA6482923; Fri, 8 Jan 2021 06:17:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="IDSFtM80"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D172982918; Fri, 8 Jan 2021 06:17:03 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E852782918 for ; Fri, 8 Jan 2021 06:16:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd34.google.com with SMTP id n4so8597653iow.12 for ; Thu, 07 Jan 2021 21:16:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XgQFncliCvswesEcuzGqeNtFVt+wGkgj2Pm0NWsYDoc=; b=IDSFtM80N808VRf3aVH2Ujqh4qfUBUKEetFxqyAEcYrN5LWAranUd9bty3TXEGNfH/ Aj43aNV6SW+2Lmmbn+dkTzKjW8AEj4p9pYVvFyGWijZKmrworH0aW+8s4fBT7WAwNPr+ 40iuPBSMmyAQn0MoHT4GG/oAbXW0Uh9kH86Zs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XgQFncliCvswesEcuzGqeNtFVt+wGkgj2Pm0NWsYDoc=; b=odeyxAAYUgTMnEE7yWiOjP/tfPErYO9XEBDX/+bzgz/F/bAf4/LhjyqOaprROn901u F07guo1YIrho6Gfg1cKWhwfqWmGk9RHPGOJakUUAHs4hDfyJ0bHNNhkJ+/lrg7UPfp4V Rr+9AbCrDlIuV8RCATfrYW9ysragdk8K31gaYY6rsq48Ths1HWQ9Fk22SrU7ulUMu5Rx zGgfTvIRmno8YpZD+Dj8b5YIy9pmQpCdfxRxk3NaebC3opoGwxAmbRfniJrFLs88z2HH dN2EX5ezyooMnuqkn/zFfbs18HBAQ8IMGojw2jcsk0ZTa+Oa3mh1o8Un4otF1pLggOOy hjhg== X-Gm-Message-State: AOAM5317umx8xXH2UqtxMR1URCnfKkumDBJ5IFLzV0yDb/nwG/bgTnG2 n8SytGTyRZNAEwjXlLCuEIEmow== X-Google-Smtp-Source: ABdhPJy7V76FZ7DZ1gFCVmxTOmqAc2Y9alE1/hJlcrHYfYXcDPr78gUoDe8D04t8VcH5M7c2SE59ww== X-Received: by 2002:a6b:dc0f:: with SMTP id s15mr4142599ioc.180.1610083017760; Thu, 07 Jan 2021 21:16:57 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id y3sm6400138ilc.2.2021.01.07.21.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 21:16:57 -0800 (PST) From: Simon Glass To: Marek Vasut Cc: Tom Rini , Stefan Roese , Simon Glass , Anatolij Gustschin , Jan Kiszka , Neil Armstrong , Pavel Herrmann , u-boot-amlogic@groups.io, u-boot@lists.denx.de Subject: [RFC PATCH v4 3/8] dm: Rename DM_FLAG_REMOVE_WITH_PD_ON Date: Thu, 7 Jan 2021 22:16:31 -0700 Message-Id: <20210108051636.2928002-4-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog In-Reply-To: <20210108051636.2928002-1-sjg@chromium.org> References: <20210108051636.2928002-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean This flag has the word 'REMOVE' in it which means it conflicts with the DM_REMOVE flags. Rename it to DM_FLAG_LEAVE_PD_ON which seems to indicate its purpose well enough. Signed-off-by: Simon Glass --- (no changes since v1) drivers/core/device-remove.c | 2 +- drivers/video/meson/meson_vpu.c | 2 +- drivers/watchdog/rti_wdt.c | 2 +- include/dm/device.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c index 7e8f3afb2d6..7874d53c843 100644 --- a/drivers/core/device-remove.c +++ b/drivers/core/device-remove.c @@ -200,7 +200,7 @@ int device_remove(struct udevice *dev, uint flags) if (!(flags & DM_REMOVE_NO_PD) && !(drv->flags & - (DM_FLAG_DEFAULT_PD_CTRL_OFF | DM_FLAG_REMOVE_WITH_PD_ON)) && + (DM_FLAG_DEFAULT_PD_CTRL_OFF | DM_FLAG_LEAVE_PD_ON)) && dev != gd->cur_serial_dev) dev_power_domain_off(dev); diff --git a/drivers/video/meson/meson_vpu.c b/drivers/video/meson/meson_vpu.c index ca6933a6c54..558f9ba766c 100644 --- a/drivers/video/meson/meson_vpu.c +++ b/drivers/video/meson/meson_vpu.c @@ -212,5 +212,5 @@ U_BOOT_DRIVER(meson_vpu) = { .probe = meson_vpu_probe, .bind = meson_vpu_bind, .priv_auto = sizeof(struct meson_vpu_priv), - .flags = DM_FLAG_PRE_RELOC | DM_FLAG_REMOVE_WITH_PD_ON, + .flags = DM_FLAG_PRE_RELOC | DM_FLAG_LEAVE_PD_ON, }; diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c index f64a39f6579..8335b20ae84 100644 --- a/drivers/watchdog/rti_wdt.c +++ b/drivers/watchdog/rti_wdt.c @@ -119,5 +119,5 @@ U_BOOT_DRIVER(rti_wdt) = { .ops = &rti_wdt_ops, .probe = rti_wdt_probe, .priv_auto = sizeof(struct rti_wdt_priv), - .flags = DM_FLAG_REMOVE_WITH_PD_ON, + .flags = DM_FLAG_LEAVE_PD_ON, }; diff --git a/include/dm/device.h b/include/dm/device.h index f5b4cd6876e..a52bbdc3a63 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -71,7 +71,7 @@ struct driver_info; * Device is removed without switching off its power domain. This might * be required, i. e. for serial console (debug) output when booting OS. */ -#define DM_FLAG_REMOVE_WITH_PD_ON (1 << 13) +#define DM_FLAG_LEAVE_PD_ON (1 << 13) /* * One or multiple of these flags are passed to device_remove() so that From patchwork Fri Jan 8 05:16:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1423657 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=VT0JgbCX; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBrw04rdzz9sWc for ; Fri, 8 Jan 2021 16:17:52 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CBFFD8292F; Fri, 8 Jan 2021 06:17:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="VT0JgbCX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 67ED68292B; Fri, 8 Jan 2021 06:17:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1E2D08291B for ; Fri, 8 Jan 2021 06:17:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2b.google.com with SMTP id n4so8597721iow.12 for ; Thu, 07 Jan 2021 21:17:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oCaFO7kR5q3HADwRC4Qrv1/l6MGNdcsEnYapgxhTmxU=; b=VT0JgbCXxgsVsxtDYr2ym0wOAebDubYSE3NbmrOo7kUpViCBqyxh8wmrP2DLki60LO JMj2b5PFkr2LTOBSXkllJrV2UMvfSqVVkxiiIbnxIKwCzv17imxoXV1JvuoP5DnZ4Zqq NxHi+0zxEKj11wmNOro6LFbAR3BzuYdaCxtsQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oCaFO7kR5q3HADwRC4Qrv1/l6MGNdcsEnYapgxhTmxU=; b=ebqLpfHpmQQtmz51AWxrS6QV24eKk3dgl3yJK4Ez2qxYEuCT9SymI1s99l+CWcQmSi XUX0dRG4QSuLnFk2oT6q7AXZGbzljSL2KjB24ziwnk9zA1QBfDtaZrxULvzM7FaOQUjd jZjhkpsHlPogGNmqtXru7XFR6p135+Mg8syBB35HXEpBqByHX1bzZwXh5OheBmnjrH2U EHnk/FxU/164VGyxjB3Wp2bNYM1N7Sd/D/LzcZxSGMpz+0yKxZgKoJmgdIXV4enOd9/n j2q8+oE3n2Is9vh4QjS9c3Q+ap6TpLBAqgtuO/90siAZyIj4i31EZSyI3tnaVFU8OPHD HyaA== X-Gm-Message-State: AOAM531MgqwtbJHNgE3HHbJR6XIEYdvnLlNQZusUqshtqy46Twuqum2I mHhqjJGeBj4RSwl7U95ShLMfZA== X-Google-Smtp-Source: ABdhPJxecj8Cnmc+FZe0VwxtWfCcUsX/XuKEVXW1Qqg9gvW/cDezB9JTbsBfwUtiXD2wSWAUg9TZ/Q== X-Received: by 2002:a05:6638:1202:: with SMTP id n2mr1902881jas.85.1610083019522; Thu, 07 Jan 2021 21:16:59 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id y3sm6400138ilc.2.2021.01.07.21.16.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 21:16:58 -0800 (PST) From: Simon Glass To: Marek Vasut Cc: Tom Rini , Stefan Roese , Simon Glass , Pavel Herrmann , Rayagonda Kokatanur , Srinath Mannam , u-boot@lists.denx.de Subject: [RFC PATCH v4 4/8] dm: pci: Correct use of wrong flag name Date: Thu, 7 Jan 2021 22:16:32 -0700 Message-Id: <20210108051636.2928002-5-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog In-Reply-To: <20210108051636.2928002-1-sjg@chromium.org> References: <20210108051636.2928002-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Update a driver that uses the incorrect flag. Add a comment to hopefully prevent furture mistakes. Signed-off-by: Simon Glass --- (no changes since v1) drivers/pci/pcie_iproc.c | 2 +- include/dm/device.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pcie_iproc.c b/drivers/pci/pcie_iproc.c index 6725ff64372..12ce9d525ca 100644 --- a/drivers/pci/pcie_iproc.c +++ b/drivers/pci/pcie_iproc.c @@ -1283,5 +1283,5 @@ U_BOOT_DRIVER(pci_iproc) = { .probe = iproc_pcie_probe, .remove = iproc_pcie_remove, .priv_auto = sizeof(struct iproc_pcie), - .flags = DM_REMOVE_OS_PREPARE, + .flags = DM_FLAG_OS_PREPARE, }; diff --git a/include/dm/device.h b/include/dm/device.h index a52bbdc3a63..2554f679277 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -77,6 +77,9 @@ struct driver_info; * One or multiple of these flags are passed to device_remove() so that * a selective device removal as specified by the remove-stage and the * driver flags can be done. + * + * DO NOT use these flags in your driver's @flags value... + * use the above DM_FLAG_... values instead */ enum { /* Normal remove, remove all devices */ From patchwork Fri Jan 8 05:16:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1423658 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=I0HbB9re; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBrwC3cshz9sWc for ; Fri, 8 Jan 2021 16:18:03 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 347F682933; Fri, 8 Jan 2021 06:17:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="I0HbB9re"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F18C68292B; Fri, 8 Jan 2021 06:17:07 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B3B348291E for ; Fri, 8 Jan 2021 06:17:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2b.google.com with SMTP id p187so8626477iod.4 for ; Thu, 07 Jan 2021 21:17:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=p9VKqYEv8jzYdFUbHU5S33MVwi1qx2w4eTLPwJjKBVk=; b=I0HbB9re5uUBfPq1gBK8sgbUhdhvbbise13XFyhLxHUksfCwaTgYWr4UsXvIGg8xfK 41mZoRQyOsXyXyfaJTrGSLWBZjt9YofkX+VHU50wUTEuuu9Y/WOXoGAK81FNk0c33FFe l+SvAQFyby8iKwlLvP2U6lMlVzNjvx4n+k/9I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p9VKqYEv8jzYdFUbHU5S33MVwi1qx2w4eTLPwJjKBVk=; b=PAig2BV3cScd1gFHR0fn1qxYvvsRxZd+o7ouIj7lpPt5/Y/Amv7NCqhX+EblLMm36H SmkoRim5rXXrXMchR/jxOdREm4TIu4XUv1hMkgxUoEWIUdjNAt111rrfYW+YSCuQgdFC v/daScIaNkRrlmAmwT5Z+73bJ/scb2hLTyRW/VTP9U0VeZHvhgdsGUAIkJPAT40IbbjZ CFC2X07oJb05NkKMXfDM2532U3cb8AetlFhTxQYjMAn5xeB6tlBd6rMbLpN67FDIFvig VsslOraUoyaBkri/5kqdl19q8eHgVNlnUnsh5P7nbopJva8BXSMryXmDXkLZ68R78OF/ iulQ== X-Gm-Message-State: AOAM530LZIxiY9YxeS33UAqBF+Qx7ftPQatTOVbxdqOQ/kBHIL8lVJHo VwfXcLbVCJCCTXZEllLx2qjnqg== X-Google-Smtp-Source: ABdhPJzShmCs3alR9pSNyexUqOBZXZ2NidhY09ba/oGY0a01hDhAdbZ8tRmIuYh5E8YrVi6zH+ivmA== X-Received: by 2002:a02:b011:: with SMTP id p17mr1897043jah.55.1610083020553; Thu, 07 Jan 2021 21:17:00 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id y3sm6400138ilc.2.2021.01.07.21.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 21:17:00 -0800 (PST) From: Simon Glass To: Marek Vasut Cc: Tom Rini , Stefan Roese , Simon Glass , Pavel Herrmann , u-boot@lists.denx.de Subject: [RFC PATCH v4 5/8] dm: core: Remove children before advising uclass Date: Thu, 7 Jan 2021 22:16:33 -0700 Message-Id: <20210108051636.2928002-6-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog In-Reply-To: <20210108051636.2928002-1-sjg@chromium.org> References: <20210108051636.2928002-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean At present the uclass pre-remove method is called before the children are removed. But the children may refused to be removed, in whch case the uclass is in a tricky situation. At present we handle this by calling the uclass' post_probe() method. But it seems better to avoid doing anything with the uclass in this case. Switch the ordering so that we make sure the children can be removed before advising the uclass. Signed-off-by: Simon Glass --- (no changes since v1) drivers/core/device-remove.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c index 7874d53c843..35b625e7b1f 100644 --- a/drivers/core/device-remove.c +++ b/drivers/core/device-remove.c @@ -172,13 +172,13 @@ int device_remove(struct udevice *dev, uint flags) drv = dev->driver; assert(drv); - ret = uclass_pre_remove_device(dev); + ret = device_chld_remove(dev, NULL, flags); if (ret) return ret; - ret = device_chld_remove(dev, NULL, flags); + ret = uclass_pre_remove_device(dev); if (ret) - goto err; + return ret; /* * Remove the device if called with the "normal" remove flag set, @@ -216,12 +216,6 @@ err_remove: /* We can't put the children back */ dm_warn("%s: Device '%s' failed to remove, but children are gone\n", __func__, dev->name); -err: - ret = uclass_post_probe_device(dev); - if (ret) { - dm_warn("%s: Device '%s' failed to post_probe on error path\n", - __func__, dev->name); - } return ret; } From patchwork Fri Jan 8 05:16:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1423660 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=KQozif3E; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBrwc4Fdjz9sWf for ; Fri, 8 Jan 2021 16:18:24 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DDF5782939; Fri, 8 Jan 2021 06:17:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="KQozif3E"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B8D5082930; Fri, 8 Jan 2021 06:17:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EFA2D82923 for ; Fri, 8 Jan 2021 06:17:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd30.google.com with SMTP id e22so8089046iom.5 for ; Thu, 07 Jan 2021 21:17:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oXJ0FnN+5ls/fdUwwDxWvwUoJLpFlBc0ITxDG1JLNh4=; b=KQozif3ENYIwSUyXiLhQ/Y50s1GIKA9B/DAvLZus40And4MYsJchiAwEvZj64dhDOE Zj7nglYr1WNR+J6silikO4c3RiKIQdJaZMblZIyTPQu5S+DjYUSuN12rrKwEcIGRvUOL 5P2ALZfOUsgGFNzxQACsLiH3u5r26tH7YedKI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oXJ0FnN+5ls/fdUwwDxWvwUoJLpFlBc0ITxDG1JLNh4=; b=CopU1NzJUCufB81+TgdEctD4/+IR/ra6oC/obC5OV+elPz8iM3CwONs7kunkBKj3uD M28ZqbnlN8dbxTR/dxXLstk7TE69y5+kc5wq9xv2Vj29XNn0s/YzjNXFRMLknBaJAI5x sgkfp0H2/IwrOhGd00Mztbg1lI1WX/4z3ENe/jeUsGpol13IfpcRLh+T6hXM1VH+DK4h xVfDYTH2v3fc8OJFPsYA9tyOYnwm0WZHFw6SYo3S9Tu09nuLH49JPzmhHqJ7+hYpM4GA hNoG7XVX9GfFlLKQ+obA49zEYYkO30KyndcIbi3cuPnqO7FjFt2DaZjpg8L3Zh3MIlxh P5Zg== X-Gm-Message-State: AOAM533htT0dA6uS96NeIUvkqs9r/uy/9rSmBlC8pp2U/rV86i9Mphd8 QMJStM79U3d67SXXClyfMklDOA== X-Google-Smtp-Source: ABdhPJzaKaOiy4yG3YNsDFZt5G6Ts0/ig8JlKHEHFzvWuuuLPZIk/34kpjVRbuseYkQHAvcKyndE8w== X-Received: by 2002:a02:4005:: with SMTP id n5mr1893800jaa.105.1610083021504; Thu, 07 Jan 2021 21:17:01 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id y3sm6400138ilc.2.2021.01.07.21.17.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 21:17:01 -0800 (PST) From: Simon Glass To: Marek Vasut Cc: Tom Rini , Stefan Roese , Simon Glass , Pavel Herrmann , u-boot@lists.denx.de Subject: [RFC PATCH v4 6/8] dm: core: Avoid partially removing devices Date: Thu, 7 Jan 2021 22:16:34 -0700 Message-Id: <20210108051636.2928002-7-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog In-Reply-To: <20210108051636.2928002-1-sjg@chromium.org> References: <20210108051636.2928002-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean At present if device_remove() decides that the device should not actually be removed, it still calls the uclass pre_remove() method and powers the device down. Signed-off-by: Simon Glass --- (no changes since v1) drivers/core/device-remove.c | 61 ++++++++++++++++++++++++------------ include/dm/device-internal.h | 9 +++++- test/dm/virtio.c | 4 ++- 3 files changed, 52 insertions(+), 22 deletions(-) diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c index 35b625e7b1f..aca0f98a94b 100644 --- a/drivers/core/device-remove.c +++ b/drivers/core/device-remove.c @@ -8,6 +8,8 @@ * Pavel Herrmann */ +#define LOG_CATEGORY LOGC_DM + #include #include #include @@ -54,7 +56,7 @@ int device_chld_remove(struct udevice *dev, struct driver *drv, continue; ret = device_remove(pos, flags); - if (ret) + if (ret && ret != -EKEYREJECTED) return ret; } @@ -149,13 +151,24 @@ void device_free(struct udevice *dev) devres_release_probe(dev); } -static bool flags_remove(uint flags, uint drv_flags) +/** + * flags_remove() - Figure out whether to remove a device + * + * @flags: Flags passed to device_remove() + * @drv_flags: Driver flags + * @return 0 if the device should be removed, + * -EKEYREJECTED if @flags includes a flag in DM_REMOVE_ACTIVE_ALL but + * @drv_flags does not (indicates that this device has nothing to do for + * DMA shutdown or OS prepare) + */ +static int flags_remove(uint flags, uint drv_flags) { - if ((flags & DM_REMOVE_NORMAL) || - (flags && (drv_flags & (DM_FLAG_ACTIVE_DMA | DM_FLAG_OS_PREPARE)))) - return true; + if (flags & DM_REMOVE_NORMAL) + return 0; + if (flags && (drv_flags & DM_REMOVE_ACTIVE_ALL)) + return 0; - return false; + return -EKEYREJECTED; } int device_remove(struct udevice *dev, uint flags) @@ -169,22 +182,32 @@ int device_remove(struct udevice *dev, uint flags) if (!(dev_get_flags(dev) & DM_FLAG_ACTIVATED)) return 0; - drv = dev->driver; - assert(drv); - + /* + * If the child returns EKEYREJECTED, continue. It just means that it + * didn't match the flags. + */ ret = device_chld_remove(dev, NULL, flags); - if (ret) - return ret; - - ret = uclass_pre_remove_device(dev); - if (ret) + if (ret && ret != -EKEYREJECTED) return ret; /* * Remove the device if called with the "normal" remove flag set, * or if the remove flag matches any of the drivers remove flags */ - if (drv->remove && flags_remove(flags, drv->flags)) { + assert(drv); + drv = dev->driver; + ret = flags_remove(flags, drv->flags); + if (ret) { + log_debug("%s: When removing: flags=%x, drv->flags=%x, err=%d\n", + dev->name, flags, drv->flags, ret); + return ret; + } + + ret = uclass_pre_remove_device(dev); + if (ret) + return ret; + + if (drv->remove) { ret = drv->remove(dev); if (ret) goto err_remove; @@ -204,13 +227,11 @@ int device_remove(struct udevice *dev, uint flags) dev != gd->cur_serial_dev) dev_power_domain_off(dev); - if (flags_remove(flags, drv->flags)) { - device_free(dev); + device_free(dev); - dev_bic_flags(dev, DM_FLAG_ACTIVATED); - } + dev_bic_flags(dev, DM_FLAG_ACTIVATED); - return ret; + return 0; err_remove: /* We can't put the children back */ diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h index 639bbd293d9..b513b6861a6 100644 --- a/include/dm/device-internal.h +++ b/include/dm/device-internal.h @@ -123,7 +123,8 @@ int device_probe(struct udevice *dev); * * @dev: Pointer to device to remove * @flags: Flags for selective device removal (DM_REMOVE_...) - * @return 0 if OK, -ve on error (an error here is normally a very bad thing) + * @return 0 if OK, -EKEYREJECTED if not removed due to flags, other -ve on + * error (such an error here is normally a very bad thing) */ #if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) int device_remove(struct udevice *dev, uint flags); @@ -173,6 +174,12 @@ static inline int device_chld_unbind(struct udevice *dev, struct driver *drv) /** * device_chld_remove() - Stop all device's children + * + * This continues through all children recursively stopping part-way through if + * an error occurs. Return values of -EKEYREJECTED are ignored and processing + * continues, since they just indicate that the child did not elect to be + * removed based on the value of @flags. + * * @dev: The device whose children are to be removed * @drv: The targeted driver * @flags: Flag, if this functions is called in the pre-OS stage diff --git a/test/dm/virtio.c b/test/dm/virtio.c index ad355981cf4..9a7e658cceb 100644 --- a/test/dm/virtio.c +++ b/test/dm/virtio.c @@ -123,7 +123,9 @@ static int dm_test_virtio_remove(struct unit_test_state *uts) /* check the device can be successfully removed */ dev_or_flags(dev, DM_FLAG_ACTIVATED); - ut_assertok(device_remove(bus, DM_REMOVE_ACTIVE_ALL)); + ut_asserteq(-EKEYREJECTED, device_remove(bus, DM_REMOVE_ACTIVE_ALL)); + + ut_asserteq(false, device_active(dev)); return 0; } From patchwork Fri Jan 8 05:16:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1423659 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=JgIptQVW; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBrwQ3Spvz9sWc for ; Fri, 8 Jan 2021 16:18:14 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D42CE82927; Fri, 8 Jan 2021 06:17:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="JgIptQVW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DC56F82929; Fri, 8 Jan 2021 06:17:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C066D8291C for ; Fri, 8 Jan 2021 06:17:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd36.google.com with SMTP id u26so8650721iof.3 for ; Thu, 07 Jan 2021 21:17:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pfuQuTDU/vj8UPIdYCcYUnlIbfZpT7SxYZq0WwKCuyk=; b=JgIptQVWtBwIynsSZtyZ5lecbonsSoT3dfMJ/UMr3zfekJO0Z2fkJP00dfGKBFRoPl 1eFh/A4eiDWfdZuFodYACzBM81gp1zj3r9JzSUwON1L0K0uuF8WPZFKkpeNx265lx1pR tPTAGzn0xYGT2bVJXRzlvACPrvo58zcTAr7IM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pfuQuTDU/vj8UPIdYCcYUnlIbfZpT7SxYZq0WwKCuyk=; b=FepvMKJisuQ2bm5WF6gAlQgBDHlaKIcPgrAhWkPmYUns/03rBVF4XuvrZOZaVBCBL3 Uy0lIuqj4KB+/MCrMEOu2e9MjPMC9EYOTKRcwOhIlSE052Fbz1N4Dzcq4l+HumqRZ1A3 xyk9vjnjVw/Q8o3TgV5MgWyTwRHjnRTrAAKtdGEoeuaWfXYJ6iYCDdBjjDR/N2wu3Y+K s/Ip/2OUXpo7eMfxk9ajSeN58EHHP5j8wNwDYIZiBX5pERsQh91/0Hfi56cAVSCc3yoK 2I2iEXORF9n1msS5kuXUwWLkKQgVS9+qkawiS8BaT07+zyE0RkQml9IEnUvfeB3uOUXU pHGw== X-Gm-Message-State: AOAM532CZ+7KCbCqHwynDCp1QprseLFp8s0Cb42k/kIlEPPcXkHmsuSD 7/+s054flistJr8Y5eSME3p5SA== X-Google-Smtp-Source: ABdhPJwEJy5DpA/VhvgYp+UeGLNHopkR5eyr4DIN90fdaGn5Mu5tKmy2jGn3Xxh1ecDfToPTHHGixg== X-Received: by 2002:a6b:f112:: with SMTP id e18mr4127141iog.195.1610083022556; Thu, 07 Jan 2021 21:17:02 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id y3sm6400138ilc.2.2021.01.07.21.17.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 21:17:02 -0800 (PST) From: Simon Glass To: Marek Vasut Cc: Tom Rini , Stefan Roese , Marek Vasut , Marek Vasut , Simon Glass , Pavel Herrmann , u-boot@lists.denx.de Subject: [RFC PATCH v4 7/8] dm: core: Add late driver remove option Date: Thu, 7 Jan 2021 22:16:35 -0700 Message-Id: <20210108051636.2928002-8-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog In-Reply-To: <20210108051636.2928002-1-sjg@chromium.org> References: <20210108051636.2928002-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean From: Marek Vasut Add another flag to the DM core which could be assigned to drivers and which makes those drivers call their remove callbacks last, just before booting OS and after all the other drivers finished with their remove callbacks. This is necessary for things like clock drivers, where the other drivers might depend on the clock driver in their remove callbacks. Prime example is the mmc subsystem, which can reconfigure a card from HS mode to slower modes in the remove callback and for that it needs to reconfigure the controller clock. Signed-off-by: Marek Vasut Signed-off-by: Simon Glass --- Changes in v4: - Use 'vital' rather than 'late' as the description - Invert the removal flag to DM_REMOVE_NON_VITAL, to avoid the need for two-pass processing in the bowels of driver model - Simplify the test to only test 'vital' - Drop the change to uclass_destroy() drivers/core/device-remove.c | 14 ++++++++--- drivers/core/root.c | 2 ++ include/dm/device-internal.h | 10 +++++--- include/dm/device.h | 10 +++++++- test/dm/core.c | 47 ++++++++++++++++++++++++++++++++++++ test/dm/test-driver.c | 11 +++++++++ 6 files changed, 87 insertions(+), 7 deletions(-) diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c index aca0f98a94b..ad5e1b5b299 100644 --- a/drivers/core/device-remove.c +++ b/drivers/core/device-remove.c @@ -47,20 +47,24 @@ int device_chld_remove(struct udevice *dev, struct driver *drv, uint flags) { struct udevice *pos, *n; - int ret; + int result = 0; assert(dev); list_for_each_entry_safe(pos, n, &dev->child_head, sibling_node) { + int ret; + if (drv && (pos->driver != drv)) continue; ret = device_remove(pos, flags); - if (ret && ret != -EKEYREJECTED) + if (ret == -EPROBE_DEFER) + result = ret; + else if (ret && ret != -EKEYREJECTED) return ret; } - return 0; + return result; } int device_unbind(struct udevice *dev) @@ -160,11 +164,15 @@ void device_free(struct udevice *dev) * -EKEYREJECTED if @flags includes a flag in DM_REMOVE_ACTIVE_ALL but * @drv_flags does not (indicates that this device has nothing to do for * DMA shutdown or OS prepare) + * -EPROBE_DEFER if @flags is DM_REMOVE_NON_VITAL but @drv_flags contains + * DM_FLAG_VITAL (indicates the device is vital and should not be removed) */ static int flags_remove(uint flags, uint drv_flags) { if (flags & DM_REMOVE_NORMAL) return 0; + if (flags & DM_REMOVE_NON_VITAL) + return drv_flags & DM_FLAG_VITAL ? -EPROBE_DEFER : 0; if (flags && (drv_flags & DM_REMOVE_ACTIVE_ALL)) return 0; diff --git a/drivers/core/root.c b/drivers/core/root.c index 78de7cdf875..f5f8a1f7c6f 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -159,6 +159,8 @@ int dm_init(bool of_live) int dm_uninit(void) { + /* Remove non-vital devices first */ + device_remove(dm_root(), DM_REMOVE_NON_VITAL); device_remove(dm_root(), DM_REMOVE_NORMAL); device_unbind(dm_root()); gd->dm_root = NULL; diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h index b513b6861a6..39406c3f352 100644 --- a/include/dm/device-internal.h +++ b/include/dm/device-internal.h @@ -123,7 +123,8 @@ int device_probe(struct udevice *dev); * * @dev: Pointer to device to remove * @flags: Flags for selective device removal (DM_REMOVE_...) - * @return 0 if OK, -EKEYREJECTED if not removed due to flags, other -ve on + * @return 0 if OK, -EKEYREJECTED if not removed due to flags, -EPROBE_DEFER if + * this is a vital device and flags is DM_REMOVE_NON_VITAL, other -ve on * error (such an error here is normally a very bad thing) */ #if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) @@ -178,12 +179,15 @@ static inline int device_chld_unbind(struct udevice *dev, struct driver *drv) * This continues through all children recursively stopping part-way through if * an error occurs. Return values of -EKEYREJECTED are ignored and processing * continues, since they just indicate that the child did not elect to be - * removed based on the value of @flags. + * removed based on the value of @flags. Return values of -EPROBE_DEFER cause + * processing of other children to continue, but the function will return + * -EPROBE_DEFER. * * @dev: The device whose children are to be removed * @drv: The targeted driver * @flags: Flag, if this functions is called in the pre-OS stage - * @return 0 on success, -ve on error + * @return 0 on success, -EPROBE_DEFER if any child failed to remove, other + * -ve on error */ #if CONFIG_IS_ENABLED(DM_DEVICE_REMOVE) int device_chld_remove(struct udevice *dev, struct driver *drv, diff --git a/include/dm/device.h b/include/dm/device.h index 2554f679277..5f5df770ce1 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -73,6 +73,13 @@ struct driver_info; */ #define DM_FLAG_LEAVE_PD_ON (1 << 13) +/* + * Device is vital to the operation of other devices. It is possible to remove + * removed this device after all regular devices are removed. This is useful + * e.g. for clock, which need to be active during the device-removal phase. + */ +#define DM_FLAG_VITAL (1 << 14) + /* * One or multiple of these flags are passed to device_remove() so that * a selective device removal as specified by the remove-stage and the @@ -91,7 +98,8 @@ enum { /* Remove devices which need some final OS preparation steps */ DM_REMOVE_OS_PREPARE = DM_FLAG_OS_PREPARE, - /* Add more use cases here */ + /* Remove only devices that are not marked vital */ + DM_REMOVE_NON_VITAL = DM_FLAG_VITAL, /* Remove devices with any active flag */ DM_REMOVE_ACTIVE_ALL = DM_REMOVE_ACTIVE_DMA | DM_REMOVE_OS_PREPARE, diff --git a/test/dm/core.c b/test/dm/core.c index 1f5ca570dc7..aa84bc5e733 100644 --- a/test/dm/core.c +++ b/test/dm/core.c @@ -72,6 +72,10 @@ static struct driver_info driver_info_act_dma = { .name = "test_act_dma_drv", }; +static struct driver_info driver_info_act_vital_clk = { + .name = "test_act_vital_clk_drv", +}; + void dm_leak_check_start(struct unit_test_state *uts) { uts->start = mallinfo(); @@ -883,6 +887,49 @@ static int dm_test_remove_active_dma(struct unit_test_state *uts) } DM_TEST(dm_test_remove_active_dma, 0); +/* Test removal of 'vital' devices */ +static int dm_test_remove_vital(struct unit_test_state *uts) +{ + struct dm_test_state *dms = uts->priv; + struct udevice *normal, *vital; + + /* Skip the behaviour in test_post_probe() */ + dms->skip_post_probe = 1; + + ut_assertok(device_bind_by_name(dms->root, false, + &driver_info_act_vital_clk, &vital)); + ut_assertnonnull(vital); + + ut_assertok(device_bind_by_name(dms->root, false, &driver_info_manual, + &normal)); + ut_assertnonnull(normal); + + /* Probe the devices */ + ut_assertok(device_probe(vital)); + ut_assertok(device_probe(normal)); + + /* Check that devices are active right now */ + ut_asserteq(true, device_active(vital)); + ut_asserteq(true, device_active(normal)); + + /* Remove normal devices via selective remove flag */ + dm_remove_devices_flags(DM_REMOVE_NON_VITAL); + + /* Check that normal devices are inactive right now */ + ut_asserteq(true, device_active(vital)); + ut_asserteq(false, device_active(normal)); + + /* Remove vital devices via normal remove flag */ + dm_remove_devices_flags(DM_REMOVE_NORMAL); + + /* Check that all devices are inactive right now */ + ut_asserteq(false, device_active(vital)); + ut_asserteq(false, device_active(normal)); + + return 0; +} +DM_TEST(dm_test_remove_vital, 0); + static int dm_test_uclass_before_ready(struct unit_test_state *uts) { struct uclass *uc; diff --git a/test/dm/test-driver.c b/test/dm/test-driver.c index a67f5d3f982..a7930204c80 100644 --- a/test/dm/test-driver.c +++ b/test/dm/test-driver.c @@ -170,3 +170,14 @@ U_BOOT_DRIVER(test_act_dma_drv) = { .unbind = test_manual_unbind, .flags = DM_FLAG_ACTIVE_DMA, }; + +U_BOOT_DRIVER(test_act_vital_clk_drv) = { + .name = "test_act_vital_clk_drv", + .id = UCLASS_TEST, + .ops = &test_manual_ops, + .bind = test_manual_bind, + .probe = test_manual_probe, + .remove = test_manual_remove, + .unbind = test_manual_unbind, + .flags = DM_FLAG_VITAL, +}; From patchwork Fri Jan 8 05:16:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1423661 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=KoZALBAi; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBrwp3nNkz9sWc for ; Fri, 8 Jan 2021 16:18:34 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8D1F482943; Fri, 8 Jan 2021 06:17:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="KoZALBAi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 813208292F; Fri, 8 Jan 2021 06:17:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BE47782924 for ; Fri, 8 Jan 2021 06:17:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x132.google.com with SMTP id t3so5048888ilh.9 for ; Thu, 07 Jan 2021 21:17:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=snpxLE+OJm6tsekQadl69hE043AUSBMC6imAPoWfDJE=; b=KoZALBAiNWbGBS+eM73OuOceqwCIDmyM3hDkZrF/iI1i1fSE6he+5uSOMce75CbJKe i/FRods1FTewLsZ5lULEy4zfbQOcW7szzSzGZu8CZWy6Gnb2N4rEe34AjnG0WhWm95H2 S4yb36xlNRUFl6TD3NNuhx4pG5NjSuuq2f+cA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=snpxLE+OJm6tsekQadl69hE043AUSBMC6imAPoWfDJE=; b=RKCwyCNycmrYDsRTS2NtMSdV8KH82AxzyFgvgbT0kss+72NrYYHxfv3yeDjw9xNnzw TQc+TFvSKWZwCSUcjdi4oZqHLcpjLgfrETOtF6c8u38phTsOPUMd0IKbKDWLmiu37gGM hXoNxrvIhehsjYFAGWZJryqOIzCm0Sswb3z9eDCQoqdG1Feqdnqyq1SL/GexVLd4vh6d a8HrcVc1PPvvu/MDbdT6j1YAqV5vKOecN1VVNc3I59Q5HMaH+YD8A4ytdb2Cfzly1cYc JMUj1R+IdfZzgBgZUcYi8ef0A/jbUkNprbbnc2lnC/MIKviduT+VGS97ph44qoek6c1N ZQdg== X-Gm-Message-State: AOAM530zFGwTTpw2vW6TroVGqQ7qaQMqhFuTySbzhPmHuueUpLrwbSwm zBcve0MpD8ZAQ2bEiFWl4laIGw== X-Google-Smtp-Source: ABdhPJyXeM9TED47SJQnV3rPo0VVIzCnoUn9+lR5xkQ4hy6gJCFRO/63s5iGHA75sZycFZA+/K6vXA== X-Received: by 2002:a05:6e02:16ca:: with SMTP id 10mr791305ilx.28.1610083023579; Thu, 07 Jan 2021 21:17:03 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id y3sm6400138ilc.2.2021.01.07.21.17.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 21:17:03 -0800 (PST) From: Simon Glass To: Marek Vasut Cc: Tom Rini , Stefan Roese , Simon Glass , Pavel Herrmann , u-boot@lists.denx.de Subject: [RFC PATCH v4 8/8] dm: core: Add documentation about device removal Date: Thu, 7 Jan 2021 22:16:36 -0700 Message-Id: <20210108051636.2928002-9-sjg@chromium.org> X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog In-Reply-To: <20210108051636.2928002-1-sjg@chromium.org> References: <20210108051636.2928002-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Make mention of this feature in the core documentation so people can discover it without looking at a header file. Signed-off-by: Simon Glass --- Changes in v4: - Revised and updated based on discussion doc/driver-model/design.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/driver-model/design.rst b/doc/driver-model/design.rst index ffed7d5f79a..2417976ab74 100644 --- a/doc/driver-model/design.rst +++ b/doc/driver-model/design.rst @@ -880,6 +880,26 @@ If a parent has children these will be destroyed first. After this point the device does not exist and its memory has be deallocated. +Special cases for removal +------------------------- + +Some devices need to do clean-up before the OS is called. For example, a USB +driver may want to stop the bus. This can be done in the remove() method. +Some special flags are used to determine whether to remove the device: + + DM_FLAG_OS_PREPARE - indicates that the device needs to get ready for OS + boot. The device will be removed just before the OS is booted + DM_REMOVE_ACTIVE_DMA - indicates that the device uses DMA. This is + effectively the same as DM_FLAG_OS_PREPARE, so the device is removed + before the OS is booted + DM_FLAG_VITAL - indicates that the device is 'vital' to the operation of + other devices. It is possible to remove this device after all regular + devices are removed. This is useful e.g. for a clock, which need to + be active during the device-removal phase. + +The dm_remove_devices_flags() function can be used to remove devices based on +their driver flags. + Data Structures ---------------