From patchwork Thu Nov 7 17:17:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 3153871 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 60D6ABEEB2 for ; Thu, 7 Nov 2013 17:24:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10EDE204E1 for ; Thu, 7 Nov 2013 17:24:15 +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 47CE2204DE for ; Thu, 7 Nov 2013 17:24:10 +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 1VeTJK-00042Q-Fd; Thu, 07 Nov 2013 17:24:02 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VeTJH-0005rE-SA; Thu, 07 Nov 2013 17:23:59 +0000 Received: from mail-wg0-f44.google.com ([74.125.82.44]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VeTJE-0005pn-L6 for linux-arm-kernel@lists.infradead.org; Thu, 07 Nov 2013 17:23:57 +0000 Received: by mail-wg0-f44.google.com with SMTP id n12so827587wgh.11 for ; Thu, 07 Nov 2013 09:23:34 -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=FCdINVV/uzYa9t7EckZYVGb/6c5PFz+kqNlFWISElx3CsGYBPloVYerQrMlOEd/eTX sxbwEPCsxH3GvZTEVgy2YytIJ0x4n7pfWWRVKBl4QJUkhYneeGSr7pKXEBsCBVkeTrgm 92N9nzHb0Cc9ET4fBCNK8jN3rnNM32SNcpC5Q0Y5GRLLLKYVnV9pAxhrQ0QAlJYIZCn9 dDeM2cKHK+JjKBEfanEgVDeaQqBgcUIyvlkzrfbto9TYl1EmnGvSxzIFqLYPC6y3oJYg iUHWGc5Cvz0HwPFqG0KX4EFem922ioxRWVVQ+iTFTs6lZlYhhvD9QLt7IGpJkfJHLpFN 2m+Q== X-Gm-Message-State: ALoCoQlNUaYHxFT95zsqXjRQGW81acRK2OnMS5ONVHwOHGR1VNOR/Z6f2Xj8SyumUpNieBUMOrn+ X-Received: by 10.180.97.5 with SMTP id dw5mr3593560wib.42.1383844665009; Thu, 07 Nov 2013 09:17:45 -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 fr4sm36736446wib.0.2013.11.07.09.17.43 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Nov 2013 09:17:44 -0800 (PST) From: Ard Biesheuvel To: x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 1/4] x86: move arch_cpu_uevent() to generic code Date: Thu, 7 Nov 2013 18:17:34 +0100 Message-Id: <1383844657-17487-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1383844657-17487-1-git-send-email-ard.biesheuvel@linaro.org> References: <1383844657-17487-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131107_122356_806633_0DE2BA54 X-CRM114-Status: GOOD ( 12.45 ) X-Spam-Score: -2.6 (--) Cc: catalin.marinas@arm.com, Ard Biesheuvel , gregkh@linuxfoundation.org, will.deacon@arm.com, mingo@redhat.com, hpa@zytor.com, steve.capper@linaro.org, tglx@linutronix.de 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);