From patchwork Mon Sep 18 19:18:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suniel Mahesh X-Patchwork-Id: 9957479 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2DE7B60385 for ; Mon, 18 Sep 2017 19:18:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20DED204C2 for ; Mon, 18 Sep 2017 19:18:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15E2C28AF1; Mon, 18 Sep 2017 19:18:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 989EF204C2 for ; Mon, 18 Sep 2017 19:18:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750772AbdIRTSo (ORCPT ); Mon, 18 Sep 2017 15:18:44 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:37195 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750747AbdIRTSn (ORCPT ); Mon, 18 Sep 2017 15:18:43 -0400 Received: by mail-pf0-f193.google.com with SMTP id e69so554445pfg.4 for ; Mon, 18 Sep 2017 12:18:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=techveda-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TN/fBg4JY6byY/TIAYwhRNugu1t1MjhbYuR/tQDKb3U=; b=bP3mrZnXebrCqW0uhhpeeSibZ3LpOJPwxqXNaGk7O7I8eu8aDULzSdvu3o5G18/5fq 6WxNdhVQXiS3S2HTp9CBaAjJm5daN3fALfuTy5QWthqGXR+7AT7x8zlTLXu1HQj0JGbd vXNjy/M5vqxtMTqqjzvE4kjNB+1cDNzsqeFbE1iFpLehGH+/uS2Eqpapj7PJG37NHYYj bDfg2pxFA68/X9ZUsNohqCcTCDKGySii/zcYwjGv5K7LFPCgODtN1H5eaRmou08SBaWE zAThcUsOSyBdZLJ5vmsKXAF3uyg278y8xQazf9bVxlJbsB1U6F9cASHN/MaS/0aFdsvl H9+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TN/fBg4JY6byY/TIAYwhRNugu1t1MjhbYuR/tQDKb3U=; b=hOHhzL0yjnzodLwus+4EG/j7ZWMxgvWygqsg4hMM4A9CB8yZyccslIr9SA4eFVgYRW YwT7RVEgH7GsJgVLEBwOmjivYcGBW6vTWcLPfiVIVsdMBO+ul/q/ME+/cQ02X6EqNjII t3sOUDhSiO5c7E2Cm9SHwfddtD3f62KzXwVlB1rqLsbrqr6xczuXarV36rObC7XVwCXC PhJe0EsA2HSw+mptNifuRRYkhIzIB/3iPUbz05NEexdUDo6U+MyiNcfXqEMb4wtNk5be dBJegIGG46lTXzqNXUInNVeDsIH5C6d/El8wNFfrlojz4eDN/+t8qGFrdLLPwitJX2XR kSNg== X-Gm-Message-State: AHPjjUi33xlPu3mLXblS2j8WskSOVQJUCwJwtZLrLWWaGkT/TpE6neDb LWG+vyXXA8EpnrCYis0= X-Google-Smtp-Source: ADKCNb6wLwWomsshCh9RrJpMGMZux9xA989bk2icxyAjYzmW7NlV3wbZcEe2VjmH8TIfJJGpwK3Asg== X-Received: by 10.101.86.79 with SMTP id m15mr32816757pgs.157.1505762323119; Mon, 18 Sep 2017 12:18:43 -0700 (PDT) Received: from localhost.localdomain ([124.123.73.34]) by smtp.gmail.com with ESMTPSA id q13sm179770pfd.100.2017.09.18.12.18.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 12:18:41 -0700 (PDT) From: sunil.m@techveda.org To: viresh.kumar@linaro.org Cc: rjw@rjwysocki.net, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, karthik@techveda.org, Suniel Mahesh Subject: [PATCH v2] drivers: cpufreq: Fix sysfs duplicate filename creation for platform-device Date: Tue, 19 Sep 2017 00:48:05 +0530 Message-Id: <1505762285-16161-1-git-send-email-sunil.m@techveda.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <20170918011503.GA17030@ubuntu> References: <20170918011503.GA17030@ubuntu> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Suniel Mahesh ti-cpufreq and cpufreq-dt-platdev drivers are registering platform-device with same name "cpufreq-dt" using platform_device_register_*() routines. This is leading to build warnings appended below. Providing hardware information to OPP framework along with the platform- device creation should be done by ti-cpufreq driver before cpufreq-dt driver comes into place. This patch add's TI SoC am33xx (uses opp-v2 property) in the blacklist of devices in cpufreq-dt-platform driver to avoid creating platform-device twice and remove build warnings (suggested by Viresh Kumar). [ 2.370167] ------------[ cut here ]------------ [ 2.375087] WARNING: CPU: 0 PID: 1 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x58/0x78 [ 2.383112] sysfs: cannot create duplicate filename '/devices/platform/cpufreq-dt' [ 2.391219] Modules linked in: [ 2.394506] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.13.0-next-20170912 #1 [ 2.402006] Hardware name: Generic AM33XX (Flattened Device Tree) [ 2.408437] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [ 2.416568] [] (show_stack) from [] (dump_stack+0xac/0xe0) [ 2.424165] [] (dump_stack) from [] (__warn+0xd8/0x104) [ 2.431488] [] (__warn) from [] (warn_slowpath_fmt+0x34/0x44) [ 2.439351] [] (warn_slowpath_fmt) from [] (sysfs_warn_dup+0x58/0x78) [ 2.447938] [] (sysfs_warn_dup) from [] (sysfs_create_dir_ns+0x80/0x98) [ 2.456719] [] (sysfs_create_dir_ns) from [] (kobject_add_internal+0x9c/0x2d4) [ 2.466124] [] (kobject_add_internal) from [] (kobject_add+0x4c/0x9c) [ 2.474712] [] (kobject_add) from [] (device_add+0xcc/0x57c) [ 2.482489] [] (device_add) from [] (platform_device_add+0x100/0x220) [ 2.491085] [] (platform_device_add) from [] (platform_device_register_full+0xf4/0x118) [ 2.501305] [] (platform_device_register_full) from [] (ti_cpufreq_init+0x150/0x22c) [ 2.511253] [] (ti_cpufreq_init) from [] (do_one_initcall+0x3c/0x170) [ 2.519838] [] (do_one_initcall) from [] (kernel_init_freeable+0x1fc/0x2c4) [ 2.528974] [] (kernel_init_freeable) from [] (kernel_init+0x8/0x110) [ 2.537565] [] (kernel_init) from [] (ret_from_fork+0x14/0x3c) [ 2.545981] ---[ end trace 2fc00e213c13ab20 ]--- [ 2.551051] ------------[ cut here ]------------ [ 2.555931] WARNING: CPU: 0 PID: 1 at lib/kobject.c:240 kobject_add_internal+0x254/0x2d4 [ 2.564578] kobject_add_internal failed for cpufreq-dt with -EEXIST, don't try to register things with the same name in the same directory. [ 2.577977] Modules linked in: [ 2.581261] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 4.13.0-next-20170912 #1 [ 2.590013] Hardware name: Generic AM33XX (Flattened Device Tree) [ 2.596437] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [ 2.604573] [] (show_stack) from [] (dump_stack+0xac/0xe0) [ 2.612172] [] (dump_stack) from [] (__warn+0xd8/0x104) [ 2.619494] [] (__warn) from [] (warn_slowpath_fmt+0x34/0x44) [ 2.627362] [] (warn_slowpath_fmt) from [] (kobject_add_internal+0x254/0x2d4) [ 2.636666] [] (kobject_add_internal) from [] (kobject_add+0x4c/0x9c) [ 2.645255] [] (kobject_add) from [] (device_add+0xcc/0x57c) [ 2.653027] [] (device_add) from [] (platform_device_add+0x100/0x220) [ 2.661615] [] (platform_device_add) from [] (platform_device_register_full+0xf4/0x118) [ 2.671833] [] (platform_device_register_full) from [] (ti_cpufreq_init+0x150/0x22c) [ 2.681779] [] (ti_cpufreq_init) from [] (do_one_initcall+0x3c/0x170) [ 2.690377] [] (do_one_initcall) from [] (kernel_init_freeable+0x1fc/0x2c4) [ 2.699510] [] (kernel_init_freeable) from [] (kernel_init+0x8/0x110) [ 2.708106] [] (kernel_init) from [] (ret_from_fork+0x14/0x3c) [ 2.716217] ---[ end trace 2fc00e213c13ab21 ]--- Fixes: edeec420de24 ("cpufreq: dt-cpufreq: platdev Automatically create device with OPP v2") Signed-off-by: Suniel Mahesh --- Changes for v2: - The approach (as a result patch decsription) was changed as per inputs given by Viresh. - Patch was compile tested and built(ARCH=arm) on next-20170918. --- Note: - Patch was hardware tested on AM335x SOC based board. - cpufreq-dt driver got probed and entries related to Dynamic Voltage and Frequency scaling were created in sysfs @ sys/devices/system/cpu/cpu0/cpufreq. - No build/run-time issues reported. --- drivers/cpufreq/cpufreq-dt-platdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c index a020da7..61fe7ee 100644 --- a/drivers/cpufreq/cpufreq-dt-platdev.c +++ b/drivers/cpufreq/cpufreq-dt-platdev.c @@ -106,6 +106,7 @@ * platforms using "operating-points-v2" property. */ static const struct of_device_id blacklist[] __initconst = { + { .compatible = "ti,am33xx", }, { } };