Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1828727ybe; Tue, 3 Sep 2019 04:14:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCVKuPY6GTOwkCfOcLTYMsLUG1RtKkuwfrtUU32287kfiJLP/6zeL0A/IEpdlEk6j5HICW X-Received: by 2002:a17:902:bb88:: with SMTP id m8mr1217455pls.127.1567509249629; Tue, 03 Sep 2019 04:14:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567509249; cv=none; d=google.com; s=arc-20160816; b=S8x5d+gHGpljJklLHohwA0xLbgpx0p0qahWU/CmOn281CSfqw74DN62h1BV12VeKuk wziRD5ieUGSfU0lfKLehTFlXVV7TexUJ5ouXMx7FwHTnjz+FUM/cP2RP18GEs4i4riei ZmlngnC6H9/XpWK5T8jV5Cs9a/zW6j2E7cK3hBRsiBulB0gJ/wBFGRA/byr3c4IJwnw5 jo9UKN4QCRzrINnyAtVd3+HgeNKdDO9yNYpztJb0mXOACqCB1lxxfCZpC9u5G4mh3HEd 8Gokm55rtpg1ZA+7WS2DlDe6WA2ILYzrS2+NU0ZgrL42VMrdw1X9CdCf9T1A/fRWOL30 3Bow== 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=ePgnJvYxWrV7sbrqetU6IzX5b2sFn8WAvNr4Gv1qEEY=; b=wZtUor87fW5zIKeAXlfaV/P2gO0nQEBwIXBf/kNduucAJP/wOdXjIxqg9ooOuSAPvY 5IbldDjBU4LflztgYB/rwJ7zHIL9kGBtKsGEudEL1iwpYihe5yxDfYyh4JnUphbRmCJA UsRtmKx/srsIFW8f3zyvq1j4DP0KSLEXmK6UTJohfby8WaQdmF6PDACVDoW5liHKJxwL ZUzkCuD57Iqfn0K2dtlC7kC4ni7H0kDNTB78y8VgSTYvJsts+/h2RZDPp5qWHSBmPziz GktQOCc41EQOAlPsRLwW6+7NoXW9bLfe2ciLk2CAlWseimHO8CaryM8iRVTyGDqx1z9V b0/w== 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 b3si14741676plc.332.2019.09.03.04.13.54; Tue, 03 Sep 2019 04:14:09 -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 S1728940AbfICLLC (ORCPT + 99 others); Tue, 3 Sep 2019 07:11:02 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:52547 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728838AbfICLLA (ORCPT ); Tue, 3 Sep 2019 07:11:00 -0400 Received: by mail-wm1-f65.google.com with SMTP id t17so17682144wmi.2; Tue, 03 Sep 2019 04:10:59 -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=ePgnJvYxWrV7sbrqetU6IzX5b2sFn8WAvNr4Gv1qEEY=; b=eTEr/b6xMARK2Q0RJnEx0VVL5NpE+UXXxzu/3e4BWK5LJ5kHx1HstvSyAGklpZPTCS cOmQahq0vDY2GWzos6p9mtdvdwTbXCAkJGZ39v91EYwY3MDyORY44E1uU3JKUsOZbQ72 KjsvEWmShjmQQbtyDxdpscVVaRtnZatfX1RU08lelAPaMRCtJ0o/v9QIp0PFUAvciMWD 6F38Ya+pCnzT014tAP3jv4lsMilkiPlbXP4IG6aCM8X1SXeKME6dzyDNxlosV4wLZB33 qZLFNhq4Ihy3GyLwM0AnRc72deMh/GYEm6ZwZlvREQE94/Ops7nEDpXvDhIcdJvGFhyL 5DZQ== X-Gm-Message-State: APjAAAVDVdzcTy5vao0/x0GiOt/C/bPaPKJO7aW7SoewG1VnDGldmJWE 2L9disuboLDTJnmO4A+efdg= X-Received: by 2002:a1c:7c1a:: with SMTP id x26mr44727496wmc.115.1567509059271; Tue, 03 Sep 2019 04:10:59 -0700 (PDT) Received: from black.home (broadband-188-32-48-208.ip.moscow.rt.ru. [188.32.48.208]) by smtp.googlemail.com with ESMTPSA id w12sm4363572wrg.47.2019.09.03.04.10.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 04:10:58 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: Denis Efremov , Lukas Wunner , linux-pci@vger.kernel.org, Kuppuswamy Sathyanarayanan , Oliver O'Halloran , linux-kernel@vger.kernel.org Subject: [PATCH v4 4/4] PCI: pciehp: Remove pciehp_green_led_{on,off,blink}() Date: Tue, 3 Sep 2019 14:10:21 +0300 Message-Id: <20190903111021.1559-5-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190903111021.1559-1-efremov@linux.com> References: <20190903111021.1559-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 Remove pciehp_green_led_{on,off,blink}() and use pciehp_set_indicators() instead, since the code is mostly the same. Reviewed-by: Kuppuswamy Sathyanarayanan Signed-off-by: Denis Efremov --- drivers/pci/hotplug/pciehp.h | 6 +++--- drivers/pci/hotplug/pciehp_ctrl.c | 7 +++--- drivers/pci/hotplug/pciehp_hpc.c | 36 ------------------------------- 3 files changed, 7 insertions(+), 42 deletions(-) diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index cf59f70a33cc..dcbf790b7508 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h @@ -174,9 +174,6 @@ void pciehp_set_indicators(struct controller *ctrl, int pwr, int attn); void pciehp_get_latch_status(struct controller *ctrl, u8 *status); int pciehp_query_power_fault(struct controller *ctrl); -void pciehp_green_led_on(struct controller *ctrl); -void pciehp_green_led_off(struct controller *ctrl); -void pciehp_green_led_blink(struct controller *ctrl); bool pciehp_card_present(struct controller *ctrl); bool pciehp_card_present_or_link_active(struct controller *ctrl); int pciehp_check_link_status(struct controller *ctrl); @@ -190,6 +187,9 @@ int pciehp_get_attention_status(struct hotplug_slot *hotplug_slot, u8 *status); int pciehp_set_raw_indicator_status(struct hotplug_slot *h_slot, u8 status); int pciehp_get_raw_indicator_status(struct hotplug_slot *h_slot, u8 *status); +#define set_power_indicator(ctrl, x) \ + pciehp_set_indicators(ctrl, (x), PCI_EXP_SLTCTL_ATTN_IND_NONE) + static inline const char *slot_name(struct controller *ctrl) { return hotplug_slot_name(&ctrl->hotplug_slot); diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 232f7bfcfce9..d0f55f695770 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c @@ -65,7 +65,7 @@ static int board_added(struct controller *ctrl) return retval; } - pciehp_green_led_blink(ctrl); + set_power_indicator(ctrl, PCI_EXP_SLTCTL_PWR_IND_BLINK); /* Check link training status */ retval = pciehp_check_link_status(ctrl); @@ -124,7 +124,7 @@ static void remove_board(struct controller *ctrl, bool safe_removal) } /* turn off Green LED */ - pciehp_green_led_off(ctrl); + set_power_indicator(ctrl, PCI_EXP_SLTCTL_PWR_IND_OFF); } static int pciehp_enable_slot(struct controller *ctrl); @@ -311,7 +311,8 @@ static int pciehp_enable_slot(struct controller *ctrl) pm_runtime_get_sync(&ctrl->pcie->port->dev); ret = __pciehp_enable_slot(ctrl); if (ret && ATTN_BUTTN(ctrl)) - pciehp_green_led_off(ctrl); /* may be blinking */ + /* may be blinking */ + set_power_indicator(ctrl, PCI_EXP_SLTCTL_PWR_IND_OFF); pm_runtime_put(&ctrl->pcie->port->dev); mutex_lock(&ctrl->state_lock); diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index eeac2e704c75..9fd8f99132bb 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -439,42 +439,6 @@ void pciehp_set_indicators(struct controller *ctrl, int pwr, int attn) } } -void pciehp_green_led_on(struct controller *ctrl) -{ - if (!PWR_LED(ctrl)) - return; - - pcie_write_cmd_nowait(ctrl, PCI_EXP_SLTCTL_PWR_IND_ON, - PCI_EXP_SLTCTL_PIC); - ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__, - pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, - PCI_EXP_SLTCTL_PWR_IND_ON); -} - -void pciehp_green_led_off(struct controller *ctrl) -{ - if (!PWR_LED(ctrl)) - return; - - pcie_write_cmd_nowait(ctrl, PCI_EXP_SLTCTL_PWR_IND_OFF, - PCI_EXP_SLTCTL_PIC); - ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__, - pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, - PCI_EXP_SLTCTL_PWR_IND_OFF); -} - -void pciehp_green_led_blink(struct controller *ctrl) -{ - if (!PWR_LED(ctrl)) - return; - - pcie_write_cmd_nowait(ctrl, PCI_EXP_SLTCTL_PWR_IND_BLINK, - PCI_EXP_SLTCTL_PIC); - ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__, - pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, - PCI_EXP_SLTCTL_PWR_IND_BLINK); -} - int pciehp_power_on_slot(struct controller *ctrl) { struct pci_dev *pdev = ctrl_dev(ctrl); -- 2.21.0