From patchwork Sun Mar 29 23:19:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Klimov X-Patchwork-Id: 628 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Sun, 29 Mar 2009 23:19:51 +0000 Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1Lo4IA-0000Ku-Po; Sun, 29 Mar 2009 23:19:51 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750799AbZC2XTu (ORCPT + 1 other); Sun, 29 Mar 2009 19:19:50 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751390AbZC2XTt (ORCPT ); Sun, 29 Mar 2009 19:19:49 -0400 Received: from mail-bw0-f169.google.com ([209.85.218.169]:51446 "EHLO mail-bw0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750799AbZC2XTt (ORCPT ); Sun, 29 Mar 2009 19:19:49 -0400 Received: by bwz17 with SMTP id 17so1704404bwz.37 for ; Sun, 29 Mar 2009 16:19:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=FCWGI8nPZKCGGtZwjypyn9zWFl9371RP6pvU24KZTSw=; b=ZyKqL5KvYlMhct1ZcqfhfMqhim+MBl8SirN2zRlTtdttgfCVYxfqshZ/7zSB28gdu3 oHnnLfTMRZQGfTpbYn9gn623uO4UXHE0wwTvMetLfj4gqLLhIsaLKVruzSN8avsWGQw5 4qLltcixSEVLvskuOur/PtYhi6bnqwS6v7t8E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=X87QS3XGMFzjhmXhH2tuJXuqZMhDCbH0K9sB9kNy0hNax25VGERwzb3Nl/t2s8AqM3 8/hzALrw0+2sojYyvRwSod/zHOxPci2y+QhewRsfz496Y/5K2Os+GMSXclL6Ji9tw/Hd bLwUsjtAXiZeI7Q1Oidk78qQWvPK6E9c9Qtlk= Received: by 10.103.223.2 with SMTP id a2mr1405114mur.88.1238368786181; Sun, 29 Mar 2009 16:19:46 -0700 (PDT) Received: from ?192.168.1.42? (gw.zunet.ru [217.67.117.64]) by mx.google.com with ESMTPS id e10sm8112219muf.41.2009.03.29.16.19.45 (version=SSLv3 cipher=RC4-MD5); Sun, 29 Mar 2009 16:19:45 -0700 (PDT) Subject: [patch 1/2] v4l2-dev.c: return 0 for NULL open and release callbacks From: Alexey Klimov To: Mauro Carvalho Chehab , Hans Verkuil Cc: Douglas Schilling Landgraf , linux-media@vger.kernel.org Date: Mon, 30 Mar 2009 03:19:38 +0400 Message-Id: <1238368778.21620.35.camel@tux.localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.24.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Hello, all This is two patches that removes empty open and release functions in pci/isa radio drivers. To handle that we change v4l2-dev.c file. I'm not sure, but it's probably that small note about it should be added in docs. If i did something wrong, please correct. --- From: Hans Verkuil Patch allows v4l2_open and v4l2_release functions return 0 if open and release driver callbacks set to NULL. This will be used in radio drivers. Priority: normal Signed-off-by: Hans Verkuil Signed-off-by: Alexey Klimov -- diff -r df7a51ffa2ba linux/drivers/media/video/v4l2-dev.c --- a/linux/drivers/media/video/v4l2-dev.c Sun Mar 29 05:58:58 2009 -0300 +++ b/linux/drivers/media/video/v4l2-dev.c Mon Mar 30 01:13:59 2009 +0400 @@ -267,7 +267,7 @@ static int v4l2_open(struct inode *inode, struct file *filp) { struct video_device *vdev; - int ret; + int ret = 0; /* Check if the video device is available */ mutex_lock(&videodev_lock); @@ -281,7 +281,9 @@ /* and increase the device refcount */ video_get(vdev); mutex_unlock(&videodev_lock); - ret = vdev->fops->open(filp); + if(vdev->fops->open) + ret = vdev->fops->open(filp); + /* decrease the refcount in case of an error */ if (ret) video_put(vdev); @@ -292,7 +294,10 @@ static int v4l2_release(struct inode *inode, struct file *filp) { struct video_device *vdev = video_devdata(filp); - int ret = vdev->fops->release(filp); + int ret = 0; + + if(vdev->fops->release) + vdev->fops->release(filp); /* decrease the refcount unconditionally since the release() return value is ignored. */