From patchwork Wed Aug 13 07:17:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Verhaegen X-Patchwork-Id: 4716611 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AEC4F9F375 for ; Wed, 13 Aug 2014 07:21:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E16012018B for ; Wed, 13 Aug 2014 07:21:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EEE99201BC for ; Wed, 13 Aug 2014 07:21:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XHSp3-00046l-1h; Wed, 13 Aug 2014 07:18:13 +0000 Received: from mail-out.m-online.net ([212.18.0.9]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XHSow-00041r-DI for linux-arm-kernel@lists.infradead.org; Wed, 13 Aug 2014 07:18:07 +0000 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3hY2L95fvfz3hhss; Wed, 13 Aug 2014 09:17:37 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3hY2L94s34z7S6QK; Wed, 13 Aug 2014 09:17:37 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id i6dYe40DwIZu; Wed, 13 Aug 2014 09:17:36 +0200 (CEST) Received: from quoth.libv (ppp-188-174-145-148.dynamic.mnet-online.de [188.174.145.148]) by mail.mnet-online.de (Postfix) with ESMTP; Wed, 13 Aug 2014 09:17:36 +0200 (CEST) From: Luc Verhaegen To: linux-fbdev@vger.kernel.org Subject: [PATCH 3/4] simplefb: disable dt node upon remove Date: Wed, 13 Aug 2014 09:17:18 +0200 Message-Id: <1407914239-12054-4-git-send-email-libv@skynet.be> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1407914239-12054-1-git-send-email-libv@skynet.be> References: <1407914239-12054-1-git-send-email-libv@skynet.be> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140813_001806_837926_D359A49A X-CRM114-Status: GOOD ( 12.26 ) X-Spam-Score: 1.0 (+) Cc: Stephen Warren , linux-sunxi@googlegroups.com, Tomi Valkeinen , Maxime Ripard , Jean-Christophe Plagniol-Villard , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The next commit will handle clocks correctly, so that these do not get automatically disabled on certain SoC simplefb implementations. As a result, the removal of this simplefb driver, and the release of the clocks, is rather final, and only a full display driver can work after this. So, it makes sense to also flag the dt node as disabled, even though it has no real value today. Signed-off-by: Luc Verhaegen --- drivers/video/fbdev/simplefb.c | 43 ++++++++++++++++++++++++++++++++++++--- 1 files changed, 39 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c index 72a4f20..74c4b2a 100644 --- a/drivers/video/fbdev/simplefb.c +++ b/drivers/video/fbdev/simplefb.c @@ -138,6 +138,32 @@ static int simplefb_parse_dt(struct platform_device *pdev, return 0; } +/* + * Make sure that nothing tries to inadvertedly re-use this node... + */ +static int +simplefb_dt_disable(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + struct property *property; + int ret; + + property = kzalloc(sizeof(struct property), GFP_KERNEL); + if (!property) + return -ENOMEM; + + property->name = "status"; + property->value = "disabled"; + property->length = strlen(property->value) + 1; + + ret = of_update_property(np, property); + if (ret) + dev_err(&pdev->dev, "%s: failed to update property: %d\n", + __func__, ret); + + return ret; +} + static int simplefb_parse_pd(struct platform_device *pdev, struct simplefb_params *params) { @@ -187,17 +213,20 @@ static int simplefb_probe(struct platform_device *pdev) ret = simplefb_parse_dt(pdev, ¶ms); if (ret) - return ret; + goto error_dt_disable; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { dev_err(&pdev->dev, "No memory resource\n"); - return -EINVAL; + ret = -EINVAL; + goto error_dt_disable; } info = framebuffer_alloc(sizeof(struct simplefb_par), &pdev->dev); - if (!info) - return -ENOMEM; + if (!info) { + ret = -ENOMEM; + goto error_dt_disable; + } platform_set_drvdata(pdev, info); par = info->par; @@ -260,6 +289,10 @@ static int simplefb_probe(struct platform_device *pdev) error_fb_release: framebuffer_release(info); + error_dt_disable: + if (!dev_get_platdata(&pdev->dev) && pdev->dev.of_node) + simplefb_dt_disable(pdev); + return ret; } @@ -269,6 +302,8 @@ static int simplefb_remove(struct platform_device *pdev) unregister_framebuffer(info); framebuffer_release(info); + if (!dev_get_platdata(&pdev->dev) && pdev->dev.of_node) + simplefb_dt_disable(pdev); return 0; }