From patchwork Thu Nov 1 14:20:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 12646 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7B94A23F9D for ; Thu, 1 Nov 2012 14:20:36 +0000 (UTC) Received: from mail-da0-f52.google.com (mail-da0-f52.google.com [209.85.210.52]) by fiordland.canonical.com (Postfix) with ESMTP id 0E560A19042 for ; Thu, 1 Nov 2012 14:20:35 +0000 (UTC) Received: by mail-da0-f52.google.com with SMTP id f10so1139152dak.11 for ; Thu, 01 Nov 2012 07:20:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:x-gm-message-state; bh=/nLnI/FFNM2wxoAd9Ir8fGM6QNk11QKRtZjge/HHfH4=; b=UI5dTI1iQuTV5nurmgH0fK8j+isCoKFZSI3kuNS81uy5tu8Ft/eAcDUYgqUFKVd3jJ Z4sGdOScwgh9eeOFFJ7y2pfywYofeyBdm1E9nDlVpYytWSoTCWmjkhGmXPB3KElV++iq IoD/mStd32GprYwX7UGm86zSL8ymvTIYNFJcG8qBhJ3oRa57BBVTOpM++8fCh43NV66n l665wZEnldV7RLXsjbskoOXo9PkRCpBkLhMD7a9Y+X7jM0ua5ufa7sJDqR3z7icTz+ms oGltBE/55abAjwj/4K3L7MFi1vd5vQJ2ecfYa1i0RMTqJfAUIT0aqzmd9t7jCztxZ4WQ h5+A== Received: by 10.68.217.131 with SMTP id oy3mr15905582pbc.145.1351779635252; Thu, 01 Nov 2012 07:20:35 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.68.34.137 with SMTP id z9csp703523pbi; Thu, 1 Nov 2012 07:20:34 -0700 (PDT) Received: by 10.14.0.68 with SMTP id 44mr98769434eea.1.1351779633766; Thu, 01 Nov 2012 07:20:33 -0700 (PDT) Received: from eu1sys200aog108.obsmtp.com (eu1sys200aog108.obsmtp.com [207.126.144.125]) by mx.google.com with SMTP id n49si8098284eeo.121.2012.11.01.07.20.26 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 01 Nov 2012 07:20:33 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.125 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.125; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.125 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) smtp.mail=ulf.hansson@stericsson.com Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob108.postini.com ([207.126.147.11]) with SMTP ID DSNKUJKFKhRnsBC1u1JeOAjo0xr9QQdPtCB1@postini.com; Thu, 01 Nov 2012 14:20:33 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 51B151A4; Thu, 1 Nov 2012 14:20:13 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id DDBE7474D; Thu, 1 Nov 2012 14:20:12 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 69CEA24C2AB; Thu, 1 Nov 2012 15:20:05 +0100 (CET) Received: from steludxu1397.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Thu, 1 Nov 2012 15:20:12 +0100 From: Ulf Hansson To: Dmitry Torokhov , , Cc: , Linus Walleij , Naveen Kumar Gaddipati , Ulf Hansson Subject: [PATCH 1/2] Input: nomadik-ske-keypad - fixup use of clk Date: Thu, 1 Nov 2012 15:20:01 +0100 Message-ID: <1351779602-13818-2-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1351779602-13818-1-git-send-email-ulf.hansson@stericsson.com> References: <1351779602-13818-1-git-send-email-ulf.hansson@stericsson.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkkuhmVL3nOag+4QDnX0XPliHSKrcRiA8HAyspNRjKwCnZuuDocrfP0m3anWKsL66hzarB0 From: Ulf Hansson Do proper error handling for clk and make sure clocks are being prepared|unprepared as well as enabled|disabled. Signed-off-by: Ulf Hansson --- drivers/input/keyboard/nomadik-ske-keypad.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/input/keyboard/nomadik-ske-keypad.c b/drivers/input/keyboard/nomadik-ske-keypad.c index 49f5fa6..95dcc9b 100644 --- a/drivers/input/keyboard/nomadik-ske-keypad.c +++ b/drivers/input/keyboard/nomadik-ske-keypad.c @@ -287,14 +287,19 @@ static int __init ske_keypad_probe(struct platform_device *pdev) keypad->keymap, input); if (error) { dev_err(&pdev->dev, "Failed to build keymap\n"); - goto err_iounmap; + goto err_clk; } input_set_capability(input, EV_MSC, MSC_SCAN); if (!plat->no_autorepeat) __set_bit(EV_REP, input->evbit); - clk_enable(keypad->clk); + error = clk_prepare_enable(keypad->clk); + if (error) { + dev_err(&pdev->dev, "Failed to prepare/enable clk\n"); + goto err_clk; + } + /* go through board initialization helpers */ if (keypad->board->init) @@ -330,7 +335,8 @@ static int __init ske_keypad_probe(struct platform_device *pdev) err_free_irq: free_irq(keypad->irq, keypad); err_clk_disable: - clk_disable(keypad->clk); + clk_disable_unprepare(keypad->clk); +err_clk: clk_put(keypad->clk); err_iounmap: iounmap(keypad->reg_base); @@ -351,7 +357,7 @@ static int __devexit ske_keypad_remove(struct platform_device *pdev) input_unregister_device(keypad->input); - clk_disable(keypad->clk); + clk_disable_unprepare(keypad->clk); clk_put(keypad->clk); if (keypad->board->exit)