Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp98679imm; Tue, 9 Oct 2018 14:31:31 -0700 (PDT) X-Google-Smtp-Source: ACcGV63twdOqPUX2FDVPxp4nJLc8pGND8L8gMowIK6udIDWqzA14xlrLqCXwHWKD9+Ms7iLxTGWe X-Received: by 2002:a62:ca4d:: with SMTP id n74-v6mr27001806pfg.10.1539120691837; Tue, 09 Oct 2018 14:31:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539120691; cv=none; d=google.com; s=arc-20160816; b=mAli9bHeoKKJtz4XZKNQzSSF8MvKXNNRrg6WbtkcwnsvTqYLCA5BGC16d/OLBxccQu Qg0Sk2jXjQyjtkYswFnn45MBjCZLgd1ueh4tOF8O+ZfWgD2NjJzDJ4yJ6dwBT5cflCYX dynmY7apSHKekGxlP9TCqhOrUxg8RmgqRGbUpiFR+mumqsDpTUHoDm9c9dmWiINb3/wb kbtaSCDwOY8XvBXjkKNAijuvlWKsdOHMqbQsu5QWP/U7rIztUVR1ViYPVxS/w6m5Vwhi 9ZxQbGsjZ1EdKJYSVzakPGTLaaxEMowzbme7BHlhfw37MP1lcBAGumbJs3uR3ofNF4Yz c73w== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=kNsEN9fgj+eMmhsT1rMQuTSSjhJhBh8IFG0WTO8rLeY=; b=sqIW14p8r59SBEv0AEr0MMu2qlqF5mEVHJ4BtDyk7aj5sqCfp/ozFK+P3+aKm4KOqD 1Swgja1584ihMGrM9CAUi17ksdqG4oTFvVM4gPUcvp+W2XS2szDEuzuuNzaUldUKwmXB rYWuQ540j4sUyASwSQM0r/KUCIjAhP2nT/foi/YcIhtudkJ/bqmVX2uUzeeRoaDyatHp HuES5Hn+4m1ydjlbNuqBBy3QmlYe7KHnZwPz2mgToAyuFElkYVYNrwUBeQvY6aGgQVJj kAbhRCsQx6ut+y2c5ZxW3l6q7tu6v0Zu9/i7mQnps9fccxp+zjhe0xrQ+9LsHLSXdmR5 hdbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b="XiB/BPWs"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t64-v6si8445293pfa.170.2018.10.09.14.31.15; Tue, 09 Oct 2018 14:31:31 -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=@agner.ch header.s=dkim header.b="XiB/BPWs"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726967AbeJJEtq (ORCPT + 99 others); Wed, 10 Oct 2018 00:49:46 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:53192 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726476AbeJJEtq (ORCPT ); Wed, 10 Oct 2018 00:49:46 -0400 Received: from allenwind.lan (unknown [37.17.239.109]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 193E75C05B4; Tue, 9 Oct 2018 23:30:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1539120651; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=kNsEN9fgj+eMmhsT1rMQuTSSjhJhBh8IFG0WTO8rLeY=; b=XiB/BPWshya9OO4RTLkDeqGQ8ESCH33BlwIm7GqLQqsO+Mm4pEbcbnuMcK3a1MSSCof908 tSFToqq5LElgFT3/WKMk+/yoniQNcjwf2a6iL+m9DlxlhC+pSzoCmVoHSi0lBajroT071v NZw6Ms1aw0SK3Xn7A7rwzBiSP1RCuKI= From: Stefan Agner To: p.zabel@pengutronix.de, airlied@linux.ie, gregkh@linuxfoundation.org Cc: rafael@kernel.org, linux@armlinux.org.uk, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Stefan Agner Subject: [PATCH 1/2] component: add optional cleanup function Date: Tue, 9 Oct 2018 23:30:48 +0200 Message-Id: <83a28282a3f745a4cd4ca77d0593ad2e61359a5d.1539120077.git.stefan@agner.ch> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add optional cleanup function on master level. This allows the master to call framework level cleanup functions in case binding of any component failed before the previously successfully bound components get unbound. Signed-off-by: Stefan Agner --- Hi, This is an attempt to fix the issue reported in: "drm/imx: Crash in drm_mode_config_cleanup" -- Stefan drivers/base/component.c | 4 ++++ include/linux/component.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/base/component.c b/drivers/base/component.c index 8946dfee4768..5350d931a663 100644 --- a/drivers/base/component.c +++ b/drivers/base/component.c @@ -535,6 +535,10 @@ int component_bind_all(struct device *master_dev, void *data) break; } + /* Allow the master to call framework cleanup functions */ + if (master->ops->cleanup) + master->ops->cleanup(master->dev); + if (ret != 0) { for (; i--; ) if (!master->match->compare[i].duplicate) { diff --git a/include/linux/component.h b/include/linux/component.h index e71fbbbc74e2..800534b52165 100644 --- a/include/linux/component.h +++ b/include/linux/component.h @@ -24,6 +24,7 @@ struct master; struct component_master_ops { int (*bind)(struct device *master); void (*unbind)(struct device *master); + void (*cleanup)(struct device *master); }; void component_master_del(struct device *, -- 2.19.1