From patchwork Sun Jan 20 10:24:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 2008061 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 8C5D23FDD1 for ; Sun, 20 Jan 2013 10:26:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752090Ab3ATKZh (ORCPT ); Sun, 20 Jan 2013 05:25:37 -0500 Received: from mail.skyhub.de ([78.46.96.112]:41428 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751880Ab3ATKYl (ORCPT ); Sun, 20 Jan 2013 05:24:41 -0500 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1358677478; bh=RfzVF68s3SiPP/aIBbWgnNpDZMhL1s6C0bCjqe1ku7w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=V061 TYOq4GTJi+EWe2Xlkw2uOuZo0z44h7hKIUShANVdTsUQV2S7RWYquxMXcJqWq+UjwgD YiH9DovSn/o5CEQ0SJDG/cb64JiNHR7GvZMjFuesRThsUHyOnHk1QfcPS8FHamb0gfB ku6EVXl2Lr2U7tg7LPEaP/FfV3iKTdcMY= Received: from mail.skyhub.de ([127.0.0.1]) by localhost (door.skyhub.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Lrd0HwREox3l; Sun, 20 Jan 2013 11:24:38 +0100 (CET) Received: from liondog.tnic (p4FF1D70B.dip.t-dialin.net [79.241.215.11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id A4C581DA208; Sun, 20 Jan 2013 11:24:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1358677478; bh=RfzVF68s3SiPP/aIBbWgnNpDZMhL1s6C0bCjqe1ku7w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=V061 TYOq4GTJi+EWe2Xlkw2uOuZo0z44h7hKIUShANVdTsUQV2S7RWYquxMXcJqWq+UjwgD YiH9DovSn/o5CEQ0SJDG/cb64JiNHR7GvZMjFuesRThsUHyOnHk1QfcPS8FHamb0gfB ku6EVXl2Lr2U7tg7LPEaP/FfV3iKTdcMY= Received: by liondog.tnic (Postfix, from userid 1000) id CBB25101803; Sun, 20 Jan 2013 11:24:36 +0100 (CET) From: Borislav Petkov To: "Rafael J. Wysocki" Cc: =?UTF-8?q?Andr=C3=A9=20Przywara?= , Leonid Isaev , Tom Gundersen , cpufreq@vger.kernel.org, linux-acpi@vger.kernel.org, LKML , Borislav Petkov Subject: [PATCH 5/6] powernow-k8: Cleanup module request Date: Sun, 20 Jan 2013 11:24:29 +0100 Message-Id: <1358677470-17394-6-git-send-email-bp@alien8.de> X-Mailer: git-send-email 1.8.1.rc3 In-Reply-To: <1358677470-17394-1-git-send-email-bp@alien8.de> References: <1358677470-17394-1-git-send-email-bp@alien8.de> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Borislav Petkov Check whether we've actually already loaded acpi-cpufreq before requesting it. Signed-off-by: Borislav Petkov --- drivers/cpufreq/powernow-k8.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index 056faf6af1a9..0234d0c6d68c 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c @@ -1249,6 +1249,24 @@ static struct cpufreq_driver cpufreq_amd64_driver = { .attr = powernow_k8_attr, }; +static void __request_acpi_cpufreq(void) +{ + const char *cur_drv, *drv = "acpi-cpufreq"; + + cur_drv = cpufreq_get_current_driver(); + if (!cur_drv) + goto request; + + if (strncmp(cur_drv, drv, min_t(size_t, strlen(cur_drv), strlen(drv)))) + pr_warn(PFX "WTF driver: %s\n", cur_drv); + + return; + + request: + pr_warn(PFX "This CPU is not supported anymore, using acpi-cpufreq instead.\n"); + request_module(drv); +} + /* driver entry point for init */ static int __cpuinit powernowk8_init(void) { @@ -1256,8 +1274,7 @@ static int __cpuinit powernowk8_init(void) int rv; if (static_cpu_has(X86_FEATURE_HW_PSTATE)) { - pr_warn(PFX "this CPU is not supported anymore, using acpi-cpufreq instead.\n"); - request_module("acpi-cpufreq"); + __request_acpi_cpufreq(); return -ENODEV; }