Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756943Ab3JNQuE (ORCPT ); Mon, 14 Oct 2013 12:50:04 -0400 Received: from mail-we0-f178.google.com ([74.125.82.178]:65340 "EHLO mail-we0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755633Ab3JNQuB (ORCPT ); Mon, 14 Oct 2013 12:50:01 -0400 MIME-Version: 1.0 In-Reply-To: <20131014102635.GC4009@pd.tnic> References: <1381473166-29303-1-git-send-email-gong.chen@linux.intel.com> <1381473166-29303-4-git-send-email-gong.chen@linux.intel.com> <20131011152451.GF5925@pd.tnic> <20131014031633.GA12189@gchen.bj.intel.com> <20131014102635.GC4009@pd.tnic> Date: Mon, 14 Oct 2013 09:50:00 -0700 Message-ID: Subject: Re: [PATCH 3/8] ACPI, x86: Extended error log driver for x86 platform From: Tony Luck To: Borislav Petkov Cc: Chen Gong , Linux Kernel Mailing List , linux-acpi Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1271 Lines: 27 On Mon, Oct 14, 2013 at 3:26 AM, Borislav Petkov wrote: > On Sun, Oct 13, 2013 at 11:16:33PM -0400, Chen Gong wrote: >> But this driver can be loaded as a module. If this module is unloaded, >> extlog_print is gone. I can't keep such a pointer internally. > > Sure you can - you define a weak extlog_print() function in a > compilation unit which is always builtin. Maybe mce.c or so. "weak" is a good compile/link time tool to provide a default function while allowing override with a architecture (or more generally a CONFIG_*) specific one. But it is no help when loading/unloading modules. Think about it ... we have a call to this function from some place in the base kernel (originating from mce.o). Before the module is loaded you want that to leap to your weak function. Now load the module with the not-weak definition of the function - the module loader would have to go do a relocation fix-up in the base kernel to point to this new function. At module unload it would have to undo that. -Tony -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/