From patchwork Mon Jul 11 15:18:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prarit Bhargava X-Patchwork-Id: 9223763 X-Patchwork-Delegate: luca@coelho.fi 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 7C08F60871 for ; Mon, 11 Jul 2016 15:18:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D772272AA for ; Mon, 11 Jul 2016 15:18:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61FA527DC2; Mon, 11 Jul 2016 15:18:53 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 D8731272AA for ; Mon, 11 Jul 2016 15:18:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759202AbcGKPS1 (ORCPT ); Mon, 11 Jul 2016 11:18:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60973 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758723AbcGKPSY (ORCPT ); Mon, 11 Jul 2016 11:18:24 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D16E73B70E; Mon, 11 Jul 2016 15:18:23 +0000 (UTC) Received: from praritdesktop.bos.redhat.com (prarit-guest.khw.lab.eng.bos.redhat.com [10.16.186.145]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6BFIMF3001736; Mon, 11 Jul 2016 11:18:22 -0400 From: Prarit Bhargava To: linux-kernel@vger.kernel.org Cc: Prarit Bhargava , Johannes Berg , Emmanuel Grumbach , Luca Coelho , Intel Linux Wireless , Kalle Valo , Chaya Rachel Ivgi , Sara Sharon , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH RESEND] iwlwifi, Do not implement thermal zone unless ucode is loaded Date: Mon, 11 Jul 2016 11:18:21 -0400 Message-Id: <1468250301-10357-1-git-send-email-prarit@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 11 Jul 2016 15:18:24 +0000 (UTC) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Didn't get any feedback or review comments on this patch. Resending ... P. ---8<--- The iwlwifi driver implements a thermal zone and hwmon device, but returns -EIO on temperature reads if the firmware isn't loaded. This results in the error iwlwifi-virtual-0 Adapter: Virtual device ERROR: Can't get value of subfeature temp1_input: I/O error temp1: N/A being output when using sensors from the lm-sensors package. Since the temperature cannot be read unless the ucode is loaded there is no reason to add the interface only to have it return an error 100% of the time. This patch moves the firmware check to iwl_mvm_thermal_zone_register() and stops the thermal zone from being created if the ucode hasn't been loaded. Signed-off-by: Prarit Bhargava Cc: Johannes Berg Cc: Emmanuel Grumbach Cc: Luca Coelho Cc: Intel Linux Wireless Cc: Kalle Valo Cc: Chaya Rachel Ivgi Cc: Sara Sharon Cc: linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org --- drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c index 58fc7b3c711c..64802659711f 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c @@ -634,11 +634,6 @@ static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device, mutex_lock(&mvm->mutex); - if (!mvm->ucode_loaded || !(mvm->cur_ucode == IWL_UCODE_REGULAR)) { - ret = -EIO; - goto out; - } - ret = iwl_mvm_get_temp(mvm, &temp); if (ret) goto out; @@ -684,11 +679,6 @@ static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device, mutex_lock(&mvm->mutex); - if (!mvm->ucode_loaded || !(mvm->cur_ucode == IWL_UCODE_REGULAR)) { - ret = -EIO; - goto out; - } - if (trip < 0 || trip >= IWL_MAX_DTS_TRIPS) { ret = -EINVAL; goto out; @@ -750,6 +740,9 @@ static void iwl_mvm_thermal_zone_register(struct iwl_mvm *mvm) return; } + if (!mvm->ucode_loaded || !(mvm->cur_ucode == IWL_UCODE_REGULAR)) + return; + BUILD_BUG_ON(ARRAY_SIZE(name) >= THERMAL_NAME_LENGTH); mvm->tz_device.tzone = thermal_zone_device_register(name,