From patchwork Wed Mar 2 16:11:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Buesch X-Patchwork-Id: 603211 X-Patchwork-Delegate: tony@atomide.com 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 p22GC937019192 for ; Wed, 2 Mar 2011 16:12:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752980Ab1CBQL5 (ORCPT ); Wed, 2 Mar 2011 11:11:57 -0500 Received: from 80-190-117-144.ip-home.de ([80.190.117.144]:45230 "EHLO bu3sch.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752603Ab1CBQLz (ORCPT ); Wed, 2 Mar 2011 11:11:55 -0500 Received: by bu3sch.de with esmtpsa (Exim 4.69) (envelope-from ) id 1Puoeb-0002Jl-F7; Wed, 02 Mar 2011 17:11:57 +0100 Subject: [PATCH] cbus-retu-wdt: Fix bitfield access From: Michael Buesch To: Tony Lindgren Cc: Felipe Balbi , linux-omap Date: Wed, 02 Mar 2011 17:11:53 +0100 Message-ID: <1299082313.13604.13.camel@marge> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@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, 02 Mar 2011 16:12:25 +0000 (UTC) Index: linux-2.6.38-rc6/drivers/cbus/retu-wdt.c =================================================================== --- linux-2.6.38-rc6.orig/drivers/cbus/retu-wdt.c 2011-03-02 16:46:24.574676092 +0100 +++ linux-2.6.38-rc6/drivers/cbus/retu-wdt.c 2011-03-02 16:48:17.469807413 +0100 @@ -56,7 +56,7 @@ static int counter_param = RETU_WDT_MAX_ struct retu_wdt_dev { struct device *dev; - int users; + unsigned long users; struct miscdevice retu_wdt_miscdev; struct delayed_work ping_work; }; @@ -161,7 +161,7 @@ static DEVICE_ATTR(counter, S_IRUGO, ret static int retu_wdt_open(struct inode *inode, struct file *file) { - if (test_and_set_bit(1, (unsigned long *)&(retu_wdt->users))) + if (test_and_set_bit(0, &retu_wdt->users)) return -EBUSY; file->private_data = (void *)retu_wdt; @@ -177,7 +177,7 @@ static int retu_wdt_release(struct inode #ifndef CONFIG_WATCHDOG_NOWAYOUT retu_wdt_ping_enable(retu_wdt); #endif - wdev->users = 0; + clear_bit(0, &retu_wdt->users); return 0; } @@ -264,7 +264,6 @@ static int __init retu_wdt_probe(struct return -ENOMEM; wdev->dev = &pdev->dev; - wdev->users = 0; ret = device_create_file(&pdev->dev, &dev_attr_period); if (ret) {