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: 4716591 Return-Path: X-Original-To: patchwork-linux-fbdev@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 A9DF09F375 for ; Wed, 13 Aug 2014 07:17:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AE2942018B for ; Wed, 13 Aug 2014 07:17:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A5FC9201C0 for ; Wed, 13 Aug 2014 07:17:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751341AbaHMHRk (ORCPT ); Wed, 13 Aug 2014 03:17:40 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:54319 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751018AbaHMHRk (ORCPT ); Wed, 13 Aug 2014 03:17:40 -0400 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 Cc: Stephen Warren , Tomi Valkeinen , Jean-Christophe Plagniol-Villard , Maxime Ripard , linux-sunxi@googlegroups.com, linux-arm-kernel@lists.infradead.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> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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; }