From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261362AbTDONO6 (for ); Tue, 15 Apr 2003 09:14:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261364AbTDONO5 (for ); Tue, 15 Apr 2003 09:14:57 -0400 Received: from [195.82.120.238] ([195.82.120.238]:9615 "EHLO deviant.impure.org.uk") by vger.kernel.org with ESMTP id S261362AbTDONO5 (for ); Tue, 15 Apr 2003 09:14:57 -0400 Date: Tue, 15 Apr 2003 14:24:58 +0100 From: Dave Jones To: M?ns Rullg?rd , Alan Cox , Linux Kernel Mailing List Subject: Re: Writing modules for 2.5 Message-ID: <20030415132458.GA15550@suse.de> Mail-Followup-To: Dave Jones , M?ns Rullg?rd , Alan Cox , Linux Kernel Mailing List References: <1050406513.27745.32.camel@dhcp22.swansea.linux.org.uk> <20030415135758.C32468@flint.arm.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030415135758.C32468@flint.arm.linux.org.uk> User-Agent: Mutt/1.5.4i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 15, 2003 at 01:57:58PM +0100, Russell King wrote: > On Tue, Apr 15, 2003 at 02:39:14PM +0200, M?ns Rullg?rd wrote: > > My situation is like this: I am converting a char device driver to > > work with linux 2.5. In the open and close functions there are > > MOD_INC/DEC_USECOUNT calls. The question is what they should be > > replaced with. Will it be handled correctly without them? > > If it's a character device driver using the struct file_operations, > set the owner field as Alan mentioned, and remove the > MOD_{INC,DEC}_USE_COUNT macros from the open/close methods. This > allows chrdev_open() (in fs/char_dev.c) to increment your module use > count automatically. Unless the open/close functions are doing funky things (like the watchdog drivers do). Dave