From patchwork Thu Nov 21 15:42:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 3219541 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 119A1C045B for ; Thu, 21 Nov 2013 15:45:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7150720374 for ; Thu, 21 Nov 2013 15:45:42 +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 239542074E for ; Thu, 21 Nov 2013 15:45:41 +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 1VjWQG-0006uj-Ki; Thu, 21 Nov 2013 15:44:05 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VjWPM-0006an-2y; Thu, 21 Nov 2013 15:43:08 +0000 Received: from mail-wg0-f42.google.com ([74.125.82.42]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VjWPI-0006ZN-RT for linux-arm-kernel@lists.infradead.org; Thu, 21 Nov 2013 15:43:05 +0000 Received: by mail-wg0-f42.google.com with SMTP id k14so225341wgh.3 for ; Thu, 21 Nov 2013 07:42:41 -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=Z3sQtzk0nP6YLKfLkKjLiLj6gQxfcsSAecHu0k3/yl9jJDqlkwfT/OWZZTJnPaxLVD 6QVuVo0KFzf44/+CNZ74Z/RPXK7o9PrMXWkB1W+NJj0MmTXCIEC4xLSlvhb1uf0FznZx 0YJmkaoC7N3KZgfWeBZ6WO4TV5lI8vuNWqE9WdzYxq4/dIpEuu6Dm65ylHgLS376mM7Q cTzMo3RdYZ7uv4goaYCR0fsrI7h8L7ZV/WDvl5tqq9e1S1+tInS/goFRWvNPgeoI81uI HLfQbVxLw9SrXMFii1iXdYM5tIkw5MyG3YEbLpCIXjYIEh0seUh9cEjx/7tEVYzc5t2q RJmA== X-Gm-Message-State: ALoCoQnWCWWUUbvZ6sLrdjNKrwH5MJNgo7vawmldcV5qTWEOiCeWp8bz12iUUmfAmnZYq+DVY1NH X-Received: by 10.180.206.138 with SMTP id lo10mr6314249wic.25.1385048561671; Thu, 21 Nov 2013 07:42:41 -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 dn2sm6329879wid.1.2013.11.21.07.42.40 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Nov 2013 07:42:41 -0800 (PST) From: Ard Biesheuvel To: x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] x86: move arch_cpu_uevent() to generic code Date: Thu, 21 Nov 2013 16:42:29 +0100 Message-Id: <1385048552-12528-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1385048552-12528-1-git-send-email-ard.biesheuvel@linaro.org> References: <1385048552-12528-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131121_104304_980494_E2DCD851 X-CRM114-Status: GOOD ( 12.95 ) X-Spam-Score: -2.6 (--) Cc: ak@linux.intel.com, catalin.marinas@arm.com, Ard Biesheuvel , gregkh@linuxfoundation.org, mingo@redhat.com, hpa@zytor.com, akpm@linux-foundation.org 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.7 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);