From patchwork Wed Feb 23 08:41:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Courbot X-Patchwork-Id: 583731 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1N8gKH3003973 for ; Wed, 23 Feb 2011 08:42:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755049Ab1BWImT (ORCPT ); Wed, 23 Feb 2011 03:42:19 -0500 Received: from mail-iw0-f174.google.com ([209.85.214.174]:40388 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754806Ab1BWImT (ORCPT ); Wed, 23 Feb 2011 03:42:19 -0500 Received: by iwn34 with SMTP id 34so1395491iwn.19 for ; Wed, 23 Feb 2011 00:42:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=OOLM2pQSuI8VE2CZc+0DdnjeZ9bAxRv5Myv25tcVRlo=; b=imM9Suh/mEy3s3AS0vv1RRPYvdpId8Xe/GVyfc2vkKd+bHLMQVARqE0+r0s7nTKZ9L vdPWxsNkZNb/Pe8yw6n8KPk99Oj3aYzTalKp9VayfAJt2pzgaLxTLezZbvVs5qPqutsQ jla/t8M7sMpbZSV9ozZPtIMK55ZSvH0ng1Ef8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=WoR+QW3kSo2fUE9iuMZmlyrfVWCjhhB+lY2Z/aCZHSfao2pHCOpxFexeTrJDRDGplT AsU1O/9pCLHARjTxoCdI/Rk0cUEnCEygNyKBNY7401lkaX9Kl9Y/eOxp0mgH5wzYiU9e WVNjHDfRRPdWmovVVgQ5gUW/7pGRo45rw2eoM= Received: by 10.231.11.204 with SMTP id u12mr2842208ibu.109.1298450538716; Wed, 23 Feb 2011 00:42:18 -0800 (PST) Received: from localhost.localdomain (e0109-114-22-40-118.uqwimax.jp [114.22.40.118]) by mx.google.com with ESMTPS id u9sm7039594ibe.8.2011.02.23.00.42.15 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 23 Feb 2011 00:42:17 -0800 (PST) From: Alexandre Courbot To: Paul Mundt , Magnus Damm Cc: linux-sh@vger.kernel.org, Alexandre Courbot Subject: [PATCH] fbdev: sh_mobile_lcdcfb: fix module lock acquisition Date: Wed, 23 Feb 2011 17:41:50 +0900 Message-Id: <1298450510-4075-1-git-send-email-gnurou@gmail.com> X-Mailer: git-send-email 1.7.4.1 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 23 Feb 2011 08:42:20 +0000 (UTC) diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index bf12e53..90d442d 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c @@ -614,7 +614,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) continue; board_cfg = &ch->cfg.board_cfg; - if (try_module_get(board_cfg->owner) && board_cfg->display_on) { + if (board_cfg->display_on && try_module_get(board_cfg->owner)) { board_cfg->display_on(board_cfg->board_data, ch->info); module_put(board_cfg->owner); } @@ -649,7 +649,7 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv) } board_cfg = &ch->cfg.board_cfg; - if (try_module_get(board_cfg->owner) && board_cfg->display_off) { + if (board_cfg->display_off && try_module_get(board_cfg->owner)) { board_cfg->display_off(board_cfg->board_data); module_put(board_cfg->owner); } @@ -1114,7 +1114,7 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb, switch(action) { case FB_EVENT_SUSPEND: - if (try_module_get(board_cfg->owner) && board_cfg->display_off) { + if (board_cfg->display_off && try_module_get(board_cfg->owner)) { board_cfg->display_off(board_cfg->board_data); module_put(board_cfg->owner); } @@ -1127,7 +1127,7 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb, mutex_unlock(&ch->open_lock); /* HDMI must be enabled before LCDC configuration */ - if (try_module_get(board_cfg->owner) && board_cfg->display_on) { + if (board_cfg->display_on && try_module_get(board_cfg->owner)) { board_cfg->display_on(board_cfg->board_data, info); module_put(board_cfg->owner); }