From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934243AbXGQPba (ORCPT ); Tue, 17 Jul 2007 11:31:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754697AbXGQPbY (ORCPT ); Tue, 17 Jul 2007 11:31:24 -0400 Received: from pasmtpa.tele.dk ([80.160.77.114]:58271 "EHLO pasmtpA.tele.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753591AbXGQPbX (ORCPT ); Tue, 17 Jul 2007 11:31:23 -0400 Date: Tue, 17 Jul 2007 17:32:36 +0200 From: Sam Ravnborg To: Takashi Iwai Cc: Domen Puncer , linux-kernel@vger.kernel.org Subject: Re: [PATCH] introduce __init_exit function annotation Message-ID: <20070717153236.GB25939@uranus.ravnborg.org> References: <20070717080248.GK4375@moe.telargo.com> <20070717130230.GB24780@uranus.ravnborg.org> <20070717151432.GA25939@uranus.ravnborg.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 17, 2007 at 05:16:13PM +0200, Takashi Iwai wrote: > At Tue, 17 Jul 2007 17:14:32 +0200, > Sam Ravnborg wrote: > > > > On Tue, Jul 17, 2007 at 04:52:12PM +0200, Takashi Iwai wrote: > > > At Tue, 17 Jul 2007 15:02:30 +0200, > > > Sam Ravnborg wrote: > > > > > > > > On Tue, Jul 17, 2007 at 10:02:48AM +0200, Domen Puncer wrote: > > > > > Introduce __init_exit, which is useful ie. for drivers that call > > > > > cleanup functions when they fail in __init functions. > > > > > > > > This is wrong. > > > > On arm (just one example of several) the __exit section are discarded > > > > at buildtime so any reference from __init to __exit will cause the > > > > linker to error out. > > > > > > Hmm, from what I see, it adds __init to the function. There is no > > > reference to __exit. > > > > The cleanup functions are marked __exit in the referenced case. > > My understanding is that it's the very purpose of this patch -- > change the mark from __exit to __init_exit for such clean-up > functions. And that is wrong. See following example: static void __init foo_init() { if (error) foo_exit(); } static void __exit foo_exit() { } If foo_init is annotated with __init_exit then in the build-in case it become __init and there is a reference to a non existing function because functions marked __exit are discarded during link or run-time (depending on arch). If foo_exit() are marked __init_exit then it becomes __init in the non-module case which seems coorrect. If this is the intention of the patch then it should be OK but then this intention should be spelled out. Sam