All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Thomas Gleixner <tglx@linutronix.de>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Alexander Viro <viro@ftp.linux.org.uk>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] kill empty chardev open/release methods
Date: Fri, 16 May 2008 12:03:06 -0400	[thread overview]
Message-ID: <20080516160306.GA9103@infradead.org> (raw)
In-Reply-To: <20080516154922.GA25412@infradead.org>

On Fri, May 16, 2008 at 11:49:22AM -0400, Christoph Hellwig wrote:
> On Fri, May 16, 2008 at 09:44:06AM -0600, Jonathan Corbet wrote:
> > trivial as to not require locking (quite few of them are "return 0;"), or
> 
> If they literaly are 'return 0' you can just remove them, as a
> non-existing open op will just be fine.

And here's a patch to do just that:  remove all empty chardev
open/release methods.  Based on the list compiled by Jonathan.

(and yeah, ip2_ipl_open is not technically empty at the source level,
 but only at the binary level :))


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/arch/cris/arch-v10/drivers/i2c.c
===================================================================
--- linux-2.6.orig/arch/cris/arch-v10/drivers/i2c.c	2008-05-16 17:58:15.000000000 +0200
+++ linux-2.6/arch/cris/arch-v10/drivers/i2c.c	2008-05-16 17:58:19.000000000 +0200
@@ -563,18 +563,6 @@ i2c_readreg(unsigned char theSlave, unsi
 	return b;
 }
 
-static int
-i2c_open(struct inode *inode, struct file *filp)
-{
-	return 0;
-}
-
-static int
-i2c_release(struct inode *inode, struct file *filp)
-{
-	return 0;
-}
-
 /* Main device API. ioctl's to write or read to/from i2c registers.
  */
 
