From patchwork Sun Jan 20 10:24:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 2008031 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 A06F13FDD1 for ; Sun, 20 Jan 2013 10:25:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751963Ab3ATKYn (ORCPT ); Sun, 20 Jan 2013 05:24:43 -0500 Received: from mail.skyhub.de ([78.46.96.112]:41418 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751620Ab3ATKYj (ORCPT ); Sun, 20 Jan 2013 05:24:39 -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=me3f32f7rAyVqJhIa/r4vgalAckXFv5PAxAoNQ6bZAI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=TK2I NjqW6z9j2lYwYM2bcCPof82+VOS9gr+93lDkVoV4gBKSW0yqo0DLK18L3iujs38txgy 4g3TWaJukEDOex4aDRIEICuIjyoYvPRmV0VQvX9YhyICGpV8/dKQmfaRTi1lKNxT9v9 0k7BuSuKTUIXB6UQkCBXu5TbMsXbA8Uxk= 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 YdhCvSSu8Yyw; 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 60A5B1DA204; Sun, 20 Jan 2013 11:24:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1358677477; bh=me3f32f7rAyVqJhIa/r4vgalAckXFv5PAxAoNQ6bZAI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=E9nY wM4fSHyLsnhkw+HvzpIO3SqB0tB1KlpWriH4dVP80vAZeC0IcEJjdfs3xztT6u/fhVi tlRzayh/5NuhlrRF5YIYNcd9RtcPJrBD+wBTJ8l/dZDjuQW4F4gY02X/6B6YhyBZvGD afCQf/3Y+ENj7ERsxR4P7nlwXPEXOW43w= Received: by liondog.tnic (Postfix, from userid 1000) id C7DE7101801; 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 4/6] cpufreq: Add a get_current_driver helper Date: Sun, 20 Jan 2013 11:24:28 +0100 Message-Id: <1358677470-17394-5-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 Add a helper function to return cpufreq_driver->name. Signed-off-by: Borislav Petkov Acked-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 14 ++++++++++++++ include/linux/cpufreq.h | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 1f93dbd72355..6ed3c1377caf 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1386,6 +1386,20 @@ static struct syscore_ops cpufreq_syscore_ops = { .resume = cpufreq_bp_resume, }; +/** + * cpufreq_get_current_driver - return current driver's name + * + * Return the name string of the currently loaded cpufreq driver + * or NULL, if none. + */ +const char *cpufreq_get_current_driver(void) +{ + if (cpufreq_driver) + return cpufreq_driver->name; + + return NULL; +} +EXPORT_SYMBOL_GPL(cpufreq_get_current_driver); /********************************************************************* * NOTIFIER LISTS INTERFACE * diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index a55b88eaf96a..a018da2d2a7c 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -407,4 +407,5 @@ void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, unsigned int cpu); void cpufreq_frequency_table_put_attr(unsigned int cpu); +extern const char *cpufreq_get_current_driver(void); #endif /* _LINUX_CPUFREQ_H */