From patchwork Mon Nov 11 10:19:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 3166961 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7CBF29F3AE for ; Mon, 11 Nov 2013 10:21:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5F3D0201B7 for ; Mon, 11 Nov 2013 10:21:44 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1F1DC20171 for ; Mon, 11 Nov 2013 10:21:43 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vfobt-00030x-Dy; Mon, 11 Nov 2013 10:20:46 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vfobe-0002sY-Qs; Mon, 11 Nov 2013 10:20:30 +0000 Received: from mail-wi0-f170.google.com ([209.85.212.170]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VfobJ-0002oN-Tz for linux-arm-kernel@lists.infradead.org; Mon, 11 Nov 2013 10:20:11 +0000 Received: by mail-wi0-f170.google.com with SMTP id m19so2116727wiv.5 for ; Mon, 11 Nov 2013 02:19:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Q2kpxp2mjjiyQk35NOoX2L1k+3+IoLZ9Vbj7yvHspFM=; b=DYV8wf7zSwG4N0IbE+HCrP8bpEtdxGJx/MzBoDS8V8tkup//5Ayx6rSAOTTohC0Ech UZsYIH0FNCZWD6gfjMCosS1XiPGSHiJieQN5KoGPSDUfx4gyxOgeJ3E2jXqBsXotI1be UM1QRiDMV8vVaN0hGFSjGJvlJiFL6LcEOSkzXnUI8j/PPQDcDLOlC594EI6UXDsOAcFJ 3lR9tLvznv0RYVx4KY2bvg3cmD/Dhj0KmTl69RhQEjsswahsUwyD1iMO2fzIon/oOqdl FEfkhiWp2nXskGQX76F+9CdL/UPMr/m29dxsUGrAJekTM+LuQ4KZuBAyhlTzf9SawrFK 8iZA== X-Gm-Message-State: ALoCoQmzQ1JgHQT2LEkB8EX/50xnz87KFj3PJOgEat5HHxM0rygzXLx7Xv1L/3+PuOUk4/P2hcxB X-Received: by 10.194.187.171 with SMTP id ft11mr64453wjc.83.1384165184108; Mon, 11 Nov 2013 02:19:44 -0800 (PST) Received: from localhost.localdomain (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id gg20sm33709571wic.1.2013.11.11.02.19.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 11 Nov 2013 02:19:43 -0800 (PST) From: Ard Biesheuvel To: x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] x86: move arch_cpu_uevent() to generic code Date: Mon, 11 Nov 2013 11:19:32 +0100 Message-Id: <1384165175-16134-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1384165175-16134-1-git-send-email-ard.biesheuvel@linaro.org> References: <1384165175-16134-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131111_052010_057601_3EB76BF2 X-CRM114-Status: GOOD ( 12.68 ) X-Spam-Score: -2.6 (--) Cc: ak@linux.intel.com, steve.capper@linaro.org, Ard Biesheuvel , gregkh@linuxfoundation.org, hpa@zytor.com, catalin.marinas@arm.com, dave.martin@arm.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Only x86 implements arch_cpu_uevent(), and there is nothing arch specific about it, so move it to drivers/base/cpu.c. Signed-off-by: Ard Biesheuvel --- arch/x86/kernel/cpu/match.c | 11 ----------- drivers/base/cpu.c | 15 ++++++++++++++- include/linux/cpu.h | 1 - 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/arch/x86/kernel/cpu/match.c b/arch/x86/kernel/cpu/match.c index 3656537..ab6082a 100644 --- a/arch/x86/kernel/cpu/match.c +++ b/arch/x86/kernel/cpu/match.c @@ -78,14 +78,3 @@ ssize_t arch_print_cpu_modalias(struct device *dev, *buf++ = '\n'; return buf - bufptr; } - -int arch_cpu_uevent(struct device *dev, struct kobj_uevent_env *env) -{ - char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL); - if (buf) { - arch_print_cpu_modalias(NULL, NULL, buf); - add_uevent_var(env, "MODALIAS=%s", buf); - kfree(buf); - } - return 0; -} diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 848ebbd..49c6f4b 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -275,6 +275,19 @@ static void cpu_device_release(struct device *dev) */ } +#ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE +static int cpu_uevent(struct device *dev, struct kobj_uevent_env *env) +{ + char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL); + if (buf) { + arch_print_cpu_modalias(NULL, NULL, buf); + add_uevent_var(env, "MODALIAS=%s", buf); + kfree(buf); + } + return 0; +} +#endif + /* * register_cpu - Setup a sysfs device for a CPU. * @cpu - cpu->hotpluggable field set to 1 will generate a control file in @@ -296,7 +309,7 @@ int register_cpu(struct cpu *cpu, int num) cpu->dev.offline = !cpu_online(num); cpu->dev.of_node = of_get_cpu_node(num, NULL); #ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE - cpu->dev.bus->uevent = arch_cpu_uevent; + cpu->dev.bus->uevent = cpu_uevent; #endif cpu->dev.groups = common_cpu_attr_groups; if (cpu->hotpluggable) diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 801ff9e..c12ddd1 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -44,7 +44,6 @@ extern ssize_t arch_cpu_release(const char *, size_t); struct notifier_block; #ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE -extern int arch_cpu_uevent(struct device *dev, struct kobj_uevent_env *env); extern ssize_t arch_print_cpu_modalias(struct device *dev, struct device_attribute *attr, char *bufptr);