@@ -619,8 +607,6 @@ i2c_ioctl(struct inode *inode, struct fi
 static const struct file_operations i2c_fops = {
 	.owner    = THIS_MODULE,
 	.ioctl    = i2c_ioctl,
-	.open     = i2c_open,
-	.release  = i2c_release,
 };
 
 int __init
Index: linux-2.6/arch/cris/arch-v32/drivers/i2c.c
===================================================================
--- linux-2.6.orig/arch/cris/arch-v32/drivers/i2c.c	2008-05-16 17:57:56.000000000 +0200
+++ linux-2.6/arch/cris/arch-v32/drivers/i2c.c	2008-05-16 17:58:07.000000000 +0200
@@ -633,18 +633,6 @@ i2c_readreg(unsigned char theSlave, unsi
 	return b;
 }
 
-static int
-i2c_open(struct inode *inode, struct file *filp)
-{
-	return 0;
-}
-
-static int
-i2c_release(struct inode *inode, struct file *filp)
-{
-	return 0;
-}
-
 /* Main device API. ioctl's to write or read to/from i2c registers.
  */
 
@@ -689,8 +677,6 @@ i2c_ioctl(struct inode *inode, struct fi
 static const struct file_operations i2c_fops = {
 	.owner =    THIS_MODULE,
 	.ioctl =    i2c_ioctl,
-	.open =     i2c_open,
-	.release =  i2c_release,
 };
 
 static int __init i2c_init(void)
Index: linux-2.6/drivers/char/ip2/ip2main.c
===================================================================
--- linux-2.6.orig/drivers/char/ip2/ip2main.c	2008-05-16 17:59:17.000000000 +0200
+++ linux-2.6/drivers/char/ip2/ip2main.c	2008-05-16 17:59:37.000000000 +0200
@@ -203,7 +203,6 @@ static int set_serial_info(i2ChanStrPtr,
 static ssize_t ip2_ipl_read(struct file *, char __user *, size_t, loff_t *);
 static ssize_t ip2_ipl_write(struct file *, const char __user *, size_t, loff_t *);
 static int ip2_ipl_ioctl(struct inode *, struct file *, UINT, ULONG);
-static int ip2_ipl_open(struct inode *, struct file *);
 
 static int DumpTraceBuffer(char __user *, int);
 static int DumpFifoBuffer( char __user *, int);
@@ -236,7 +235,6 @@ static const struct file_operations ip2_
 	.read		= ip2_ipl_read,
 	.write		= ip2_ipl_write,
 	.ioctl		= ip2_ipl_ioctl,
-	.open		= ip2_ipl_open,
 }; 
 
 static unsigned long irq_counter = 0;
@@ -2918,58 +2916,6 @@ ip2_ipl_ioctl ( struct inode *pInode, st
 	return rc;
 }
 
-/******************************************************************************/
-/* Function:   ip2_ipl_open()                                                 */
-/* Parameters: Pointer to device inode                                        */
-/*             Pointer to file structure                                      */
-/* Returns:    Success or failure                                             */
-/*                                                                            */
-/* Description:                                                               */
-/*                                                                            */
-/*                                                                            */
-/******************************************************************************/
-static int
-ip2_ipl_open( struct inode *pInode, struct file *pFile )
-{
-	unsigned int iplminor = iminor(pInode);
-	i2eBordStrPtr pB;
-	i2ChanStrPtr  pCh;
-
-#ifdef IP2DEBUG_IPL
-	printk (KERN_DEBUG "IP2IPL: open\n" );
-#endif
-
-	switch(iplminor) {
-	// These are the IPL devices
-	case 0:
-	case 4:
-	case 8:
-	case 12:
-		break;
-
-	// These are the status devices
-	case 1:
-	case 5:
-	case 9:
-	case 13:
-		break;
-
-	// These are the debug devices
-	case 2:
-	case 6:
-	case 10:
-	case 14:
-		pB = i2BoardPtrTable[iplminor / 4];
-		pCh = (i2ChanStrPtr) pB->i2eChannelPtr;
-		break;
-
-	// This is the trace device
-	case 3:
-		break;
-	}
-	return 0;
-}
-
 static int
 proc_ip2mem_show(struct seq_file *m, void *v)
 {
Index: linux-2.6/drivers/isdn/hardware/eicon/divasi.c
===================================================================
--- linux-2.6.orig/drivers/isdn/hardware/eicon/divasi.c	2008-05-16 17:59:59.000000000 +0200
+++ linux-2.6/drivers/isdn/hardware/eicon/divasi.c	2008-05-16 18:00:13.000000000 +0200
@@ -74,7 +74,6 @@ static ssize_t um_idi_read(struct file *
 static ssize_t um_idi_write(struct file *file, const char __user *buf,
 			    size_t count, loff_t * offset);
 static unsigned int um_idi_poll(struct file *file, poll_table * wait);
-static int um_idi_open(struct inode *inode, struct file *file);
 static int um_idi_release(struct inode *inode, struct file *file);
 static int remove_entity(void *entity);
 static void diva_um_timer_function(unsigned long data);
@@ -136,7 +135,6 @@ static const struct file_operations diva
 	.read    = um_idi_read,
 	.write   = um_idi_write,
 	.poll    = um_idi_poll,
-	.open    = um_idi_open,
 	.release = um_idi_release
 };
 
@@ -398,12 +396,6 @@ static unsigned int um_idi_poll(struct f
 	return (POLLIN | POLLRDNORM);
 }
 
-static int um_idi_open(struct inode *inode, struct file *file)
-{
-	return (0);
-}
-
-
 static int um_idi_release(struct inode *inode, struct file *file)
 {
 	diva_um_idi_os_context_t *p_os;
Index: linux-2.6/drivers/isdn/hardware/eicon/divasmain.c
===================================================================
--- linux-2.6.orig/drivers/isdn/hardware/eicon/divasmain.c	2008-05-16 18:00:26.000000000 +0200
+++ linux-2.6/drivers/isdn/hardware/eicon/divasmain.c	2008-05-16 18:00:36.000000000 +0200
@@ -578,10 +578,6 @@ xdi_copy_from_user(void *os_handle, void
 /*
  * device node operations
  */
-static int divas_open(struct inode *inode, struct file *file)
-{
-	return (0);
-}
 
 static int divas_release(struct inode *inode, struct file *file)
 {
@@ -667,7 +663,6 @@ static const struct file_operations diva
 	.read    = divas_read,
 	.write   = divas_write,
 	.poll    = divas_poll,
-	.open    = divas_open,
 	.release = divas_release
 };
 

  reply	other threads:[~2008-05-16 16:03 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-14 17:49 [announce] "kill the Big Kernel Lock (BKL)" tree Ingo Molnar
2008-05-14 18:30 ` Andi Kleen
2008-05-14 21:00   ` Alan Cox
2008-05-14 21:13     ` Andi Kleen
2008-05-14 21:16       ` H. Peter Anvin
2008-05-14 21:17         ` Alan Cox
2008-05-14 21:19       ` Alan Cox
2008-05-14 21:45         ` Linus Torvalds
2008-05-14 22:03           ` Andi Kleen
2008-05-15 13:34             ` Alan Cox
2008-05-15 14:27               ` Andi Kleen
2008-05-15 15:36                 ` Alan Cox
2008-05-16 10:21                   ` Andi Kleen
2008-05-15  8:02           ` Ingo Molnar
2008-05-14 18:41 ` Linus Torvalds
2008-05-14 19:41   ` Ingo Molnar
2008-05-14 20:05     ` Frederik Deweerdt
2008-05-14 21:45 ` Jonathan Corbet
2008-05-14 21:39   ` Alan Cox
2008-05-14 21:56   ` Linus Torvalds
2008-05-14 22:07     ` Jonathan Corbet
2008-05-14 22:14       ` Linus Torvalds
2008-05-22 20:20       ` Alan Cox
2008-05-16 15:44     ` [PATCH, RFC] char dev BKL pushdown Jonathan Corbet
2008-05-16 15:49       ` Christoph Hellwig
2008-05-16 16:03         ` Christoph Hellwig [this message]
2008-05-16 16:24           ` [PATCH] kill empty chardev open/release methods Alan Cox
2008-05-16 20:55           ` Alan Cox
2008-05-18 19:46             ` Jonathan Corbet
2008-05-18 19:58               ` Alan Cox
2008-05-16 16:22       ` [PATCH, RFC] char dev BKL pushdown Alan Cox
2008-05-16 16:30       ` Linus Torvalds
2008-05-16 16:43         ` Jonathan Corbet
2008-05-17 21:15       ` Arnd Bergmann
2008-05-18 20:26         ` Jonathan Corbet
2008-05-19 23:07           ` Arnd Bergmann
     [not found]             ` <200805200111.47275.arnd@arndb.de>
2008-05-19 23:14               ` [PATCH 2/3, RFC] watchdog " Arnd Bergmann
2008-05-20  6:20                 ` Christoph Hellwig
2008-05-20  8:30                   ` Arnd Bergmann
2008-05-20 15:47                     ` Wim Van Sebroeck
2008-05-20 18:31                       ` Alan Cox
2008-05-20 21:00                         ` Arnd Bergmann
2008-05-22  9:34                           ` Alan Cox
2008-05-20  9:08                   ` Alan Cox
2008-05-20  8:42                 ` Alan Cox
2008-05-19 23:26             ` [PATCH 1/3, RFC] misc char " Arnd Bergmann
2008-05-20  0:07               ` Mike Frysinger
2008-05-20  0:21                 ` Jonathan Corbet
2008-05-20  0:46                   ` Mike Frysinger
2008-05-20  8:46               ` Alan Cox
2008-05-20 23:01               ` Mike Frysinger
2008-05-20 23:25                 ` Jonathan Corbet
2008-05-21 16:22                   ` Mike Frysinger
2008-05-19 23:34             ` [PATCH 3/3, RFC] remove BKL from misc_open() Arnd Bergmann
2008-05-20 15:13             ` [PATCH, RFC] char dev BKL pushdown Jonathan Corbet
2008-05-20 17:21               ` Arnd Bergmann
2008-05-20 18:51                 ` Alan Cox
2008-05-17 21:58       ` Linus Torvalds
2008-05-18 20:07         ` Jonathan Corbet
2008-05-14 22:11   ` [announce] "kill the Big Kernel Lock (BKL)" tree Andi Kleen
2008-05-14 22:16     ` Linus Torvalds
2008-05-14 22:21       ` Andi Kleen
2008-05-15 13:30         ` Alan Cox
2008-05-15 15:05         ` John Stoffel
2008-05-15 15:10           ` Andi Kleen
2008-05-15 15:18             ` John Stoffel
2008-05-15 15:45               ` Andi Kleen
2008-05-15  8:44   ` Jan Engelhardt
2008-05-15 14:54     ` Diego Calleja
2008-05-14 21:46 ` Alan Cox
2008-05-14 22:11   ` Linus Torvalds
2008-05-14 22:15   ` Andi Kleen
2008-05-15 17:41 ` Linus Torvalds
2008-05-15 20:27   ` Arjan van de Ven
2008-05-15 20:45     ` Peter Zijlstra
2008-05-15 21:22       ` Arjan van de Ven
2008-05-17  0:14 ` Kevin Winchester
2008-05-17  0:37   ` Kevin Winchester

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080516160306.GA9103@infradead.org \
    --to=hch@infradead.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=corbet@lwn.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.