From patchwork Fri Sep 29 21:43:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9978737 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 EE93F60329 for ; Fri, 29 Sep 2017 21:45:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E02A8298C6 for ; Fri, 29 Sep 2017 21:45:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D46F0298CA; Fri, 29 Sep 2017 21:45:13 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 431F7298C6 for ; Fri, 29 Sep 2017 21:45:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:References:To:Subject:From:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=t5VjlVCmp5Sdledu0YDrVpC92ZPceJx3ysmnCCOxXbQ=; b=FcQROokyCQY9nK ID3OQqtiwaC31ewpXz9ETlS+MDP7UgN7Qpu3MRia0t2+OAEvr5Al6A3a7C75rYVO0GNe3VP1mp6dF BAuqzc9RRiBEeMGeZwO+qVYh8lLaG6a9S12dCHYSWvYaxP2+f5dG4wO53V9tmVL1TsFBU1zK+WLcf oSHOPPNPgOEtdqQH1t0JZwbOsfX2QP7ZHGNMjtrH3AQ1AQQ4jExbXiGH5O9EASwsW6kVabHCoCOMK lQLhGBPshCmvPWgh9hE9zhjVhsaC75/TuYTAYZPIrkoC3BJOqL2vldtTde3sqxoJ8c/S2QD/RWFZi 2fdrTEsMTGrYoMWZiGoQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dy35o-0000oq-TS; Fri, 29 Sep 2017 21:45:08 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dy35R-0000DK-1j for linux-arm-kernel@lists.infradead.org; Fri, 29 Sep 2017 21:44:46 +0000 Received: by mail-wm0-x242.google.com with SMTP id b189so495648wmd.2 for ; Fri, 29 Sep 2017 14:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=x4ccvzIpN0Dqika6a9eSIWvCLZbaDBxNivJRWrJTEcc=; b=PcSzLn+zjMHlk25Iou+e6AVVo3znPREOf0e4OaoNz1tLuHY1LuND7kyo/UWQ0bGNZS NIkGZhTpPRD4eqCrWWnMZgdA4h18ph/GN9sDhM5mB3COLHHopP1MXmLJ3F2g299v3ydw k3lNqxPvgWq38lhPuMJxwLLsPvWG//fU/zVq4h/ZgEfm0yOntrOulknwXZp8VyAswIuf gDdWD+MdkabUit2bAbVnkuexqWNDGd49FnvvPwX7Ts9x/B9Gu52TpTS0YLzEekQ/g9bu xNFp++/GElxMDj1DsOCTYdkLyq5mIlVM8cXKUkI3ms/hOfn2Ptf4WIH0ihl023/w+zv7 KLKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=x4ccvzIpN0Dqika6a9eSIWvCLZbaDBxNivJRWrJTEcc=; b=p3k7vhxNCSKdZ+yNy0IFSmHk1yX4eZAGDpKg+ubwc5pppyFyPogrqvBlMlgrvgbQFB UYOsi04rfAeZL3y8ToyR0d81x1QcHxhkba5vpG4ZI1/UOcR06Z3REnef6I+8FoKSs9xT FhsciDhiW2UUt4T95V1sDLfPpLanFufjUHUFhybcnnFPCz/HhOC04EiavbZif0agQc7W 3yalCc/QWntRjr7zqq8u4CfnB2AoOtq/gwzizaT8ezqSoLiTrWDBJH6LWMiTKa2GPXZF PExnjEuzUjamG1GOYtSgPBRCSLFdmbngdoIio154QiVQW3ldb+PogZoizVJ3c5JDQfDk Myeg== X-Gm-Message-State: AHPjjUi+YbrUtfnYoMpmRrCM5Vyns4gkWgABCs16QcCqeBLkcO5JXflx E/h/2FS3usjW3S6FiVdfiEPQZQ== X-Google-Smtp-Source: AOwi7QDTQP2c8fkM1fhMLMz86JazEJVIygmXKKNfRYvFQTNbbDnQRYGF61ZUKk40+sygON3j78nk8g== X-Received: by 10.80.206.73 with SMTP id k9mr11380571edj.145.1506721460922; Fri, 29 Sep 2017 14:44:20 -0700 (PDT) Received: from ?IPv6:2003:ea:8bcb:c500:506a:6c9b:118a:c899? (p200300EA8BCBC500506A6C9B118AC899.dip0.t-ipconnect.de. [2003:ea:8bcb:c500:506a:6c9b:118a:c899]) by smtp.googlemail.com with ESMTPSA id i16sm4593600edj.77.2017.09.29.14.44.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Sep 2017 14:44:20 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH 1/5] firmware: arm_scpi: remove usage of drvdata and don't reset scpi_info to null To: Sudeep Holla References: Message-ID: Date: Fri, 29 Sep 2017 23:43:54 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170929_144445_246384_F9ED7A26 X-CRM114-Status: GOOD ( 12.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP I do not see a benefit in using drvdata as variable scpi_info is available everywhere anyway. And setting scpi_info to NULL in scpi_remove isn't needed IMO. If arm_scpi is built-in, then this code is never used. And if arm_scpi is built as a module and some other module calls get_scpi_ops() then due to this dependency scpi_remove is called only after the other module has been removed. Last but not least users usually store the result of get_scpi_ops(), therefore setting scpi_info to NULL wouldn't really help. Signed-off-by: Heiner Kallweit --- drivers/firmware/arm_scpi.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c index c5ce096b..c942761e 100644 --- a/drivers/firmware/arm_scpi.c +++ b/drivers/firmware/arm_scpi.c @@ -866,8 +866,6 @@ static int scpi_init_versions(struct scpi_drvinfo *info) static ssize_t protocol_version_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct scpi_drvinfo *scpi_info = dev_get_drvdata(dev); - return sprintf(buf, "%d.%d\n", PROTOCOL_REV_MAJOR(scpi_info->protocol_version), PROTOCOL_REV_MINOR(scpi_info->protocol_version)); @@ -877,8 +875,6 @@ static DEVICE_ATTR_RO(protocol_version); static ssize_t firmware_version_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct scpi_drvinfo *scpi_info = dev_get_drvdata(dev); - return sprintf(buf, "%d.%d.%d\n", FW_REV_MAJOR(scpi_info->firmware_version), FW_REV_MINOR(scpi_info->firmware_version), @@ -909,21 +905,17 @@ static int scpi_remove(struct platform_device *pdev) { int i; struct device *dev = &pdev->dev; - struct scpi_drvinfo *info = platform_get_drvdata(pdev); - - scpi_info = NULL; /* stop exporting SCPI ops through get_scpi_ops */ of_platform_depopulate(dev); sysfs_remove_groups(&dev->kobj, versions_groups); - scpi_free_channels(dev, info->channels, info->num_chans); - platform_set_drvdata(pdev, NULL); + scpi_free_channels(dev, scpi_info->channels, scpi_info->num_chans); - for (i = 0; i < MAX_DVFS_DOMAINS && info->dvfs[i]; i++) { - kfree(info->dvfs[i]->opps); - kfree(info->dvfs[i]); + for (i = 0; i < MAX_DVFS_DOMAINS && scpi_info->dvfs[i]; i++) { + kfree(scpi_info->dvfs[i]->opps); + kfree(scpi_info->dvfs[i]); } - devm_kfree(dev, info->channels); - devm_kfree(dev, info); + devm_kfree(dev, scpi_info->channels); + devm_kfree(dev, scpi_info); return 0; } @@ -1031,8 +1023,6 @@ static int scpi_probe(struct platform_device *pdev) scpi_info->num_chans = count; scpi_info->commands = scpi_std_commands; - platform_set_drvdata(pdev, scpi_info); - if (scpi_info->is_legacy) { /* Replace with legacy variants */ scpi_ops.clk_set_val = legacy_scpi_clk_set_val;