From patchwork Fri Feb 18 01:13:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Walls X-Patchwork-Id: 572711 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 p1I1DfX5021459 for ; Fri, 18 Feb 2011 01:13:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754500Ab1BRBNk (ORCPT ); Thu, 17 Feb 2011 20:13:40 -0500 Received: from proofpoint-cluster.metrocast.net ([65.175.128.136]:56724 "EHLO proofpoint-cluster.metrocast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753683Ab1BRBNi (ORCPT ); Thu, 17 Feb 2011 20:13:38 -0500 Received: from [192.168.1.2] (d-216-36-28-191.cpe.metrocast.net [216.36.28.191]) (authenticated bits=0) by pear.metrocast.net (8.13.8/8.13.8) with ESMTP id p1I1DbpC023920 for ; Fri, 18 Feb 2011 01:13:37 GMT Subject: [PATCH 02/13] lirc_zilog: Remove broken, ineffective reference counting From: Andy Walls To: linux-media@vger.kernel.org In-Reply-To: <1297991502.9399.16.camel@localhost> References: <1297991502.9399.16.camel@localhost> Date: Thu, 17 Feb 2011 20:13:50 -0500 Message-ID: <1297991630.9399.18.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 (2.28.3-1.fc12) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.2.15, 1.0.148, 0.0.0000 definitions=2011-02-18_01:2011-02-17, 2011-02-18, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=1 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=5.0.0-1012030000 definitions=main-1102170207 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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]); Fri, 18 Feb 2011 01:13:42 +0000 (UTC) diff --git a/drivers/staging/lirc/lirc_zilog.c b/drivers/staging/lirc/lirc_zilog.c index 7389b77..3a91257 100644 --- a/drivers/staging/lirc/lirc_zilog.c +++ b/drivers/staging/lirc/lirc_zilog.c @@ -305,34 +305,12 @@ static int lirc_thread(void *arg) static int set_use_inc(void *data) { - struct IR *ir = data; - - if (ir->l.owner == NULL || try_module_get(ir->l.owner) == 0) - return -ENODEV; - - /* lock bttv in memory while /dev/lirc is in use */ - /* - * this is completely broken code. lirc_unregister_driver() - * must be possible even when the device is open - */ - if (ir->rx != NULL) - i2c_use_client(ir->rx->c); - if (ir->tx != NULL) - i2c_use_client(ir->tx->c); - return 0; } static void set_use_dec(void *data) { - struct IR *ir = data; - - if (ir->rx) - i2c_release_client(ir->rx->c); - if (ir->tx) - i2c_release_client(ir->tx->c); - if (ir->l.owner != NULL) - module_put(ir->l.owner); + return; } /* safe read of a uint32 (always network byte order) */ @@ -1098,7 +1076,6 @@ static struct IR *find_ir_device_by_minor(unsigned int minor) static int open(struct inode *node, struct file *filep) { struct IR *ir; - int ret; unsigned int minor = MINOR(node->i_rdev); /* find our IR struct */ @@ -1112,12 +1089,6 @@ static int open(struct inode *node, struct file *filep) /* increment in use count */ mutex_lock(&ir->ir_lock); ++ir->open; - ret = set_use_inc(ir); - if (ret != 0) { - --ir->open; - mutex_unlock(&ir->ir_lock); - return ret; - } mutex_unlock(&ir->ir_lock); /* stash our IR struct */ @@ -1139,7 +1110,6 @@ static int close(struct inode *node, struct file *filep) /* decrement in use count */ mutex_lock(&ir->ir_lock); --ir->open; - set_use_dec(ir); mutex_unlock(&ir->ir_lock); return 0;