Skip to contentSkip to conversation

Remove MOD_{INC,DEC}_USE_COUNT in em28xx-i2c

PATCH In review Eric Sesterhenn / snakebyte 3 participants 4 messages Dec 20, 2005 – Jan 8, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove MOD_{INC,DEC}_USE_COUNT in em28xx-i2c

hi,

em28xx-i2c.c is one of the last two users of MOD_{INC,DEC}_USE_COUNT in the kernel, this patch removes its usage.

drivers/media/video/em28xx/em28xx-i2c.c renamed from drivers/media/video/em28xx/em28xx-i2c.c.orig +0 -17
@@ -398,18 +398,6 @@ static u32 functionality(struct i2c_adap
 	return I2C_FUNC_SMBUS_EMUL;
 }
 
-#ifndef I2C_PEC
-static void inc_use(struct i2c_adapter *adap)
-{
-	MOD_INC_USE_COUNT;
-}
-
-static void dec_use(struct i2c_adapter *adap)
-{
-	MOD_DEC_USE_COUNT;
-}
-#endif
-
 static int em28xx_set_tuner(int check_eeprom, struct i2c_client *client)
 {
 	struct em28xx *dev = client->adapter->algo_data;
@@ -480,12 +468,7 @@ static struct i2c_algorithm em28xx_algo 
 };
 
 static struct i2c_adapter em28xx_adap_template = {
-#ifdef I2C_PEC
 	.owner = THIS_MODULE,
-#else
-	.inc_use = inc_use,
-	.dec_use = dec_use,
-#endif
 #ifdef I2C_CLASS_TV_ANALOG
 	.class = I2C_CLASS_TV_ANALOG,
 #endif

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

PATCH 1/1 Remove MOD_{INC,DEC}_USE_COUNT in pcf8563.c

hi,

this is removes the last usage of MOD_{INC,DEC}_USE_COUNT from the kernel.

arch/cris/arch-v32/drivers/pcf8563.c renamed from arch/cris/arch-v32/drivers/pcf8563.c.orig +1 -18
@@ -48,14 +48,11 @@ static const unsigned char days_in_month
 	{ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
 
 int pcf8563_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
-int pcf8563_open(struct inode *, struct file *);
-int pcf8563_release(struct inode *, struct file *);
 
 static struct file_operations pcf8563_fops = {
 	owner: THIS_MODULE,
 	ioctl: pcf8563_ioctl,
-	open: pcf8563_open,
-	release: pcf8563_release,
+	open: nonseekable_open,
 };
 
 unsigned char
@@ -322,19 +319,5 @@ pcf8563_ioctl(struct inode *inode, struc
 	return 0;
 }
 
-int
-pcf8563_open(struct inode *inode, struct file *filp)
-{
-	MOD_INC_USE_COUNT;
-	return 0;
-}
-
-int
-pcf8563_release(struct inode *inode, struct file *filp)
-{
-	MOD_DEC_USE_COUNT;
-	return 0;
-}
-
 module_init(pcf8563_init);
 module_exit(pcf8563_exit);

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw

Re: [KJ] [Patch] Remove MOD_{INC,DEC}_USE_COUNT in pcf8563.c

In reply to Eric Sesterhenn / snakebyte

arch/cris/arch-v32/drivers/pcf8563.c

Quoted 9 lines · Eric Sesterhenn / snakebyte
arch/cris/arch-v32/drivers/pcf8563.c renamed from arch/cris/arch-v32/drivers/pcf8563.c.orig +1 -2
 
 static struct file_operations pcf8563_fops = {
 	owner: THIS_MODULE,
 	ioctl: pcf8563_ioctl,
-	open: pcf8563_open,
-	release: pcf8563_release,
+	open: nonseekable_open,

Why nooseekable_open()?

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw

Re: [KJ] [Patch] Remove MOD_{INC,DEC}_USE_COUNT in pcf8563.c

In reply to Eric Sesterhenn / snakebyte
Quoted 8 lines · Alexey Dobriyan
Quoted 6 lines

 static struct file_operations pcf8563_fops = {
      owner: THIS_MODULE,
      ioctl: pcf8563_ioctl,
-     open: pcf8563_open,
-     release: pcf8563_release,
+     open: nonseekable_open,

Why nooseekable_open()?

I think it makes perfect sense for a driver that only has a .ioctl method to forbid lseek, it just doesn't make any sense to allow it.

Actually, I would think this file operations structure could use three patches in total:

- remove open and release function to get rid of use count misfeature
- add nonseekable_open reference to make lseek fail
- change to C99 struct initializers

Of course, none of these make an actual difference at the moment, but are steps in the right direction.

	Arnd <><

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors