Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2672274ybl; Sun, 11 Aug 2019 06:30:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhjZTc/iSEMTIjAmwYBJXwC78+bGwLwgdHI65kFOkbya1B6+mAIZjrR2j9YRQ/whNfWpWC X-Received: by 2002:a17:90a:8c90:: with SMTP id b16mr18909447pjo.133.1565530258406; Sun, 11 Aug 2019 06:30:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565530258; cv=none; d=google.com; s=arc-20160816; b=FLtR+tshkidFMl6w70I0flu5ma7DzIVZ9TKPIsTLpq79SM3JLHEg5rw3j0CJZ1h9vn lB3ozOySed59FgWAQqFBsvz6ovj74m4fouqkSsDGvK1wvHvQKiXdPzdt37Qjry2lITsR 6xwJ+J1JNceRRRoBp6TiuV5MDBmc3Ux1VOmnT9fTOaNP80clyY17fbSjBhdhaR9RzOgv gICjtHUnUDpMZm0HPxiI8rzUwz4rsz7U45Zq9NYCAkX11Vx0Ui6qYBEJZFHJXUv4IK4p poYFfmLtnHgBgmcEis3h6Ahei2MVUAixkiHxa7elu65SrehdglUsawJXpBfDcbZWtxWc CGFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=G7RJjZKxRQxu4CimQzXCh68b+FLqre0DDDhafOZHiPs=; b=FgJ7gr8eX7i9kGhheyBgQbk6Y80ze5i89t5V4SAZ9DqrMRkYS2bMop326Mj7d/iDOW 3JhVpuPXeSAgGGUGK1fASuWVobAGIwxjdTTSmzt2/gxdCZ6wW+638zxWvEBD1x3aO6sv m9OF1+Ucj93i/46RgEX+TPvzla4EPju9t374QFcSGr+QxXu6Bykoiy/bHDZ7nhEnBIWM j8g+ZOEuld/wU3X44amWT/14TO2P72YsKnUcVR1+oMORFkYR1nc0ciP52WeQTOvwIUkB wwdsW6ABTtT9YUQYPtZC491FWqyWbBzGYW+33Zwy/KBLFoVGUBq49SD6r4c/hudiHvNC 1GzQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si58158917pgv.541.2019.08.11.06.30.43; Sun, 11 Aug 2019 06:30:58 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726522AbfHKNaD (ORCPT + 99 others); Sun, 11 Aug 2019 09:30:03 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:35787 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726498AbfHKNaD (ORCPT ); Sun, 11 Aug 2019 09:30:03 -0400 Received: by mail-wr1-f67.google.com with SMTP id k2so16451854wrq.2; Sun, 11 Aug 2019 06:30:01 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=G7RJjZKxRQxu4CimQzXCh68b+FLqre0DDDhafOZHiPs=; b=L2R4Vy4amndPV5w5qdiaTxE4lgNiT32vGto98AsuciwyPUx8m2pI7Sa3kDidzXaKBP XC0ZFtvChEkMnA5eQGdbQKjXugJE8hH0GfGEczDmCf4qt7WPonJ3+KZ7MFaQxg5BdZM/ YnJnfysQAPl3QGEkqaDqjPR8gdSYX07xwMJa+hiMgiaF7hNnclh4zKllCmkCJUjn/Qp0 g2xyQ2SHc0FFKCohZjzwMtmHDEABJhiAUp5Wmac5oWxue+ChsXB3x7C/IS6co5g4+5Tp ViWsWP70q7/3xJSwCG740dWVcpeFHEb1tvQH+3Ze2z5B7wG7eAYKdL87e4eRePzQSCMY IK0w== X-Gm-Message-State: APjAAAUmAtbZhjuA9zPC2asRlVFu4Afr8QuOQmbuVzakV4Ejyhl0P6jL E8tSfxRh/RfKWiyV46mQ608PnxBc X-Received: by 2002:a5d:4284:: with SMTP id k4mr31260226wrq.6.1565530201178; Sun, 11 Aug 2019 06:30:01 -0700 (PDT) Received: from localhost.localdomain (broadband-188-32-48-208.ip.moscow.rt.ru. [188.32.48.208]) by smtp.googlemail.com with ESMTPSA id o16sm13781463wrp.23.2019.08.11.06.30.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Aug 2019 06:30:00 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Denis Efremov Subject: [PATCH 2/4] PCI: pciehp: Switch LED indicators with a single write Date: Sun, 11 Aug 2019 16:29:43 +0300 Message-Id: <20190811132945.12426-3-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190811132945.12426-1-efremov@linux.com> References: <20190811132945.12426-1-efremov@linux.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch replaces all consecutive switches of power and attention indicators with pciehp_set_indicators() call. Thus, performing only single write to a register. Signed-off-by: Denis Efremov --- drivers/pci/hotplug/pciehp_ctrl.c | 14 +++++--------- drivers/pci/hotplug/pciehp_hpc.c | 3 +-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 631ced0ab28a..258a4060466d 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c @@ -42,8 +42,7 @@ 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, PWR_OFF, ATTN_ON); } /** @@ -90,8 +89,7 @@ static int board_added(struct controller *ctrl) } } - pciehp_green_led_on(ctrl); - pciehp_set_attention_status(ctrl, 0); + pciehp_set_indicators(ctrl, PWR_ON, ATTN_OFF); return 0; err_exit: @@ -172,8 +170,7 @@ 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, PWR_BLINK, ATTN_OFF); schedule_delayed_work(&ctrl->button_work, 5 * HZ); break; case BLINKINGOFF_STATE: @@ -187,12 +184,11 @@ 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, PWR_ON, ATTN_OFF); } else { ctrl->state = OFF_STATE; - pciehp_green_led_off(ctrl); + pciehp_set_indicators(ctrl, PWR_OFF, ATTN_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 027e3864f632..e90cb2152e8f 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -687,8 +687,7 @@ 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, PWR_OFF, ATTN_ON); } /* -- 2.21.0