Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp53409ybl; Tue, 27 Aug 2019 15:41:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhdEXjPvLmjJCNlsGqTQQL1ZdjIWsbMG2N29+owlFE/BcUsSFfmAHDbTjPKhyNdEeB1GM5 X-Received: by 2002:a63:1749:: with SMTP id 9mr760801pgx.0.1566945660428; Tue, 27 Aug 2019 15:41:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566945660; cv=none; d=google.com; s=arc-20160816; b=e17LvfpxtIrFYAWONqHV2fFpUIu3JiTUIbXeeGnzB7GwtwCv9GrLKL5MH9ZPf8AUb1 XD0D2zbjXNfut0p0tiLSFj3rPkdM6ZlZV8y7Q+Vr/aMtZm0FIAs+FSIyvxBj3MsfnvQZ EBxZIVT/oP0UPV64sh5p0X/9dX4x5fXYuQRm7VZdlL4+xf0eiptJfq35GMgFcWf0i0pE v8m/ZjwU9KKNsmGmWrYwYfvkcMx8F0mN5nhZfVaa+gf9AdBlzI3RftSJAPPrZDo4/Jkp zggvWGORf4ItyKQJBT7/kBcpi2+eSkiBQrNgCWG6F4PQmfKDgB0otypoKKi5GB0R1Vy2 +GKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date; bh=kKcAYu/ghWxH644C6gOYAYSifpHZwd99ZSs2almBT4o=; b=M8+NNOnKZjegqNAYXYLms8ayz40YzxkOqeZb2wcJVoiqwDum6Z8+NwjIQls8SKoIJV byY4CjuCcIrSRl+RaP1dS2uWZmDhmWSvL9ZZrvuv0Yrbldu6Smcrjm0YI0yhUgJY7p61 IXEpEhyXx8e5TytuZzYUaJ6KiQte2Ynipvbdftmxcj8buXBec/uowSbJg3Bv/FWEwkfW 0r+43ONpq92psg/lLYlZpyMkY3czb2h4YZmNYfwyavM3hXn9V81XVexAoWPikOZ9kXJm 7iUO5CNN1wUXnP5Tgsf+3M857XX+VnRwqoCkpcl0naFnKCkf/hlXW2zy2uSVO1m2vQGw +xLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s8si633367pfd.83.2019.08.27.15.40.44; Tue, 27 Aug 2019 15:41:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726092AbfH0Wjv (ORCPT + 99 others); Tue, 27 Aug 2019 18:39:51 -0400 Received: from mga02.intel.com ([134.134.136.20]:60493 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725989AbfH0Wju (ORCPT ); Tue, 27 Aug 2019 18:39:50 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Aug 2019 15:39:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,438,1559545200"; d="scan'208";a="192395592" Received: from skuppusw-desk.jf.intel.com (HELO skuppusw-desk.amr.corp.intel.com) ([10.54.74.33]) by orsmga002.jf.intel.com with ESMTP; 27 Aug 2019 15:39:50 -0700 Date: Tue, 27 Aug 2019 15:36:53 -0700 From: Kuppuswamy Sathyanarayanan To: Denis Efremov Cc: Bjorn Helgaas , Lukas Wunner , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/4] PCI: pciehp: Switch LED indicators with a single write Message-ID: <20190827223653.GD28404@skuppusw-desk.amr.corp.intel.com> Reply-To: sathyanarayanan.kuppuswamy@linux.intel.com References: <20190819160643.27998-1-efremov@linux.com> <20190819160643.27998-3-efremov@linux.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190819160643.27998-3-efremov@linux.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 19, 2019 at 07:06:41PM +0300, Denis Efremov wrote: > This patch replaces all consecutive switches of power and attention > indicators with pciehp_set_indicators() call. Thus, performing only > single write to a register. > > Reviewed-by: Kuppuswamy Sathyanarayanan > Reviewed-by: Lukas Wunner > Signed-off-by: Denis Efremov Reviewed-by: Kuppuswamy Sathyanarayanan > --- > drivers/pci/hotplug/pciehp_ctrl.c | 19 ++++++++++--------- > drivers/pci/hotplug/pciehp_hpc.c | 4 ++-- > 2 files changed, 12 insertions(+), 11 deletions(-) > > diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c > index 631ced0ab28a..232f7bfcfce9 100644 > --- a/drivers/pci/hotplug/pciehp_ctrl.c > +++ b/drivers/pci/hotplug/pciehp_ctrl.c > @@ -42,8 +42,8 @@ static void set_slot_off(struct controller *ctrl) > msleep(1000); > } > > - pciehp_green_led_off(ctrl); > - pciehp_set_attention_status(ctrl, 1); > + pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_OFF, > + PCI_EXP_SLTCTL_ATTN_IND_ON); > } > > /** > @@ -90,8 +90,8 @@ static int board_added(struct controller *ctrl) > } > } > > - pciehp_green_led_on(ctrl); > - pciehp_set_attention_status(ctrl, 0); > + pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_ON, > + PCI_EXP_SLTCTL_ATTN_IND_OFF); > return 0; > > err_exit: > @@ -172,8 +172,8 @@ void pciehp_handle_button_press(struct controller *ctrl) > slot_name(ctrl)); > } > /* blink green LED and turn off amber */ > - pciehp_green_led_blink(ctrl); > - pciehp_set_attention_status(ctrl, 0); > + pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_BLINK, > + PCI_EXP_SLTCTL_ATTN_IND_OFF); > schedule_delayed_work(&ctrl->button_work, 5 * HZ); > break; > case BLINKINGOFF_STATE: > @@ -187,12 +187,13 @@ void pciehp_handle_button_press(struct controller *ctrl) > cancel_delayed_work(&ctrl->button_work); > if (ctrl->state == BLINKINGOFF_STATE) { > ctrl->state = ON_STATE; > - pciehp_green_led_on(ctrl); > + pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_ON, > + PCI_EXP_SLTCTL_ATTN_IND_OFF); > } else { > ctrl->state = OFF_STATE; > - pciehp_green_led_off(ctrl); > + pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_OFF, > + PCI_EXP_SLTCTL_ATTN_IND_OFF); > } > - pciehp_set_attention_status(ctrl, 0); > ctrl_info(ctrl, "Slot(%s): Action canceled due to button press\n", > slot_name(ctrl)); > break; > diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c > index 5474b9854a7f..aa4252d11be2 100644 > --- a/drivers/pci/hotplug/pciehp_hpc.c > +++ b/drivers/pci/hotplug/pciehp_hpc.c > @@ -667,8 +667,8 @@ static irqreturn_t pciehp_ist(int irq, void *dev_id) > if ((events & PCI_EXP_SLTSTA_PFD) && !ctrl->power_fault_detected) { > ctrl->power_fault_detected = 1; > ctrl_err(ctrl, "Slot(%s): Power fault\n", slot_name(ctrl)); > - pciehp_set_attention_status(ctrl, 1); > - pciehp_green_led_off(ctrl); > + pciehp_set_indicators(ctrl, PCI_EXP_SLTCTL_PWR_IND_OFF, > + PCI_EXP_SLTCTL_ATTN_IND_ON); > } > > /* > -- > 2.21.0 > -- -- Sathyanarayanan Kuppuswamy Linux kernel developer