From patchwork Fri Sep 7 18:10:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 1424761 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 34E47DF283 for ; Fri, 7 Sep 2012 18:15:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753448Ab2IGSPQ (ORCPT ); Fri, 7 Sep 2012 14:15:16 -0400 Received: from na3sys009aog102.obsmtp.com ([74.125.149.69]:35281 "EHLO na3sys009aog102.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753247Ab2IGSPP (ORCPT ); Fri, 7 Sep 2012 14:15:15 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]) (using TLSv1) by na3sys009aob102.postini.com ([74.125.148.12]) with SMTP ID DSNKUEo5rR4lGvc6wiSeJWrnYBJDE3fSTN0G@postini.com; Fri, 07 Sep 2012 11:15:14 PDT Received: by lbbgj3 with SMTP id gj3so18773lbb.19 for ; Fri, 07 Sep 2012 11:14:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=xmGtT/KFfx4eTwXk7+17HA3p3dm+HJF7hDpMWBzF6Aw=; b=HyZb0XcwsVaxpF8F1RrUJHpezSX5pst3QNqCkdMVVMQUB9EzrewgIXFfQv5yI+vY8n WQvUOz4YnDwEdlsvUEEyRwaHSBAJFDYMOp7mGpUwhF6FyiXTvto1SsZ9hc+13GjuqIjA vpzSYp4o300YzLJvhsofGQ8HdkiwCFKms08Rc4LTcPAL5xNqBapEC/0au6BuRm8UwFnQ hkYbz05nbdr5KM33sIMTwh73cNdhPY8mUoQXKqWgetx2wmou0yZlXttj2x1Ek5CMrGHX ymFIXN27SxYUOToJsHUSPablW/i+JnPX7gEiW3T1XPjo2E9suvFfAwGD0H5/pDA4Rr4S PSWg== Received: by 10.112.101.104 with SMTP id ff8mr2376784lbb.45.1347041698186; Fri, 07 Sep 2012 11:14:58 -0700 (PDT) Received: from localhost (cs78217178.pp.htv.fi. [62.78.217.178]) by mx.google.com with ESMTPS id lr17sm5831221lab.12.2012.09.07.11.14.56 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 07 Sep 2012 11:14:56 -0700 (PDT) From: Felipe Balbi To: Greg KH Cc: linux-serial@vger.kernel.org, Tony Lindgren , Linux OMAP Mailing List , Linux ARM Kernel Mailing List , Felipe Balbi Subject: [PATCH] serial: omap: fix DeviceTree boot Date: Fri, 7 Sep 2012 21:10:33 +0300 Message-Id: <1347041433-11723-1-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.7.12.rc3 In-Reply-To: <20120907175721.GD1303@atomide.com> References: <20120907175721.GD1303@atomide.com> X-Gm-Message-State: ALoCoQl4mvIW1hO33t65Ls5RrxBb6WtXSdLRuxd/nyMA47nbSE2isGswC6otHAmYXCbRCw5dtKk9 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org OMAP Architecture code, passes a few function pointers for UART driver to use in order to properly implement Power Management and Wakeup capabilities. The problem is that those function pointers, which are passed (ab)using platform_data on non-DT kernels, can't be passed down to drivers through DT. commit e5b57c0 (serial: omap: define helpers for pdata function pointers) failed to take DT kernels into consideration and caused a regression to DT kernel boot. Fix that by (re-)adding a check for valid pdata pointer together with valid pdata->$FUNCTION pointer. Reported-by: Tony Lindgren Signed-off-by: Felipe Balbi Tested-by: Tony Lindgren --- Tony, does this solve the issue ? drivers/tty/serial/omap-serial.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 0a6e78e..743e8e1 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c @@ -143,7 +143,7 @@ static int serial_omap_get_context_loss_count(struct uart_omap_port *up) { struct omap_uart_port_info *pdata = up->dev->platform_data; - if (!pdata->get_context_loss_count) + if (!pdata || !pdata->get_context_loss_count) return 0; return pdata->get_context_loss_count(up->dev); @@ -153,24 +153,30 @@ static void serial_omap_set_forceidle(struct uart_omap_port *up) { struct omap_uart_port_info *pdata = up->dev->platform_data; - if (pdata->set_forceidle) - pdata->set_forceidle(up->dev); + if (!pdata || !pdata->set_forceidle) + return; + + pdata->set_forceidle(up->dev); } static void serial_omap_set_noidle(struct uart_omap_port *up) { struct omap_uart_port_info *pdata = up->dev->platform_data; - if (pdata->set_noidle) - pdata->set_noidle(up->dev); + if (!pdata || !pdata->set_noidle) + return; + + pdata->set_noidle(up->dev); } static void serial_omap_enable_wakeup(struct uart_omap_port *up, bool enable) { struct omap_uart_port_info *pdata = up->dev->platform_data; - if (pdata->enable_wakeup) - pdata->enable_wakeup(up->dev, enable); + if (!pdata || !pdata->enable_wakeup) + return; + + pdata->enable_wakeup(up->dev, enable); } /*